You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by tnine <to...@gmail.com> on 2007/04/30 20:24:18 UTC

Active MQ Integration with JBoss DS

Hi all,
  I'm using Active MQ 4.1.1 and JBoss 4.0.5.  I've followed the instructions
for the installation of the rar, and I'm receiving the following error.  It
can't find the jdbc connection via JNDI, do I need to tell it to connect to
port 1099 for JNDI lookup, or should it find the default JNDI tree since its
running as an mbean?  Thanks in advance for any help

[code]--- MBeans waiting for other MBeans ---
ObjectName: jboss.jca:service=RARDeployment,name='activemq-rar-4.1.1.rar'
  State: FAILED
  Reason: javax.resource.spi.ResourceAdapterInternalException: Failed to
startup an embedded broker: xbean:broker-config.xml
, due to: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'mysql-jndi' defined in cla
ss path resource [broker-config.xml]: Invocation of init method failed;
nested exception is javax.naming.NameNotFoundExcepti
on: jdbc not bound
  Depends On Me:
   
jboss.jca:service=ManagedConnectionFactory,name=activemq/QueueConnectionFactory
   
jboss.jca:service=ManagedConnectionFactory,name=activemq/TopicConnectionFactory
    activemq.queue:name=outboundQueue
[/code]

As you can see, I have configured the spring to lookup the datasource via
JNDI.  I need this configuration for failover once I get this working for a
single node.  Below is my broker config, as well as my datasource.

broker-config.xml
[code]
<beans>

  <broker useJmx="true">

	<!-- In ActiveMQ 4, you can setup destination policies. note: this xml
format may still change a bit -->
    <destinationPolicy>
      <policyMap><policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>


    <persistenceAdapter>
     <!-- <journaledJDBC journalLogFiles="5" dataDirectory="../data"/> -->
      <!-- To use a different datasource, use th following syntax : -->
      
      <journaledJDBC journalLogFiles="5" dataDirectory="../activemqdata"
dataSource="#mysql-jndi"/>
      
    </persistenceAdapter>

    <transportConnectors>
      <!-- prefixing a connector with discovery: causes the connector to be
advertiesed over rendezvous -->
      <transportConnector uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector uri="multicast://default"/>
      <!--
      <networkConnector
uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
      -->
    </networkConnectors>

  </broker>

  <bean id="mysql-jndi"
class="org.springframework.jndi.JndiObjectFactoryBean">
	<property name="jndiName" value="java:/jdbc/ActiveMQDS"/>
  </bean>

</beans>

[/code]

mysql-ds.xml
[code]
<datasources>
  <local-tx-datasource>
    <jndi-name>jdbc/ActiveMQDS</jndi-name>
   
<connection-url>jdbc:mysql://localhost/activemq?relaxAutoCommit=true</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>activemq</user-name>
    <password>mytemppassword</password>    
    <min-pool-size>20</min-pool-size>
    <max-pool-size>100</max-pool-size>    

        <!-- The time before an unused connection is destroyed -->
      <idle-timeout-minutes>5</idle-timeout-minutes>
      
      <!-- Whether to check all statements are closed when the connection is
returned to the pool,
           this is a debugging feature that should be turned off in
production -->
      <track-statements/>
      
      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
      <metadata>
         <type-mapping>MySQL</type-mapping>
      </metadata>
    </local-tx-datasource>
</datasources>
[/code]
-- 
View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DS-tf3671136s2354.html#a10258207
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Active MQ Integration with JBoss DataSource. JNDI Lookup fails

Posted by tnine <to...@gmail.com>.
I would prefer to use a JBoss DS, I've never used the basic data source for
more than integration testing, and I'm not sure of the side effects of using
it in a clustered environment with a MySQL cluster with fail over and
scalability.  It seems I have a more pressing issue, if I remove the
datasource from my config, I receive the following error.


ObjectName: jboss.jca:service=RARDeployment,name='activemq-rar-4.1.1.rar'
  State: FAILED
  Reason: javax.resource.spi.ResourceAdapterInternalException: Failed to
startup an embedded broker: xbean:broker-config.xml, due to:
java.lang.IllegalArgumentException: The configuration has no BrokerService
instance for resource: xbean:broker-config.xml


I have the following in my broker-config.xml, what am I missing, I can't
seem to find the issue.  It all seems fine accorind to the directions here
http://devzone.logicblaze.com/site/integrating-apache-activemq-with-jboss.html. 

Thanks,
Todd

[code]
<beans>

  <broker useJmx="true">

	<!-- In ActiveMQ 4, you can setup destination policies. note: this xml
format may still change a bit -->
    <destinationPolicy>
      <policyMap><policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>


    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5" dataDirectory="activemq-data"/>
      <!-- To use a different datasource, use th following syntax : -->
      <!--
      <journaledJDBC journalLogFiles="5" dataDirectory="../data"
dataSource="#postgres-ds"/>
       -->
    </persistenceAdapter>

    <transportConnectors>
      <!-- prefixing a connector with discovery: causes the connector to be
advertiesed over rendezvous -->
      <transportConnector uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector uri="multicast://default"/>
      <!--
      <networkConnector
uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
      -->
    </networkConnectors>

  </broker>


</beans>

[/code]

-- 
View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10274286
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Active MQ Integration with JBoss DataSource. JNDI Lookup fails

Posted by CobraTheSleek <ka...@yahoo.com>.
I am curious whether you were able to solve this problem? Im my case, I see
that when the RAR is deployed the jndi data source has not yet been bound.
Any tips on how I can ensure the data source is bound in JNDI before my RAR
gets deployed?



tnine wrote:
> 
> I've solved my other issues with my active MQ issue.  I haven't pointed to
> the data source in my config, only added the spring bean, and I'm still
> getting failures on the JNDI lookup.  So, does a JNDI DS lookup work or
> not with a RAR?  If so, how does it work?  I can't seem figure out what
> else I need to do.  I've also tried adding the JNDI template to bind to
> the JNDI at localhost:1099 via TCP, this doesn't work either.  I have the
> Datasource in JNDI, here's my output from the JMX console.
> 
> java: Namespace
> 
>   +- DefaultDS (class: javax.sql.DataSource)
>   +- SecurityProxyFactory (class:
> org.jboss.security.SubjectSecurityProxyFactory)
>   +- ActiveMQDS (class: javax.sql.DataSource)
> 
> 
> Here is my broker config.
> 
> [code]
> <beans>
> 
>   <broker xmlns="http://activemq.org/config/1.0" brokerName="pefcu.broker"
> useJmx="true">
> 
> 	<!-- In ActiveMQ 4, you can setup destination policies. note: this xml
> format may still change a bit -->
>     <destinationPolicy>
>       <policyMap><policyEntries>
> 
>           <policyEntry topic="FOO.>">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>       </policyEntries></policyMap>
>     </destinationPolicy>
> 
> 	<destinations>
> 		<queue physicalName="STATEMENT.INPUT" />
> 		<queue physicalName="STATEMENT.OUTPUT" />
> 	</destinations>
> 
>     <persistenceAdapter>
>       <journaledJDBC journalLogFiles="5" dataDirectory="activemq-data"/>
>       <!-- To use a different datasource, use th following syntax : -->
>       <!--
>       <journaledJDBC journalLogFiles="5" dataDirectory="../data"
> dataSource="#postgres-ds"/>
>        -->
>     </persistenceAdapter>
> 
>     <transportConnectors>
>       <!-- prefixing a connector with discovery: causes the connector to
> be advertiesed over rendezvous -->
>       <transportConnector name="pefcu.broker" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>     </transportConnectors>
> 
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector uri="multicast://default"/>
>       <!--
>       <networkConnector
> uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
>       -->
>     </networkConnectors>
> 
>   </broker>
> 
> 
>   <bean id="activemq-ds"
> class="org.springframework.jndi.JndiObjectFactoryBean">
> 	<property name="jndiName" value="java:/ActiveMQDS"/>
>   </bean>
> </beans>
> [/code]
> 
> James.Strachan wrote:
>> 
>> If you're using Spring to configure the data source, why not just drop
>> JNDI altogether & use Spring?
>> 
>> On 5/1/07, tnine <to...@gmail.com> wrote:
>>>
>>> Just an Update.  I've also tried the following for the JNDI connection.
>>> Whenever I view the jmx-console, my data source has connected and
>>> started
>>> successfully, any help would be greatly appreciated.  I'm thoroughly
>>> stumped
>>> on this one, my knowledge of deploying RARs is minimal.
>>>
>>> new config snippit
>>> [code]
>>> <bean id="mysql-jndi"
>>> class="org.springframework.jndi.JndiObjectFactoryBean">
>>>         <property name="jndiName" value="jdbc/ActiveMQDS"/>
>>>         <property name="jndiTemplate" ref="jndiTemplate"/>
>>>         <property name="cache" value="false"/>
>>>         <property name="proxyInterface" value="javax.sql.DataSource"/>
>>>   </bean>
>>>
>>>         <bean id="jndiTemplate"
>>> class="org.springframework.jndi.JndiTemplate">
>>>                 <property name="environment">
>>>                         <props>
>>>                                 <prop
>>> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
>>>                                 <prop
>>> key="java.naming.provider.url">jnp://localhost:1099</prop>
>>>                                 <prop
>>> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>>>                         </props>
>>>                 </property>
>>>         </bean>
>>> [/code]
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10271819
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a13777892
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Active MQ Integration with JBoss DataSource. JNDI Lookup fails

Posted by tnine <to...@gmail.com>.
I've solved my other issues with my active MQ issue.  I haven't pointed to
the data source in my config, only added the spring bean, and I'm still
getting failures on the JNDI lookup.  So, does a JNDI DS lookup work or not
with a RAR?  If so, how does it work?  I can't seem figure out what else I
need to do.  I've also tried adding the JNDI template to bind to the JNDI at
localhost:1099 via TCP, this doesn't work either.  Here is my broker config.

