geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Accessing JMS resources from application client
Date Thu, 23 Mar 2006 23:27:39 GMT

On Mar 23, 2006, at 1:52 PM, Marsha Johnson wrote:

> HI,
>
> I am using IBM Websphere Application Server Community Edition and I  
> am trying
> to create a client application that will consume messages from a  
> queue created
> from a deployment plan external to the application.  Both the queue  
> and
> connection factory have been successfully deployed from the  
> following plan:
>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.0"
> configId="org/apache/geronimo/OPJmsPlan"
> parentId="geronimo/activemq/1.0/car">
> <resourceadapter>
> <resourceadapter-instance>
> <resourceadapter-name>OP JMS RA</resourceadapter-name>
> <config-property-setting name="ServerUrl">tcp://0.0.0.0:61616</ 
> config-property-
> setting>
> <config-property-setting name="UserName">geronimo</config-property- 
> setting>
> <config-property-setting name="Password">geronimo</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/OPConnFactory1</name>
> <implemented-interface>javax.jms.QueueConnectionFactory</ 
> implemented-interface>
> <connectionmanager>
> <xa-transaction>
> <transaction-caching/>
> </xa-transaction>
> <single-pool>
> <max-size>10</max-size>
> <blocking-timeout-milliseconds>60000</blocking-timeout-milliseconds>
> <match-one/>
> </single-pool>
> </connectionmanager>
> </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/OPQueue</message-destination-name>
>    <config-property-setting name="PhysicalName">OPQueuePD</config- 
> property-
> setting>
>  </adminobject-instance>
> </adminobject>
> </connector>
>
>
> My application-client.xml deployment plan has the following code:
>
> <resource-ref>
>  <res-ref-name>jms/OPConnFactory1</res-ref-name>
>  <res-type>javax.jms.QueueConnectionFactory</res-type>
>  <res-auth>Container</res-auth>
>  <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
> <message-destination-ref>
>  <message-destination-ref-name>jms/OPQueue</message-destination-ref- 
> name>
>  <message-destination-type>javax.jms.Queue</message-destination-type>
>  <message-destination-usage>Consumes</message-destination-usage>
>  <message-destination-link>jms/OPQueue</message-destination-link>
> </message-destination-ref>
>
> <message-destination>
>  <message-destination-name>jms/OPQueue</message-destination-name>
> </message-destination>
>
> My geronimo-application-client.xml deployment plan has the  
> following code:
>
> <naming:resource-ref>
>   <naming:ref-name>jms/OPConnFactory1</naming:ref-name>
>   <naming:resource-link>jms/OPConnFactory1</naming:resource-link>
> </naming:resource-ref>
>
> However, when I try to deploy I get the following message:
> Error: Unable to distribute OPConsumer.ear: Unable to resolve
> resource reference 'jms/OPConnFactory1' (no matching resources
> found)
>
>
> What am I doing wrong?

You need to deploy the jms connection factory and admin object you  
need to use on the app-client if the app client is going to use  
them.  (Presumably the server app uses them too, so they need to be  
where you already have them as well).  Here's an example of the  
syntax, extracted from the daytrader application that comes with  
geronimo:

     <module>
         <java>daytrader-streamer-${daytrader_version}.jar</java>
         <application-client  xmlns="http://geronimo.apache.org/xml/ 
ns/j2ee/application-client-1.0"
             configId="foo"
             clientConfigId="${pom.groupId}/${pom.artifactId}- 
streamer-client/${daytrader_version}/car">
             <resource>
                 <external-rar>activemq/activemq-ra/$ 
{activemq_version}/rar</external-rar>
                 <connector xmlns="http://geronimo.apache.org/xml/ns/ 
j2ee/connector"
            configId="org/apache/geronimo/SystemJMS"
            parentId="org/apache/geronimo/ActiveMQServer">
                     <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">geronimo</config-property-setting>
                             <config-property-setting  
name="Password">geronimo</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/ 
TopicConnectionFactory</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>
                                 </connectiondefinition-instance>
                             </connection-definition>
                         </outbound-resourceadapter>
                     </resourceadapter>



                     <adminobject>
                         <adminobject-interface>javax.jms.Topic</ 
adminobject-interface>
                         <adminobject- 
class>org.codehaus.activemq.message.ActiveMQTopic</adminobject-class>
                         <adminobject-instance>
                             <message-destination- 
name>TradeStreamerTopic</message-destination-name>
                             <config-property-setting  
name="PhysicalName">TradeStreamerTopic</config-property-setting>
                         </adminobject-instance>
                     </adminobject>

                 </connector>
             </resource>
         </application-client>
     </module>


Unless you are using our packaging plugin to deploy your app you  
should be sure to eliminate any ${something_version} tags and replace  
them with the appropriate values.

thanks
david jencks

>
>


Mime
View raw message