I would like to use ActiveMQ in my Spring Boot application. During debugging I have found out following error:
org.apache.activemq.broker.BrokerService : Failed to start Apache ActiveMQ (localhost, null)javax.management.InstanceAlreadyExistsException: org.apache.activemq:type=Broker,brokerName=localhost`
Seems like broker is created upon creation of the first connection, according to ActiveMQ's documentation. Is is possible to turn off auto-creation by setting the create property on the VM Transport to false, e.g.:
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?create=false");
When I tried this solution I got following error:
DefaultJmsMessageListenerContainer : Could not refresh JMS Connection for destination 'test' - retrying using FixedBackOff{interval=5000, currentAttempts=364, maxAttempts=unlimited}. Cause: Could not create Transport. Reason: java.io.IOException: Broker named 'localhost' does not exist.
Now I think the broker is not creating at all or this process is pending. Did anyone have a similar issue? If so how did you resolve it?
ActiveMQ's vm transport optionally creates a broker, or connects to a running broker.
Sounds like you are missing a step in your application boot-up plan. Either you need:
A component to startup the broker
Designate one of the connection factories to start the broker using the vm transport:
Designated broker startup connection factory:
vm://localhost?create=true
All other connection factories:
vm://localhost?create=false
Related
I'm using the following endpoint :
jms:queue:MY_JMS_QUEUE?transacted=true&recoveryInterval=10000&testConnectionOnStartup=true
Everything works well but whenever the MQ connection is lost (due to IBM MQ server restart), the connection refresh does not work.
In my logs i have that :
ERROR [c.c.j.DefaultJmsMessageListenerContainer] []] Could not refresh JMS Connection for destination 'MY_JMS_QUEUE' - retrying using FixedBackOff{interval=10000, currentAttempts=0, maxAttempts=unlimited}. Cause: JMSWMQ0018: Failed to connect to queue manager 'xxx' with connection mode 'Client' ......('MQRC_Q_MGR_NOT_AVAILABLE')
And nothing else, i was expecting to have the same error messages multiples times with currentAttempts=1 then 2... until the MQ is back.
I checked the documentation but i don't see anything else. My configuration:
Camel version : 3.11.3
Java: 11.0.8
Spring boot : 2.5.2
As your connection mode is "Client" you can give the MQ automatic JMS client reconnection feature a try. You would need to configure the "ClientReconnectOptions" in the connection factory definition.
I am using Spring Boot 2.2.1 (w/ Spring 5) to kick off my server with Spring JmsTemplate (HornetQ) connections. Every ~10s an ERROR is logged,
2020-01-17 18:00:49,091 [DefaultMessageListenerContainer-1] ERROR listener.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'a.Topic' - retrying using FixedBackOff{interval=5000, currentAttempts=2, maxAttempts=unlimited}. Cause: clientID=myapp.Topic was already set into another connection
Did I accidentally create another client using the same id and compete for the connection/topic? Or something else I am not aware of.
Did I accidentally create another client using the same id and compete for the connection/topic?
Yes. According to the error message you're receiving you did.
I'm trying to subscribe to a topic using durable and shared enabled, so that multiple instance can be connected to a topic to increase the scalability.
However, only the first instance getting connected without any errors, the second instance message listener keeps throwing the below error messages. I checked with my Webmethods counterpart and he found that the client state was disabled and that's why second listener was not able to connect using the same subscription name.
Can someone throw light on this issue please.
18:14:15,050 WARN
[org.springframework.jms.listener.DefaultMessageListenerContainer]
(DefaultMessageListenerContainer-145) Setup of JMS message listener
invoker failed for destination 'topicName' - trying to recover. Cause:
[BRM.10.2209] JMS: Durable subscription
"connectionFactory##subscriptionName" is in use.
The message
JMS: Durable subscription "connectionFactory##subscriptionName" is in use.
typically hints at a misconfiguration of your Topic on Broker. Please check (with MWS) that the Topic really has "Shared State=true“:
Then make sure your Connection Factory has a „Connection Factory Client ID“ set:
And finally you should set the following JVM setting:
-Dcom.webmethods.jms.clientIDSharing=true
I am trying to setup IBM MQ 7.5.0.2 + Glassfish 4(Payara) JDK 8 and using Camel Integration as a Client
I have followed deploying RAR approach however I am unable to make a connection from Glassfish to MQ
The Connection Pool ping fails stating "Ping Connection Pool failed for MyPool. MQJCA1011: Failed to allocate a JMS connection., error code: MQJCA1011 Please check the server.log for more details."
In server logs, I see the below:
[#|2017-03-24T08:40:31.494+1100|WARNING|Payara 4.1|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator|_ThreadID=111;_ThreadName=org.springframework.jms.listener.DefaultMessageListenerContainer#0-1;_TimeMillis=1490305231494;_LevelValue=900;|RAR5038:Unexpected exception while creating resource for pool MyPool. Exception : com.ibm.mq.connector.DetailedResourceException: MQJCA1011: Failed to allocate a JMS connection., error code: MQJCA1011 An internal error caused an attempt to allocate a connection to fail. See the linked exception for details of the failure.|#]
RAR5117 : Failed to obtain/create connection from connection pool [ MyPool ]. Reason : com.sun.appserv.connectors.internal.api.PoolingException: MQJCA1011: Failed to allocate a JMS connection., error code: MQJCA1011|#]
I am following the below:
https://genericjmsra.java.net/docs/websphere-mq-integration-guide/webspheremq_integration_guide.html
I faced a similar problem, the issue in my case was that the channel was blocked by the CHLAUTH rule. I fixed the issue by disabling authorisation on the channel using the below commands on the IBM Integration Console:
alter QMGR CHLAUTH(DISABLED) alter AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(none) REFRESH SECURITY TYPE(CONNAUTH)
I've been using ActiveMQ for a few weeks now and every time I boot up my laptop, I always just use activemq start to start it but today it throws an error:
Failed to start Apache ActiveMQ, java.io.IOException: Transport Connector could not be registered in
JMX: Failed to bind to server socket: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to: java.net.BindException: Address already in use: JVM_Bind)
What can I do to resolve this?
There is already another ActiveMQ instance running so the new one cannot bind to that server socket just as the exception tells you. Kill the previous instance and then you can start a new one.