Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3430

User name/password missing in connection factory created with jms:create

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.1, 2.4.1, 2.3.9, 4.0.0.M1
    • 3.0.3, 2.3.10, 2.4.2, 4.0.0.M2, 4.0.0.M3
    • None
    • None

    Description

      I have installed ActiveMQ (5.10.0) and Camel (2.14.1) in Karaf. Next I have created a connection factory using jms:create command

      jms:create -t ActiveMQ -u tcp://localhost:61616 amqcf
      

      The jms:* commands work perfectly.

      Next I have created following blueprint camel route

      <reference id="connectionFactory" interface="javax.jms.ConnectionFactory" />
      <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
          <property name="connectionFactory" ref="connectionFactory" />
      </bean>
      
      <camelContext xmlns="http://camel.apache.org/schema/blueprint">
          <route>
              <from uri="timer://myTimer?fixedRate=true&amp;period=2000" />
              <to uri="activemq:queue:LOG.ME" />
          </route>
          <route>
              <from uri="activemq:queue:LOG.ME" />
              <to uri="log:ExampleActiveMQRouterBlueprint" />
          </route>
      </camelContext>
      

      This blueprint references the connection factory created by jms:create. Deploying this route into deploy directory ends with following errors in log (full stack trace in attachment)

      Caused by: javax.security.auth.login.LoginException: Username can not be null
      	at org.apache.karaf.jaas.modules.properties.PropertiesLoginModule.login(PropertiesLoginModule.java:90)[16:org.apache.karaf.jaas.modules:2.4.1]
      	at org.apache.karaf.jaas.boot.ProxyLoginModule.login(ProxyLoginModule.java:83)[karaf-jaas-boot.jar:]
      	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_65]
      	at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext.invoke(LoginContext.java:762)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688)[:1.7.0_65]
      	at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687)[:1.7.0_65]
      	at javax.security.auth.login.LoginContext.login(LoginContext.java:595)[:1.7.0_65]
      	at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:73)[85:org.apache.activemq.activemq-osgi:5.10.0]
      	... 13 more
      
      

      Adding userName and password parameter in the definition of the connection factory solves the problem.

      <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
              <property name="brokerURL" value="tcp://localhost:61616" />
              <property name="userName" value="karaf"/>
      	<property name="password" value="karaf"/>
      </bean>
      

      Attachments

        1. test-route.xml
          1.0 kB
          Krzysztof Sobkowiak
        2. karaf.log
          99 kB
          Krzysztof Sobkowiak

        Activity

          People

            jbonofre Jean-Baptiste Onofré
            sobkowiak Krzysztof Sobkowiak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: