I am working on a service, where if there is any issue in the application, the request gets quarantined and can be reprocessed manually again after fixing the issue. If any network issue, such quarantined requests can be just processed again without any fix.
Now, I am working on a fix where the application failed to get DB Connectivity with MariaDB and got quarantined. As part of the quarantine, there are some meta data should be populated. One of the metadata is wrong and I have fixed to populate correct data.
I need to come up with JUnit test cases to automatically test this scenario. When I tested in my local, I brought down my local instance of the MariaDB and tested the same and my fix was working fine. Now I need to push this fix to stage environment, where automated test cases should run successfully. In my case, for this fix, I need to replicate the DB connectivity Issue scenario to test my issue fix.
The application/service that I work - it is not a direct http/https call. I post a message to a Kafka stream and the service picks up from the stream. So I need help in writing test case, where the DB connectivity issue should happen in the asynchronous service and gets quarantined. Is this possible?
Error:
"exception": "org.springframework.jdbc.CannotGetJdbcConnectionException",
"message": "Failed to obtain JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : Socket fail to connect to host
Related
I have an spring boot application that is deployed on a tomcat 8 webserver running on a CentOS machine that uses a MSSQL 13.0.5026.0 db on a windows server 2016.
I have a simple REST controller that produces a response to a request.
I can see from logs that backend produces a 200 response after finishing the request task.
The problem is that frontend never receives the response. It remains in pending.
It's a problem I have been experiencing in production only recently on a codebase that didn't change lately.
The same app worked normally until lately so I dont't believe it's an issue with spring it self but rather with tomcat, catalina, network, DB or other actors that could contribute to the problem
I checked the DB for eventual deadlocks or pending transactions that didn't finish appropriatelly and I found no issues.
I tried restarting the tomcat service and the DB service but unfortunatelly the problem continued to persist.
The response produced is a simple string message so I don't believe that a network problem due to response size is an issue.
Do you have any experience with similar problems? What could produce such a result?
Thank you
I've faced a problem with error handling on my gRPC client. Shortly: I've got gRPC client and server both running in Kubernetes. Client makes synchronous calls to server to retrieve some data. Everything goes fine, but some time ago the client received an error rpc error: code = Unavailable desc = resolver returned no addresses. I've restarted the POD and it has reconnected without any problems.
After googling and looking into the gRPC balancer source code I've found that this error returns when the balancer cannot get the IP from a DNS (thats quite logical). It seems to be effects of Kubernetes PODs rebalancing or so.
But the question is how to handle this error properly? GRPC client has built in reconnection mechanism but it's not triggered in that situation. Of course I can catch this error, close existing connection and make a dial again, but I don't want to build a bicycle if there is more correct way to handle it.
Thank you!
I have a Web Application that use Hibernate 3.0. When I restart my database server, is it always necessary to restart jboss server?
Can I reconnect to database without restart jboss server?
Depends on the pool configuration.
If you enable the "validate connection" checking, by passing a SQL to be executed before a connection is handled to the caller, your application will not get invalid connections. Meaning that the connection will be thrown out and a new one will be acquired in case the connection is broken. The price you pay for this, of course, is that you are doing a round-trip to the server.
But usually, you could leave this out and let the Exception sorter handle the case. In case JDBC problems are thrown by the Driver, this "Sorter" will analyse them and determine if the connection can be returned to the pool or not. I'm not sure about the MySQL implementation of the Exception Sorter, so, it might be worth trying. If it doesn't helps, you can always extend the existing sorter and add your logic to it.
I realize a Gwt, SmartGWT project.
I use mostly the datasources of SmartGWT.
But I have to run a special query on a remote database, I use rpc for this.
On my pc in local mode RPC operates. I also made one .war file in order to do a deployment test in local mode, that works too.
The problem is when deploying to the remote server, the RPC request does not work anymore (status code 404 (Stacktrace: Unknow as)). I do not think this is a problem of servlet mapping but possible.
The remote server is in Asia, the database is in Prague ldap server is in Asia.
This should produce this:
My client sends the RPC request to the server in asia.
The server in asia do a connection and a "select" to an Oracle database in Prague.
The select triggers a PL-SQL code that makes a connection to an ldap server to obtain data and populates a temporary table that returns the SQL query
The data is sent to the server that is in asia.
The server in asia returns the response to me
I'm in europe.
The fact that it works in local mode (you do not need to go to asia) make me think that this is not my code that is problematic.
I think that's the way that the data take.
But how to check?
Many WCF services hosted in one windows.
When windows service is just running, the wcf service endpoints are working well. After a long-time running, the wcf service is down. Though, this time the load is not heavy but instead, the services down.
After down, when I visit the endpoint through Internet browser or client app, they both throw the following exception.
System.ServiceModel.EndpointNotFoundException:
There was no endpoint listening at http://serviceip/servicename that could accept
the message. This is often caused by an incorrect address or SOAP action. See InnerException,
if present, for more details. ---> System.Net.WebException: The remote server returned
an error: (404) Not Found.
I have no idea about this problem. Do anyone know anything about this, pls help.
thanks in advance.
This usually means that your parameters are out of sync or the hosting service may have been modified. Check and make sure your parameters case (if the host is case sensitive) and then ensure you are passing the correct values.
Can you try to turn on tracing on WCF services http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx?