Open paphillon opened 10 years ago
For 6.1, you do not need to setup any bean for ActiveMQ. Just use "amq:queue:foo" in your Camel routes.
If you want to setup a bean, then either use the jms/activemq component from Apache Camel/ActiveMQ, or use the amq component from fabric.
If you use amq component from fabric and want to define it as a bean, then you must use this class name org.fusesource.mq.fabric.camel.AMQComponent
And mind that this classname is being changed in fuse 6.2, to io.fabric8 package naming.
Thanks for the speedy response. I did try to use the amq as you mentioned (without defining any bean), but that fails with the below errors. This is the same error message that I get, when I use the example-mq-producer along with the default mq broker, so I am pretty sure it's not the code. Maybe something I am missing?
static url works fine. Even connection to the broker from an external client using fabric protocol works fine.
014-07-14 21:57:20,780 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped. 20
I had some success using the jms/Activemq component to connect to the broker using the fabric, it looks like the problem is in the brokerURL, if we pass any parameters to the broker (This use to work in 6.0) fabric url, it fails to get the broker from the fabric.
This does work. discovery:(fabric:default)?maxReconnectAttempts=1&initialReconnectDelay=1000
This works. discovery:(fabric:default)
So if we have to pass some parameters, like above, how do we do it?
when you used "amq:" endpoint, how did you run the broker? fabric8 comes with a bunch of quickstarts that show how to use the amq: endpoint; e.g. in the 1.1.0.CR3 release try using provisioning mq-default profile first (for the broker) then the quickstarts-karaf-camel.amq one.
I am using Jboss 6.1. I did provision the mq-default profile to a container to create the broker, then on a second container I provisioned example-mq-producer and the mq-default-client profile. The error seen was as below.. I think I know what the problem was, the username/password admin / admin to connect to jms has to be specified some where, I think it should be in the mq-default-client profile, but it's not there neither does any document talks about it.
I reverted to using the activemq component, removed all the extra parameters from the discovery:fabric settings and passed username / password to the ActiveMQConnectionFactory bean and was able to connect to mq using fabric.
" Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped."
Thanks!
FWIW the login/pwd of the mq-default broker should be the same as the fabric login/pwd. (You didn't change anything related to authentication in the mq-default profile right?)
No, Nothing was changed in mq-default profile and in that profile I didn't see any username / password property.
Below are the errors when I run example-mq-producer profile. All the profiles are default and no change has been made to them. Where and what are the properties for username / password to be defined?
| 106 - org.apache.activemq.activemq-osgi - 5.9.0.redhat-610379 | Successfully connected to tcp://myhost-Macpro.local:62384 2014-07-16 16:18:11,575 | INFO | agent-1-thread-1 | OsgiFabricDiscoveryAgent | .fabric.OsgiFabricDiscoveryAgent 61 | 121 - org.jboss.amq.mq-fabric - 6.1.0.redhat-379 | closing tracker 2014-07-16 16:18:11,577 | WARN | agent-1-thread-1 | ActiveMQService | rg.fusesource.mq.ActiveMQService 103 | 120 - org.jboss.amq.mq-client - 6.1.0.redhat-379 | Could not start a connection javax.jms.JMSSecurityException: User name [admin] or password is invalid. at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:52) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1408) at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1513) at org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:526)
.....
Caused by: java.lang.SecurityException: User name [admin] or password is invalid. at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:80) at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97) at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:764) at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79) at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:148) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:270) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)[106:org.apache.activemq.activemq-osgi:5.9.0.redhat-610379] at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[106:org.apache.activemq.activemq-osgi:5.9.0.redhat-610379] ... 1 more Caused by: javax.security.auth.login.FailedLoginException: Password does not match at io.fabric8.jaas.ZookeeperLoginModule.login(ZookeeperLoginModule.java:141) at org.apache.karaf.jaas.boot.ProxyLoginModule.login(ProxyLoginModule.java:83)[karaf-jaas-boot.jar:] at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_17] at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:784) at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:698) at javax.security.auth.login.LoginContext$4.run(LoginContext.java:696) at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_17] at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:695) at javax.security.auth.login.LoginContext.login(LoginContext.java:594) at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:73) ... 13 more 2014-07-16 16:18:19,846 | ERROR | agent-1-thread-1 | fabric-activemq-demo | ? ? | 119 - org.fusesource.examples.fabric-activemq-demo - 1.0.0.redhat-379 | [io.fabric8.example.mq.producer(75)] Failed creating the component instance; see log for reason
Caused by: javax.security.auth.login.FailedLoginException: Password does not match at io.fabric8.jaas.ZookeeperLoginModule.login(ZookeeperLoginModule.java:141) at org.apache.karaf.jaas.boot.ProxyLoginModule.login(ProxyLoginModule.java:83)[karaf-jaas-boot.jar:] at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_17] at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_17]
Did you resolve this?
yes, by not specifying the query parameters in the mq fabric uri (?maxReconnectAttempts=1&initialReconnectDelay=1000). If the parameters are specified it fails with the above exceptions.
Also I was never able to make the mq component work OTB and had to specify the beans in the blueprint.
I am using Jboss 6.1 build 39 and migrating from Jboss 6.0. So far I have made all the necessary changes that are required as per the migration guide, but for some reason I am not able to get the camel jms route working using the fabric discovery protocol.
The mq broker, profile is the mq-default profile, and the mq-client-default has been assigned to my container. In 6.0 I was configuring the connection factory brokerURL etc, that code fails with other error, then looking up the documentation that talks about using "amq" component, which does not require any configuration and should work out-of-the-box. But it still fails with the below error, whereas if I try to configure it the old way, of defining the brokerURL, connection factory etc, it fails to even get the brokerURL from the registry.
The error when using amq, is also the same when the example-mq-producer is deployed onto a container.
Note: I am able to connect to the broker using an external client and fabric protocol successfully.
As you can see below, when I use amq, it does get the broker URL from the registry, but then it just throws error messages stating Could not refresh JMS Connection for destination..
2014-07-14 21:57:15,762 | INFO | ActiveMQ Task-1 | FailoverTransport | sport.failover.FailoverTransport 1055 | 110 - org.apache.activemq.activemq-osgi - 5.9.0.redhat-610379 | Successfully connected to tcp://myhost-Macpro.local:50931 2014-07-14 21:57:15,774 | INFO | agent-1-thread-1 | OsgiFabricDiscoveryAgent | .fabric.OsgiFabricDiscoveryAgent 61 | 133 - org.jboss.amq.mq-fabric - 6.1.0.redhat-379 | closing tracker 2014-07-14 21:57:15,777 | INFO | agent-1-thread-1 | BlueprintCamelContext | e.camel.impl.DefaultCamelContext 2224 | 113 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Route: email-route started and consuming from: Endpoint[amq://queue:queue.notification] 2014-07-14 21:57:15,782 | INFO | agent-1-thread-1 | BlueprintCamelContext | e.camel.impl.DefaultCamelContext 1568 | 113 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Total 2 routes, of which 2 is started. 2014-07-14 21:57:15,783 | INFO | agent-1-thread-1 | BlueprintCamelContext | e.camel.impl.DefaultCamelContext 1569 | 113 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | Apache Camel 2.12.0.redhat-610379 (CamelContext: notifContext) started in 0.184 seconds 2014-07-14 21:57:15,788 | INFO | agent-1-thread-1 | DeploymentAgent | io.fabric8.agent.DeploymentAgent 753 | 60 - io.fabric8.fabric-agent - 1.0.0.redhat-379 | Done. 2014-07-14 21:57:20,778 | WARN | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 842 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Setup of JMS message listener invoker failed for destination 'queue.notification' - trying to recover. Cause: javax.jms.JMSException: Stopped. 2014-07-14 21:57:20,780 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped. 2014-07-14 21:57:25,781 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped. 2014-07-14 21:57:35,784 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped. 2014-07-14 21:57:40,786 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped. 2014-07-14 21:57:45,788 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: Stopped.
----Error message using the below approach in jboss 6.0 which use to work in 6.0 ----
2014-07-14 21:51:19,672 | ERROR | ActiveMQ Task-1 | FailoverTransport | sport.failover.FailoverTransport 1089 | 110 - org.apache.activemq.activemq-osgi - 5.9.0.redhat-610379 | Failed to connect to [] after: 1 attempt(s) 2014-07-14 21:51:19,673 | ERROR | ue.notification] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer 907 | 128 - org.apache.servicemix.bundles.spring-jms - 3.2.8.RELEASE_1 | Could not refresh JMS Connection for destination 'queue.notification' - retrying in 5000 ms. Cause: No uris available to connect to.
Note: If I change the brokerURL to static url, it works, but not with fabric protocol.
bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" property name="brokerURL" value="discovery:(fabric:default)" property name="userName" value="admin" property name="password" value="admin" bean
bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" property name="configuration" ref="jmsConfig"/ bean
What am I doing wrong?
Regards..