geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Römer <torsten.roe...@luniks.net>
Subject Re: Connect to JMS Queue from Servlet
Date Sun, 02 Oct 2005 10:28:02 GMT
Oh, well...

I forgot the declarations in web.xml:

<resource-ref>
   <res-ref-name>jms/ConnectionFactory</res-ref-name>
   <res-type>javax.jms.ConnectionFactory</res-type>
   <res-auth>Container</res-auth>
</resource-ref>
	
<resource-env-ref>
   <resource-env-ref-name>jms/testQueue</resource-env-ref-name>
   <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>

Now of course it works just fine!

Just wondering: When I set up a JDBC datasource in a Tomcat webapp 
context, I can look it up without any declarations in web.xml, can 
somebody explain me why?

Torsten

Torsten schrieb:
> Hello,
> 
> I am trying to connect to a JMS queue from a method that I call from a 
> servlet in a simple webapp.
> 
> Both the queue and the webapp seems to have been deployed correctly and 
> the webapp works so far, but when trying to look up the 
> ConnectionFactory I get a javax.naming.NameNotFoundException.
> 
> Below I'll paste my resource adapter XML and the relevant code, could 
> somebody please tell me what I am doing wrong?
> 
> Thanks in advance,
> Torsten
> 
> 
> 
> Context init = new InitialContext();
> // Lookup below seems to succeed but...
> ctx = (Context)init.lookup("java:comp/env");
> // but this one fails: NameNotFoundException: jms/ConnectionFactory
> factory = (QueueConnectionFactory)ctx.lookup("jms/ConnectionFactory");
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"
>     version="1.5"
>     configId="test/Queues"
>     parentId="org/apache/geronimo/SystemJMS">
>     <resourceadapter>
>         <resourceadapter-instance>
>             <resourceadapter-name>ActiveMQ RA</resourceadapter-name>
>             <config-property-setting 
> name="ServerUrl">tcp://localhost:61616</config-property-setting>
>             <!-- config-property-setting 
> name="UserName">user</config-property-setting -->
>             <!-- config-property-setting 
> name="Password">pass</config-property-setting -->
>             <workmanager>
>                 <gbean-link>DefaultWorkManager</gbean-link>
>             </workmanager>
>         </resourceadapter-instance>
>         <outbound-resourceadapter>
>             <connection-definition>
> 
> <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>

> 
>                 <connectiondefinition-instance>
>                     <name>jms/ConnectionFactory</name>
> 
> <implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>

> 
> 
> <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>

> 
>                     <connectionmanager>
>                         <xa-transaction>
>                             <transaction-caching/>
>                         </xa-transaction>
>                         <single-pool>
>                             <max-size>10</max-size>
> 
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>                             <match-one/>
>                         </single-pool>
>                     </connectionmanager>
> 
> <global-jndi-name>jms/ConnectionFactory</global-jndi-name>
>                     <!--
> <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>

> 
> -->
>                 </connectiondefinition-instance>
>             </connection-definition>
>         </outbound-resourceadapter>
>     </resourceadapter>
>     <adminobject>
>         <adminobject-interface>javax.jms.Queue</adminobject-interface>
> 
> <adminobject-class>org.codehaus.activemq.message.ActiveMQQueue</adminobject-class>

> 
>         <adminobject-instance>
> 
> <message-destination-name>jms/testQueue</message-destination-name>
>             <config-property-setting
> name="PhysicalName">jms/testQueue</config-property-setting>
>         </adminobject-instance>
>     </adminobject>
> 
> </connector>
> 

Mime
View raw message