[code]
<beans>

  <broker xmlns="http://activemq.org/config/1.0" brokerName="pefcu.broker"
useJmx="true">

	<!-- In ActiveMQ 4, you can setup destination policies. note: this xml
format may still change a bit -->
    <destinationPolicy>
      <policyMap><policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>

	<destinations>
		<queue physicalName="STATEMENT.INPUT" />
		<queue physicalName="STATEMENT.OUTPUT" />
	</destinations>

    <persistenceAdapter>
      <journaledJDBC journalLogFiles="5" dataDirectory="activemq-data"/>
      <!-- To use a different datasource, use th following syntax : -->
      <!--
      <journaledJDBC journalLogFiles="5" dataDirectory="../data"
dataSource="#postgres-ds"/>
       -->
    </persistenceAdapter>

    <transportConnectors>
      <!-- prefixing a connector with discovery: causes the connector to be
advertiesed over rendezvous -->
      <transportConnector name="pefcu.broker" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector uri="multicast://default"/>
      <!--
      <networkConnector
uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
      -->
    </networkConnectors>

  </broker>


  <bean id="activemq-ds"
class="org.springframework.jndi.JndiObjectFactoryBean">
	<property name="jndiName" value="ActiveMQDS"/>
  </bean>
</beans>
[/code]

James.Strachan wrote:
> 
> If you're using Spring to configure the data source, why not just drop
> JNDI altogether & use Spring?
> 
> On 5/1/07, tnine <to...@gmail.com> wrote:
>>
>> Just an Update.  I've also tried the following for the JNDI connection.
>> Whenever I view the jmx-console, my data source has connected and started
>> successfully, any help would be greatly appreciated.  I'm thoroughly
>> stumped
>> on this one, my knowledge of deploying RARs is minimal.
>>
>> new config snippit
>> [code]
>> <bean id="mysql-jndi"
>> class="org.springframework.jndi.JndiObjectFactoryBean">
>>         <property name="jndiName" value="jdbc/ActiveMQDS"/>
>>         <property name="jndiTemplate" ref="jndiTemplate"/>
>>         <property name="cache" value="false"/>
>>         <property name="proxyInterface" value="javax.sql.DataSource"/>
>>   </bean>
>>
>>         <bean id="jndiTemplate"
>> class="org.springframework.jndi.JndiTemplate">
>>                 <property name="environment">
>>                         <props>
>>                                 <prop
>> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
>>                                 <prop
>> key="java.naming.provider.url">jnp://localhost:1099</prop>
>>                                 <prop
>> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>>                         </props>
>>                 </property>
>>         </bean>
>> [/code]
>> --
>> View this message in context:
>> http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10271819
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10294077
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Active MQ Integration with JBoss DataSource. JNDI Lookup fails

Posted by James Strachan <ja...@gmail.com>.
If you're using Spring to configure the data source, why not just drop
JNDI altogether & use Spring?

On 5/1/07, tnine <to...@gmail.com> wrote:
>
> Just an Update.  I've also tried the following for the JNDI connection.
> Whenever I view the jmx-console, my data source has connected and started
> successfully, any help would be greatly appreciated.  I'm thoroughly stumped
> on this one, my knowledge of deploying RARs is minimal.
>
> new config snippit
> [code]
> <bean id="mysql-jndi"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>         <property name="jndiName" value="jdbc/ActiveMQDS"/>
>         <property name="jndiTemplate" ref="jndiTemplate"/>
>         <property name="cache" value="false"/>
>         <property name="proxyInterface" value="javax.sql.DataSource"/>
>   </bean>
>
>         <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
>                 <property name="environment">
>                         <props>
>                                 <prop
> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
>                                 <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
>                                 <prop
> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>                         </props>
>                 </property>
>         </bean>
> [/code]
> --
> View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10271819
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Re: Active MQ Integration with JBoss DataSource. JNDI Lookup fails

Posted by tnine <to...@gmail.com>.
Just an Update.  I've also tried the following for the JNDI connection. 
Whenever I view the jmx-console, my data source has connected and started
successfully, any help would be greatly appreciated.  I'm thoroughly stumped
on this one, my knowledge of deploying RARs is minimal.

new config snippit
[code]
<bean id="mysql-jndi"
class="org.springframework.jndi.JndiObjectFactoryBean">
	<property name="jndiName" value="jdbc/ActiveMQDS"/>
	<property name="jndiTemplate" ref="jndiTemplate"/>
	<property name="cache" value="false"/>
	<property name="proxyInterface" value="javax.sql.DataSource"/>
  </bean>

	<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
		<property name="environment">
			<props>
				<prop
key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
				<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
				<prop
key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
			</props>
		</property>
	</bean>
[/code]
-- 
View this message in context: http://www.nabble.com/Active-MQ-Integration-with-JBoss-DataSource.--JNDI-Lookup-fails-tf3671136s2354.html#a10271819
Sent from the ActiveMQ - User mailing list archive at Nabble.com.