If you just want to access ActiveMQ using JNDI, you
don't want to use the spring factory, else you will create
your own JNDI tree.

Anyway, this should work too, provided that you point
to the jndi.xml file using the provider url.  You can just use
jndi.xml  and put it in the jmeter classpath.

On 11/13/06, AntonioPE <[EMAIL PROTECTED]> wrote:

As far as I know, the ServiceMix JNDI context is defined in the jndi.xml
file:

<bean id="jndi"
class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
factory-method="makeInitialContext" singleton="true">

That's why I'm using the class
"org.apache.xbean.spring.jndi.SpringInitialContextFactory" in my
jndi.properties. I assume that in that bean is registered my
connectionFactory (I put that specific entry in the bean). In the ServiceMix
default configuration files, there's no relation with the factory
org.apache.activemq.jndi.ActiveMQInitialContextFactory (The file
activemq.xml is only defining the broker, but there's no relation to any
jndi context in that file).

Then, if I change the jndi.properties, then I suppose I should change the
definition of the bean "jndi" to something like...

<bean id="jndi"
class="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
factory-method="makeInitialContext" singleton="true">

Because than bean is the servicemix's jndi context, but are you sure it will
work ?



gnodet wrote:
>
> See http://www.activemq.org/site/jndi-support.html
>
> You should try with
> java.naming.factory.initial =
> org.apache.activemq.jndi.ActiveMQInitialContextFactory
>  java.naming.provider.url = tcp://hostname:61616
>
>
> On 11/10/06, AntonioPE <[EMAIL PROTECTED]> wrote:
>>
>> Here's my configuration:
>>
>> jndi.properties:
>>
>> 
java.naming.factory.initial=org.apache.xbean.spring.jndi.SpringInitialContextFactory
>> java.naming.provider.url=jndi.xml
>>
>> jndi.xml:
>>
>>   ...
>>
>>   <!--  lets create an ActiveMQ Broker -->
>>   <amq:broker id="broker" useJmx="true" persistent="false">
>>     <amq:transportConnectors>
>>       <amq:transportConnector uri="tcp://localhost:61616" />
>>     </amq:transportConnectors>
>>   </amq:broker>
>>
>>
>>   <!-- Create the connection factory -->
>>   <bean id="jmsFactory"
>> class="org.apache.activemq.pool.PooledConnectionFactory"
>> depends-on="broker">
>>         <property name="connectionFactory">
>>                 <bean
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>                         <property name="brokerURL"
>> value="tcp://localhost:61616" />
>>                 </bean>
>>         </property>
>>   </bean>
>>
>>
>>   <bean id="jndi"
>> class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
>>         factory-method="makeInitialContext"
>>         singleton="true">
>>     <property name="entries">
>>       <map>
>>
>>         ...
>>         ...
>>
>>         <entry key="connectionFactory" value-ref="jmsFactory" />
>>
>>       </map>
>>     </property>
>>   </bean>
>>
>>   ...
>>
>> With this configuration I understand the JMS connectionFactory is
>> available
>> in the JNDI context...
>>
>> This is my JMS endpoint in servicemix.xml:
>>
>>     <sm:activationSpec componentName="MyConsumerJMS"
>> service="foo:MyConsumerJMS"
>>           destinationService="foo:myTransformerjms">
>>           <sm:component>
>>                 <jms:component>
>>                         <jms:endpoints>
>>                                 <jms:endpoint
>>                                         service="foo:MyConsumerJMS"
>>                                         endpoint="MyConsumerJMS"
>>
>> targetService="foo:myTransformerjms"
>>                                         targetEndpoint="myTransformerjms"
>>                                         role="consumer"
>>
>> defaultMep="http://www.w3.org/2004/08/wsdl/in-only";
>>                                         destinationStyle="queue"
>>
>> jmsProviderDestinationName="demo.org.servicemix.source"
>>
>> jndiConnectionFactoryName="connectionFactory" >
>>                                 </jms:endpoint>
>>                         </jms:endpoints>
>>                 </jms:component>
>>       </sm:component>
>>     </sm:activationSpec>
>>
>> Now, here it is the configuration in JMeter to make a "JMS queue-to-queue
>> sampler":
>>
>> - QueueConnection Factory: connectionFactory
>> - JNDI name Request queue: demo.org.servicemix.source
>> - JNDI name Receive queue:
>> - Communication style: Request only
>> - Content: <test id="antonio"/>
>> - Initial Context Factory:
>> org.apache.xbean.spring.jndi.SpringInitialContextFactory
>> - Provider URL: tcp://localhost:61616
>>
>> When I execute the test I got this exception:
>>
>> 2006/11/10 12:49:34 INFO  -
>> org.apache.xbean.spring.jndi.SpringInitialContextFactory: Loading JNDI
>> context from: class path resource [tcp://localhost:61616]
>> 2006/11/10 12:49:34 INFO  -
>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader: Loading
>> XML
>> bean definitions from class path resource [tcp://localhost:61616]
>> 2006/11/10 12:49:34 ERROR - jmeter.threads.JMeterThread: Test failed!
>> org.springframework.beans.factory.BeanDefinitionStoreException:
>> IOException
>> parsing XML document from class path resource [tcp://localhost:61616];
>> nested exception is java.io.FileNotFoundException: class path resource
>> [tcp://localhost:61616] cannot be opened because it does not exist
>> Caused by: java.io.FileNotFoundException: class path resource
>> [tcp://localhost:61616] cannot be opened because it does not exist
>>         at
>> 
org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:137)
>>         at
>> 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:354)
>>         at
>> 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
>>         at
>> 
org.apache.xbean.spring.context.impl.XBeanXmlBeanFactory.<init>(XBeanXmlBeanFactory.java:73)
>>         at
>> 
org.apache.xbean.spring.context.impl.XBeanXmlBeanFactory.<init>(XBeanXmlBeanFactory.java:37)
>>         at
>> 
org.apache.xbean.spring.jndi.SpringInitialContextFactory.createContext(SpringInitialContextFactory.java:104)
>>         at
>> 
org.apache.xbean.spring.jndi.SpringInitialContextFactory.loadContext(SpringInitialContextFactory.java:95)
>>         at
>> 
org.apache.xbean.spring.jndi.SpringInitialContextFactory.getInitialContext(SpringInitialContextFactory.java:82)
>>         at javax.naming.spi.NamingManager.getInitialContext(Unknown
>> Source)
>>         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
>>         at javax.naming.InitialContext.init(Unknown Source)
>>         at javax.naming.InitialContext.<init>(Unknown Source)
>>         at
>> 
org.apache.jmeter.protocol.jms.sampler.JMSSampler.getInitialContext(JMSSampler.java:351)
>>         at
>> 
org.apache.jmeter.protocol.jms.sampler.JMSSampler.threadStarted(JMSSampler.java:265)
>>         at
>> 
org.apache.jmeter.threads.JMeterThread$Traverser.addNode(JMeterThread.java:375)
>>         at
>> org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:972)
>>         at
>> org.apache.jorphan.collections.HashTree.traverse(HashTree.java:956)
>>         at
>> org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:347)
>>         at
>> org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:339)
>>         at
>> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:230)
>>         at java.lang.Thread.run(Unknown Source)
>>
>> Any suggestion???
>>
>> Thanks in advance!!
>>
>> --
>> View this message in context:
>> 
http://www.nabble.com/Problems-accesing-servicemix-jms-queue-from-JMeter-tf2607245s12049.html#a7275587
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>

--
View this message in context: 
http://www.nabble.com/Problems-accesing-servicemix-jms-queue-from-JMeter-tf2607245s12049.html#a7320883
Sent from the ServiceMix - User mailing list archive at Nabble.com.




--
Cheers,
Guillaume Nodet

Reply via email to