You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by James Strachan <ja...@gmail.com> on 2007/05/01 18:29:53 UTC

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

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>.
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.