Active MQ : org.apache.activemq.AlreadyClosedException: this connection - spring

Recently I have updated Spring version 4.2.4.RELEASE from 3.2.1.RELEASE
I was using `JmsTemplatez to convert and send message as:
jmsTemplate.convertAndSend(request, new CorrelationIdPostProcessor(request.getMessageId(), messageQueueAuditLogger));
After the upgrade to Spring 4.2.4.RELEASE I started to get an exception:
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is org.apache.activemq.AlreadyClosedException: this connection
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
Caused by: org.apache.activemq.AlreadyClosedException: this connection
at org.apache.activemq.pool.PooledConnection.assertNotClosed(PooledConnection.java:161)
at org.apache.activemq.pool.PooledConnection.start(PooledConnection.java:77)
at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.localStart(SingleConnectionFactory.java:632)
at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.invoke(SingleConnectionFactory.java:569)
at com.sun.proxy.$Proxy52.start(Unknown Source)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
Active MQ version in use: 5.4.2
If any one has came across this error please share your comments.

Previously I was using org.apache.activemq.pool.PooledConnectionFactory which is causing this exception. I have replaced PooledConnectionFactory with org.springframework.jms.connection.SingleConnectionFactory and this has resolved the problem

Related

How to ignore mongo when start application

A legacy Spring boot project, before it used mongo, but now it does not need. Now start this project it has this error
2022-10-27 14:10:13.119 [cluster-ClusterId{value='635a20bb714f8f71e2e5d041', description='null'}-10.48.51.21:40010] [INFO] [org.mongodb.driver.cluster] - Exception in monitor thread while connecting to server 10.48.51.21:40010
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:127)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
then I exclude related Auto Configuration class
#SpringBootApplication(exclude={MongoAutoConfiguration.class, MongoRepositoriesAutoConfiguration.class,MongoDataAutoConfiguration.class})
but this time project start failed
***************************
APPLICATION FAILED TO START
***************************
Description:
Field mongoTemplate in com.bxt.bmht_support.dao.BmhtMideTableDao required a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' that could not be found.
How to disable mongo without update current code? just want ignore it.

camel upgrade issue in spring project

I am facing issue in upgrading camel 3.7.0 to 3.15.0. I am getting below error:
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.spring.xml.handler.CamelNamespaceHandler]: Unresolvable class definition; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.spring.xml.handler.CamelNamespaceHandler
2875Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [producer-camel-core-context.xml];
Any help is highly appreciated.
BeanDefinitionStoreException
If you use ActiveMQ 5.x that ships with Camel 1.x and you upgrade it to use Camel 2.0 you can get an exception while starting.
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanDefinitionStoreException:
Unrecognized xbean namespace mapping: http://activemq.apache.org/camel/schema/spring
The reason is basically that the XML namespace changed in Camel 2.0 as explained below.
When Camel went from an activemq subproject to a top level apache project, they changed the URIs for their xml schemas to reflect this in Camel 2.0.
To fix this, in activemq.xml change all occurrences of:
http://activemq.apache.org/camel/schema/spring
to
http://camel.apache.org/schema/spring
and
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
to
http://camel.apache.org/schema/spring/camel-spring.xsd
Refer:
(http://people.apache.org/~dkulp/camel/exception-beandefinitionstoreexception.html)

Not able to access rabbitMQ installed in docker

I have installed rabbit MQ in docker, my host machine OS is windows. Now I am not able to access rabbit mq instance present in my docker but others can access the same using my Ip address. While trying to connect using spring boot amqp I am getting error
org.springframework.amqp.AmqpIOException: java.io.IOException .....
Caused by: java.io.IOException: null .....
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error....
Caused by: java.net.SocketException: Connection reset.....

Oracle JDBC connection failure

I am experiencing a very strange problem , I have few Junit test cases which create JDBC Oracle connection and close when they are done. For example I have 5 junit
FetchTest
InsertTest
UpdateTest
DeleteTest
First 2 test cases are running perfectly fine, But when 3rd test case is try to connect to Oracle through JDBC its through Exception
Exception occured while creating connection object using DriverManager
at java.net.SocketOutputStream.socketWrite0(Native Method) at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159) at
oracle.net.ns.DataPacket.send(DataPacket.java:199) at
oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:211) at
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:227)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:175) at
oracle.net.ns.NetInputStream.read(NetInputStream.java:100) at
oracle.net.ns.NetInputStream.read(NetInputStream.java:85) at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:122)
at
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:78)
at
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179)
at
oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1155)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279) at
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) at
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
at
oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359) at
oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:221)
at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) at
java.sql.DriverManager.getConnection(DriverManager.java:571) at
java.sql.DriverManager.getConnection(DriverManager.java:215)
And then my 4th Test will also run fine, getting connection and deleting data as expected.
I also tried to ignore 3rd Test case, And then the 4th test case giving same Exception.
What are the possible cause of this exception ?
Is this any issue with time ? Because this exception occur in daily build in Jenkins
java.sql.SQLRecoverableException: IO Error: Connection reset by peer: socket write error
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:421)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)

RuntimeMBeanCallable.call() exception

When a .wlapp file is deployed in MobileFirst Console, we get the following error in the logs. This happened after we upgraded MobileFirst Server from 6.3 to 7, but don't know if this is related to the version of MobileFirst.
000001c6 BaseTransacti E RuntimeMBeanCallable.call() exception
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy166.deployApplication(Unknown Source)
at com.ibm.worklight.admin.actions.ApplicationDeploymentTransaction.prepareMBean(ApplicationDeploymentTransaction.java:919)
at com.ibm.worklight.admin.actions.util.RuntimeMBeanWorkerThreadCaller$RuntimeMBeanCallable.call(RuntimeMBeanWorkerThreadCaller.java:76)
at com.ibm.worklight.admin.actions.util.RuntimeMBeanWorkerThreadCaller.callSynchronously(RuntimeMBeanWorkerThreadCaller.java:183)
at com.ibm.worklight.admin.actions.util.RuntimeMBeanPoolCaller.callRuntimeMBeans(RuntimeMBeanPoolCaller.java:91)
at com.ibm.worklight.admin.actions.BaseTransaction.prepare(BaseTransaction.java:450)
at com.ibm.worklight.admin.actions.BaseTransaction.internalRun(BaseTransaction.java:348)
at com.ibm.worklight.admin.actions.BaseTransaction$1.run(BaseTransaction.java:235)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:790)
Caused by: com.ibm.websphere.management.exception.ConnectorException: ADMC0009E: The system failed to make the SOAP RPC call: invoke
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:894)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:689)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:679)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:665)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:487)
at com.sun.proxy.$Proxy121.invoke(Unknown Source)
at com.ibm.ws.management.AdminClientImpl.invoke(AdminClientImpl.java:224)
at com.worklight.common.util.jmx.WASRuntimeMBeanHandler$AdminClientMBeanServerConnection.invoke(WASRuntimeMBeanHandler.java:521)
at com.sun.jmx.mbeanserver.MXBeanProxy$InvokeHandler.invoke(MXBeanProxy.java:146)
at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:160)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:246)
... 11 more
Caused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:479)
at org.apache.soap.rpc.Call.WASinvoke(Call.java:510)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient$8.run(SOAPConnectorClient.java:852)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:845)
... 21 more
MobileFirst version 7
WAS server version 8.5.5.5
JRE version 1.6
Re-deploying the MobileFirst artifacts to the application server should normally not be required as inspecting the logs and configuration usually will lead to the root cause of the problem. However in some cases starting over to get things right will work.
As mentioned in the comments, re-deployment of the server artifacts nullified the issue that was experienced.

Resources