Access Denied randomly when connecting to mysql - spring

I have a very rare problem it is a java web application with jsf 2.0, spring 3.0.3 and jpa2 eclipselink implementation running on tomcat 7 when deploying the application to server it run correctly without any errors and after random period of time it return Access Denied for user "user#host" and all i need to do is just restarting tomcat to work again.
Please help if you know anything about this problem.
Thanks,

Are you leaking connections?
It sounds like you're using up all the connections and MySQL won't let you create new ones.

Related

[Ignite]Problem upgrading Ignite 2.7 Services to 2.10....Services always getting canceled?

I completed the code upgrade and removed all deprecated calls from my service code.
This is a Java Spring application and all services come up (as reported in the log files) when the Cluster (of 5 nodes) starts up.
However, when I try to get a serviceProxy to each service, all services get cancelled as a result of ServiceDeploymentTask attempting to do a redeploy of the services!! The redeploy fails and only cancels all of the services and fails to restart them. This can be demonstrated with both a thick and a thin client.
Why is Ignite trying to redeploy the services? (and why don't the services restart?)
Is there something I'm missing from the move to Ignite 2.10???
Finally, why does a Java Thin Client create a NODE_JOIN event?
Thanks in advance.
Greg

Tomcat 8.5 hot deploy lost connection with Elasticsearch

In my test environment, I am running tomcat and I do hot deployment. This works most of the time, but there are rare occasion wherein the connection between tomcat and Elasticsearch gets lost. In my other application with tomcat and Elasticsearch (different version of Elasticsearch), I still encounter the same issue.
Usually, I just restart tomcat and it will establish the connection with Elasticsearch again. So in my other application, I stop tomcat before deploying the war file, then start it again. Since then, I am not getting this issue (lost ES connection) for that project. However, in the project that still uses hot deployment.. I am still getting this weird issue. If I do stop/deploy/start Tomcat, it will not have that issue, but I want this project to use hot deployment. I am thinking that tomcat should reestablish a connection with Elasticsearch, but this is not the case.
Anyone experienced this issue? and how did you manage to fix this hot deployment issue with Elasticsearch? By the way, I use spring data Elasticsearch and rest high level client Elasticsearch on different projects and both have the same issue on hot deploy (rarely happens though).

Spring boot microservices doesn't work with Intelij IDEA

I am creating a spring boot microservice project with intelij IDEA.
Currently I have developed three seperate spring boot rest services as customer service, vehicle service and spring cloud config server. Spring cloud config server is pointing to a github repository.
The issue is sometimes above projects take more than 10 minutes to run and sometimes does't run and give an error message as "failed to check application readystate intellij attached provider for the vm is not found". I have no idea why this happens ?
There are two possible causes:
1. IntelliJ IDEA and the Spring application are running in different JVMs.
There is a bug for IntelliJ IDEA regarding that:
https://youtrack.jetbrains.com/issue/IDEA-210665
Here is short summary:
IntelliJ IDEA uses local JMX connector for retrieving Spring Boot actuator endpoint's data by default. However, it could be impossible to get local JMX connector address via attach api if Spring Boot application and IntelliJ IDEA are run by different JVMs. In this case, add the following lines to VM options of your Spring Boot run configuration:
-Dcom.sun.management.jmxremote.port={some_port}
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
As mentioned in the official Oracle documentation, this configuration is insecure. Any remote user who knows (or guesses) your port number and host name will be able to monitor and control your Java applications and platform.
2. Prolonged time to retrieve local hostname
You can check that time using inetTester. Normally it should take only several milliseconds to complete. If it takes a long time then you can add the hostname returned by inetTester to /etc/hosts file like this:
127.0.0.1 localhost winsky
::1 localhost winsky

Spring boot - Tomcat proper shutdown procedure

I have a sprig boot app leveraging websockets using tomcat. The app is writing stuff to the database constantly, and now I would like to implement a proper shutdown procedures i.e.
I have found a way to tell in my Service Layer to wait until all database transactions has finished however I would like to tell tomcat during that time that he shell not accept new connection i.e. only process the the currently established one. Tomcat should run but all new sessions should be denied.
I can get all the currently logged in users trough the “SessionRegistry” bean and invalidate their sessions, once all database transactions has finished, but that does not prevent anyone form creating new session during that time. So my question is how to I tell tomcat to stop accepting new session but not to drop the currently created one and let them finish. Is there something like that build in into tomcat?
Addition : 15 March 2018
I think i found the answer look
here
Hope that this will be useful for someone

Hot deploy problem in Tomcat with proxool and oracle

I have a problem concerning with proxool and oracle driver in Tomcat.
The web application I use contains a webservice jar file using metro and a servlet to initialize / start the proxool pool. The proxool pool is configured with an oracle connection. When the service is called, it fetches a connection from the pool, executes a statement and returns. I close the resultset, the statement and the connection in the service method afterwards.
When I now try to hot undeploy the web application, the servlet stops proxool pool by ProxoolFacade.shutdown(); in it's destroy method.
The problem is, that the hot undeploy can not finish because the Oracle driver ojdbc5.jar can not be deleted from the folder of the extracted web application.
Trying the same with a SQL server database and the jtds driver it works without this problem.
Used versions:
Apache Tomcat 6.0.18
Oracle 11g JDBC driver 11.1.0.6.0
Proxool 0.9.1
Anyone has an idea?
Regards Timo
You must add the Oracle driver to the Tomcat instance and configure Tomcat JNDI with an Oracle datasoure.
This way, the driver will stay alive when the app is terminated and Tomcat will control the pooling of the DB connections. The reason for your problem is that some DB drivers "hook" into the VM. This means that Tomcat can't unload the classes during redeploy -- there are still references around.
I'd even suggest to try to move proxool into the Tomcat server and have Tomcat manage the pools for you. That would make hot deploy much faster and more reliable, even if you leak connections.

Resources