You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Stella Lok <oi...@gmail.com> on 2008/07/22 11:47:51 UTC

Accessing JMS Resources From J2EE Application Client

Hi,

I am trying to access a server-scoped JMS TopicConnectionFactory and Topic
on Geronimo 2.02, from a J2EE Application Client, but am encountering
problems. Here are the steps I took:

1) Deployed JMS TopicConnectionFactory & Topic in Resource Adapter:

<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
    <dep:environment xmlns:dep="
http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
            <dep:groupId>console.jms</dep:groupId>
            <dep:artifactId>topic</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>org.apache.geronimo.configs</dep:groupId>
                <dep:artifactId>activemq-broker</dep:artifactId>
                <dep:type>car</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <resourceadapter-instance>

<resourceadapter-name>eventTopicResourceAdapter</resourceadapter-name>
        <config-property-setting
        name="ServerUrl">tcp://localhost:61616</config-property-setting>
        <config-property-setting
name="UserName">system</config-property-setting> <config-property-setting
     name="Password">manager</config-property-setting>
            <nam:workmanager xmlns:nam="
http://geronimo.apache.org/xml/ns/naming-1.2">
                <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
            </nam:workmanager>
        </resourceadapter-instance>
        <outbound-resourceadapter>
            <connection-definition>

<connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>jms/topicConnectionFactory</name>
                    <connectionmanager>
                        <xa-transaction>
                            <transaction-caching/>
                        </xa-transaction>
                        <single-pool>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
    <adminobject>
        <adminobject-interface>javax.jms.Queue</adminobject-interface>

<adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
    </adminobject>
    <adminobject>
        <adminobject-interface>javax.jms.Topic</adminobject-interface>

<adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
        <adminobject-instance>
            <message-destination-name>topic</message-destination-name>
            <config-property-setting
name="PhysicalName">topic</config-property-setting>
        </adminobject-instance>
    </adminobject>
</connector>

2) I created a dummy J2EE application client with the following deployment
descriptors:
*application.xml*:

<?xml version="1.0" encoding="UTF-8"?>
<application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
    <resource-ref>
        <res-ref-name>jms/topicConnectionFactory</res-ref-name>
        <res-type>javax.jms.TopicConnectionFactory</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <message-destination-ref>
        <message-destination-ref-name>topic</message-destination-ref-name>
        <message-destination-type>javax.jms.Topic</message-destination-type>
        <message-destination-usage>Consumes</message-destination-usage>
        <message-destination-link>topic</message-destination-link>
    </message-destination-ref>
    <message-destination>
        <message-destination-name>topic</message-destination-name>
    </message-destination>
</application-client>

and *geronimo-application-client.xml:*
<?xml version="1.0" encoding="UTF-8"?>

<application-client xmlns="
http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
  xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
  xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
  xmlns:security="http://geronimo.apache.org/xml/ns/security-2.0"
  xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">

  <dep:client-environment>
    <dep:moduleId>
      <dep:groupId>client</dep:groupId>
      <dep:artifactId>jmsClient</dep:artifactId>
      <dep:version>1</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:dependencies/>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:client-environment>
  <dep:server-environment>
    <dep:moduleId>
      <dep:groupId>console.jms</dep:groupId>
      <dep:artifactId>topic</dep:artifactId>
      <dep:version>1.0</dep:version>
      <dep:type>rar</dep:type>
    </dep:moduleId>
    <dep:dependencies/>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:server-environment>
  <resource-ref>
   <ref-name>jms/topicConnectionFactory</ref-name>
    <resource-link>jms/topicConnectionFactory</resource-link>
  </resource-ref>
  <message-destination>
    <message-destination-name>topic</message-destination-name>
    <admin-object-link>topic</admin-object-link>
  </message-destination>
  <resource>
        <external-rar>
              <dep:groupId>org.apache.geronimo.configs</dep:groupId>
              <dep:artifactId>activemq-broker</dep:artifactId>
              <dep:version>2.0.2</dep:version>
              <dep:type>car</dep:type>
        </external-rar>

        <connector xmlns="
http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
        <resourceadapter>
            <resourceadapter-instance>
                <resourceadapter-name>ActiveMQ RA</resourceadapter-name>
                <config-property-setting name="ServerUrl">tcp://
172.168.29.227:61616</config-property-setting>
                <config-property-setting
name="UserName">system</config-property-setting>
                <config-property-setting
name="Password">manager</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.apache.activemq.command.ActiveMQTopic</adminobject-class>

    <adminobject-instance>
        <message-destination-name>bacmTopic</message-destination-name>
        <config-property-setting
name="PhysicalName">bacmTopic</config-property-setting>
        </adminobject-instance>
</adminobject>

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


Bascially, what I'm trying to do is deploy the TopicConnectionFactory and
Topic on the server, and use my application client to look them up.

However, when I try to deploy the application client, I get this error:
"Error: Unable to distribute MyAppClient.jar: Could not access external rar
contents for artifact: org.apache.geronimo.configs/activemq-broker/2.0.2/car
Access is denied"

I'm not even sure if I'm doing the right thing by trying to deploy the
activemq resource adapter on the client container as well (I picked up that
tip online). If anyone could help me figure out how to let my application
client access the JMS resources, please let me know!

Thanks a lot,
Stella

Re: Accessing JMS Resources From J2EE Application Client

Posted by Stella Lok <oi...@gmail.com>.
Hi,

I have solved the external-rar problem by configuring it as follows:
<external-rar>
              <dep:groupId>org.apache.geronimo.modules</dep:groupId>
              <dep:artifactId>geronimo-activemq-ra</dep:artifactId>
              <dep:version>2.0.2</dep:version>
              <dep:type>rar</dep:type>
 </external-rar>

However, now I get this error:
Error: Unable to distribute MyAppClient.jar: Can not load activation
    spec class
        org.apache.activemq.ra.ActiveMQActivationSpec in classloader
    console.jms/topic/1.0/rar

When I check the repository folder, a console.jms/topic/1.0/rar folder was
created upon deploying the app client, but it's empty. How can I solve this
problem?  console.jms/topic/1.0/rar is the server-side resource adapter in
which I created my JMS resources.

Thanks for your help

Yours Sincerely,
Stella

On Wed, Jul 23, 2008 at 4:43 PM, Stella Lok <oi...@gmail.com>
wrote:

> Hi,
>
> Thanks so much for letting me know I'm on the right track. How may I find
> the activemq rar file in the geronimo repository?
>
> I have tried pointing the external-rar to:
>      <external-rar>
>               <dep:groupId>org.apache.activemq</dep:groupId>
>               <dep:artifactId>activemq-core</dep:artifactId>
>               <dep:version>4.1.1</dep:version>
>               <dep:type>jar</dep:type>
>         </external-rar>
> but I get a null pointer exception in deploying. I'm wondering whether it
> is valid to point to that file as it is not a resource adapter or a module,
> but just a jar file residing in
> repository/org/apache/activemq/activemq-core/4.1.1/activemq-core-4.1.1.jar ?
> I cannot find any other activemq file in the repository folder. I also
> couldn't find an example in the 2.0.2 daytrader application. There is a
> reference in the older samples, but it is based on an older schema where
> external-rar is of type string.
>
> Any help would be much appreciated
>
> Sincerely,
> Stella
>
>
> On Wed, Jul 23, 2008 at 1:29 AM, David Jencks <da...@yahoo.com>
> wrote:
>
>> You are correct that you need to deploy the resource adapter on the app
>> client as well as the server.  I think the problem is that your external-rar
>> tag is pointing to the server's broker configuration rather than the
>> actibvemq rar file in the geronimo repository.
>> I think there's correct configuration in one of the daytrader app clients.
>>
>> This would make a great subject for a wiki page (I haven't searched much,
>> maybe there already is one?)
>>
>> thanks
>> david jencks
>>
>> On Jul 22, 2008, at 2:47 AM, Stella Lok wrote:
>>
>> Hi,
>>
>> I am trying to access a server-scoped JMS TopicConnectionFactory and Topic
>> on Geronimo 2.02, from a J2EE Application Client, but am encountering
>> problems. Here are the steps I took:
>>
>> 1) Deployed JMS TopicConnectionFactory & Topic in Resource Adapter:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>>     <dep:environment xmlns:dep="
>> http://geronimo.apache.org/xml/ns/deployment-1.2">
>>         <dep:moduleId>
>>             <dep:groupId>console.jms</dep:groupId>
>>             <dep:artifactId>topic</dep:artifactId>
>>             <dep:version>1.0</dep:version>
>>             <dep:type>rar</dep:type>
>>         </dep:moduleId>
>>         <dep:dependencies>
>>             <dep:dependency>
>>                 <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>>                 <dep:artifactId>activemq-broker</dep:artifactId>
>>                 <dep:type>car</dep:type>
>>             </dep:dependency>
>>         </dep:dependencies>
>>     </dep:environment>
>>     <resourceadapter>
>>         <resourceadapter-instance>
>>
>> <resourceadapter-name>eventTopicResourceAdapter</resourceadapter-name>
>>         <config-property-setting
>>         name="ServerUrl">tcp://localhost:61616</config-property-setting>
>>         <config-property-setting
>> name="UserName">system</config-property-setting> <config-property-setting
>>      name="Password">manager</config-property-setting>
>>             <nam:workmanager xmlns:nam="
>> http://geronimo.apache.org/xml/ns/naming-1.2">
>>                 <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
>>             </nam:workmanager>
>>         </resourceadapter-instance>
>>         <outbound-resourceadapter>
>>             <connection-definition>
>>
>> <connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
>>                 <connectiondefinition-instance>
>>                     <name>jms/topicConnectionFactory</name>
>>                     <connectionmanager>
>>                         <xa-transaction>
>>                             <transaction-caching/>
>>                         </xa-transaction>
>>                         <single-pool>
>>                             <match-one/>
>>                         </single-pool>
>>                     </connectionmanager>
>>                 </connectiondefinition-instance>
>>             </connection-definition>
>>         </outbound-resourceadapter>
>>     </resourceadapter>
>>     <adminobject>
>>         <adminobject-interface>javax.jms.Queue</adminobject-interface>
>>
>> <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
>>     </adminobject>
>>     <adminobject>
>>         <adminobject-interface>javax.jms.Topic</adminobject-interface>
>>
>> <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
>>         <adminobject-instance>
>>             <message-destination-name>topic</message-destination-name>
>>             <config-property-setting
>> name="PhysicalName">topic</config-property-setting>
>>         </adminobject-instance>
>>     </adminobject>
>> </connector>
>>
>> 2) I created a dummy J2EE application client with the following deployment
>> descriptors:
>> *application.xml*:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
>>     <resource-ref>
>>         <res-ref-name>jms/topicConnectionFactory</res-ref-name>
>>         <res-type>javax.jms.TopicConnectionFactory</res-type>
>>         <res-auth>Container</res-auth>
>>         <res-sharing-scope>Shareable</res-sharing-scope>
>>     </resource-ref>
>>     <message-destination-ref>
>>         <message-destination-ref-name>topic</message-destination-ref-name>
>>
>> <message-destination-type>javax.jms.Topic</message-destination-type>
>>         <message-destination-usage>Consumes</message-destination-usage>
>>         <message-destination-link>topic</message-destination-link>
>>     </message-destination-ref>
>>     <message-destination>
>>         <message-destination-name>topic</message-destination-name>
>>     </message-destination>
>> </application-client>
>>
>> and *geronimo-application-client.xml:*
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <application-client xmlns="
>> http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
>>   xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
>>   xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
>>   xmlns:security="http://geronimo.apache.org/xml/ns/security-2.0"
>>   xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>>
>>   <dep:client-environment>
>>     <dep:moduleId>
>>       <dep:groupId>client</dep:groupId>
>>       <dep:artifactId>jmsClient</dep:artifactId>
>>       <dep:version>1</dep:version>
>>       <dep:type>car</dep:type>
>>     </dep:moduleId>
>>     <dep:dependencies/>
>>     <dep:hidden-classes/>
>>     <dep:non-overridable-classes/>
>>   </dep:client-environment>
>>   <dep:server-environment>
>>     <dep:moduleId>
>>       <dep:groupId>console.jms</dep:groupId>
>>       <dep:artifactId>topic</dep:artifactId>
>>       <dep:version>1.0</dep:version>
>>       <dep:type>rar</dep:type>
>>     </dep:moduleId>
>>     <dep:dependencies/>
>>     <dep:hidden-classes/>
>>     <dep:non-overridable-classes/>
>>   </dep:server-environment>
>>   <resource-ref>
>>    <ref-name>jms/topicConnectionFactory</ref-name>
>>     <resource-link>jms/topicConnectionFactory</resource-link>
>>   </resource-ref>
>>   <message-destination>
>>     <message-destination-name>topic</message-destination-name>
>>     <admin-object-link>topic</admin-object-link>
>>   </message-destination>
>>   <resource>
>>         <external-rar>
>>               <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>>               <dep:artifactId>activemq-broker</dep:artifactId>
>>               <dep:version>2.0.2</dep:version>
>>               <dep:type>car</dep:type>
>>         </external-rar>
>>
>>         <connector xmlns="
>> http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>>         <resourceadapter>
>>             <resourceadapter-instance>
>>                 <resourceadapter-name>ActiveMQ RA</resourceadapter-name>
>>                 <config-property-setting name="ServerUrl">tcp://
>> 172.168.29.227:61616</config-property-setting>
>>                 <config-property-setting
>> name="UserName">system</config-property-setting>
>>                 <config-property-setting
>> name="Password">manager</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.apache.activemq.command.ActiveMQTopic</adminobject-class>
>>
>>     <adminobject-instance>
>>         <message-destination-name>bacmTopic</message-destination-name>
>>         <config-property-setting
>> name="PhysicalName">bacmTopic</config-property-setting>
>>         </adminobject-instance>
>> </adminobject>
>>
>> </connector> </resource>
>> </application-client>
>>
>>
>> Bascially, what I'm trying to do is deploy the TopicConnectionFactory and
>> Topic on the server, and use my application client to look them up.
>>
>> However, when I try to deploy the application client, I get this error:
>> "Error: Unable to distribute MyAppClient.jar: Could not access external rar
>> contents for artifact: org.apache.geronimo.configs/activemq-broker/2.0.2/car
>> Access is denied"
>>
>> I'm not even sure if I'm doing the right thing by trying to deploy the
>> activemq resource adapter on the client container as well (I picked up that
>> tip online). If anyone could help me figure out how to let my application
>> client access the JMS resources, please let me know!
>>
>> Thanks a lot,
>> Stella
>>
>>
>>
>

Re: Accessing JMS Resources From J2EE Application Client

Posted by Stella Lok <oi...@gmail.com>.
Hi,

Thanks so much for letting me know I'm on the right track. How may I find
the activemq rar file in the geronimo repository?

I have tried pointing the external-rar to:
     <external-rar>
              <dep:groupId>org.apache.activemq</dep:groupId>
              <dep:artifactId>activemq-core</dep:artifactId>
              <dep:version>4.1.1</dep:version>
              <dep:type>jar</dep:type>
        </external-rar>
but I get a null pointer exception in deploying. I'm wondering whether it is
valid to point to that file as it is not a resource adapter or a module, but
just a jar file residing in
repository/org/apache/activemq/activemq-core/4.1.1/activemq-core-4.1.1.jar ?
I cannot find any other activemq file in the repository folder. I also
couldn't find an example in the 2.0.2 daytrader application. There is a
reference in the older samples, but it is based on an older schema where
external-rar is of type string.

Any help would be much appreciated

Sincerely,
Stella

On Wed, Jul 23, 2008 at 1:29 AM, David Jencks <da...@yahoo.com>
wrote:

> You are correct that you need to deploy the resource adapter on the app
> client as well as the server.  I think the problem is that your external-rar
> tag is pointing to the server's broker configuration rather than the
> actibvemq rar file in the geronimo repository.
> I think there's correct configuration in one of the daytrader app clients.
>
> This would make a great subject for a wiki page (I haven't searched much,
> maybe there already is one?)
>
> thanks
> david jencks
>
> On Jul 22, 2008, at 2:47 AM, Stella Lok wrote:
>
> Hi,
>
> I am trying to access a server-scoped JMS TopicConnectionFactory and Topic
> on Geronimo 2.02, from a J2EE Application Client, but am encountering
> problems. Here are the steps I took:
>
> 1) Deployed JMS TopicConnectionFactory & Topic in Resource Adapter:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>     <dep:environment xmlns:dep="
> http://geronimo.apache.org/xml/ns/deployment-1.2">
>         <dep:moduleId>
>             <dep:groupId>console.jms</dep:groupId>
>             <dep:artifactId>topic</dep:artifactId>
>             <dep:version>1.0</dep:version>
>             <dep:type>rar</dep:type>
>         </dep:moduleId>
>         <dep:dependencies>
>             <dep:dependency>
>                 <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>                 <dep:artifactId>activemq-broker</dep:artifactId>
>                 <dep:type>car</dep:type>
>             </dep:dependency>
>         </dep:dependencies>
>     </dep:environment>
>     <resourceadapter>
>         <resourceadapter-instance>
>
> <resourceadapter-name>eventTopicResourceAdapter</resourceadapter-name>
>         <config-property-setting
>         name="ServerUrl">tcp://localhost:61616</config-property-setting>
>         <config-property-setting
> name="UserName">system</config-property-setting> <config-property-setting
>      name="Password">manager</config-property-setting>
>             <nam:workmanager xmlns:nam="
> http://geronimo.apache.org/xml/ns/naming-1.2">
>                 <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
>             </nam:workmanager>
>         </resourceadapter-instance>
>         <outbound-resourceadapter>
>             <connection-definition>
>
> <connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
>                 <connectiondefinition-instance>
>                     <name>jms/topicConnectionFactory</name>
>                     <connectionmanager>
>                         <xa-transaction>
>                             <transaction-caching/>
>                         </xa-transaction>
>                         <single-pool>
>                             <match-one/>
>                         </single-pool>
>                     </connectionmanager>
>                 </connectiondefinition-instance>
>             </connection-definition>
>         </outbound-resourceadapter>
>     </resourceadapter>
>     <adminobject>
>         <adminobject-interface>javax.jms.Queue</adminobject-interface>
>
> <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
>     </adminobject>
>     <adminobject>
>         <adminobject-interface>javax.jms.Topic</adminobject-interface>
>
> <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
>         <adminobject-instance>
>             <message-destination-name>topic</message-destination-name>
>             <config-property-setting
> name="PhysicalName">topic</config-property-setting>
>         </adminobject-instance>
>     </adminobject>
> </connector>
>
> 2) I created a dummy J2EE application client with the following deployment
> descriptors:
> *application.xml*:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
>     <resource-ref>
>         <res-ref-name>jms/topicConnectionFactory</res-ref-name>
>         <res-type>javax.jms.TopicConnectionFactory</res-type>
>         <res-auth>Container</res-auth>
>         <res-sharing-scope>Shareable</res-sharing-scope>
>     </resource-ref>
>     <message-destination-ref>
>         <message-destination-ref-name>topic</message-destination-ref-name>
>
> <message-destination-type>javax.jms.Topic</message-destination-type>
>         <message-destination-usage>Consumes</message-destination-usage>
>         <message-destination-link>topic</message-destination-link>
>     </message-destination-ref>
>     <message-destination>
>         <message-destination-name>topic</message-destination-name>
>     </message-destination>
> </application-client>
>
> and *geronimo-application-client.xml:*
> <?xml version="1.0" encoding="UTF-8"?>
>
> <application-client xmlns="
> http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
>   xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
>   xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
>   xmlns:security="http://geronimo.apache.org/xml/ns/security-2.0"
>   xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>
>   <dep:client-environment>
>     <dep:moduleId>
>       <dep:groupId>client</dep:groupId>
>       <dep:artifactId>jmsClient</dep:artifactId>
>       <dep:version>1</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:dependencies/>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:client-environment>
>   <dep:server-environment>
>     <dep:moduleId>
>       <dep:groupId>console.jms</dep:groupId>
>       <dep:artifactId>topic</dep:artifactId>
>       <dep:version>1.0</dep:version>
>       <dep:type>rar</dep:type>
>     </dep:moduleId>
>     <dep:dependencies/>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:server-environment>
>   <resource-ref>
>    <ref-name>jms/topicConnectionFactory</ref-name>
>     <resource-link>jms/topicConnectionFactory</resource-link>
>   </resource-ref>
>   <message-destination>
>     <message-destination-name>topic</message-destination-name>
>     <admin-object-link>topic</admin-object-link>
>   </message-destination>
>   <resource>
>         <external-rar>
>               <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>               <dep:artifactId>activemq-broker</dep:artifactId>
>               <dep:version>2.0.2</dep:version>
>               <dep:type>car</dep:type>
>         </external-rar>
>
>         <connector xmlns="
> http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>         <resourceadapter>
>             <resourceadapter-instance>
>                 <resourceadapter-name>ActiveMQ RA</resourceadapter-name>
>                 <config-property-setting name="ServerUrl">tcp://
> 172.168.29.227:61616</config-property-setting>
>                 <config-property-setting
> name="UserName">system</config-property-setting>
>                 <config-property-setting
> name="Password">manager</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.apache.activemq.command.ActiveMQTopic</adminobject-class>
>
>     <adminobject-instance>
>         <message-destination-name>bacmTopic</message-destination-name>
>         <config-property-setting
> name="PhysicalName">bacmTopic</config-property-setting>
>         </adminobject-instance>
> </adminobject>
>
> </connector> </resource>
> </application-client>
>
>
> Bascially, what I'm trying to do is deploy the TopicConnectionFactory and
> Topic on the server, and use my application client to look them up.
>
> However, when I try to deploy the application client, I get this error:
> "Error: Unable to distribute MyAppClient.jar: Could not access external rar
> contents for artifact: org.apache.geronimo.configs/activemq-broker/2.0.2/car
> Access is denied"
>
> I'm not even sure if I'm doing the right thing by trying to deploy the
> activemq resource adapter on the client container as well (I picked up that
> tip online). If anyone could help me figure out how to let my application
> client access the JMS resources, please let me know!
>
> Thanks a lot,
> Stella
>
>
>

Re: Accessing JMS Resources From J2EE Application Client

Posted by David Jencks <da...@yahoo.com>.
You are correct that you need to deploy the resource adapter on the  
app client as well as the server.  I think the problem is that your  
external-rar tag is pointing to the server's broker configuration  
rather than the actibvemq rar file in the geronimo repository.

I think there's correct configuration in one of the daytrader app  
clients.

This would make a great subject for a wiki page (I haven't searched  
much, maybe there already is one?)

thanks
david jencks

On Jul 22, 2008, at 2:47 AM, Stella Lok wrote:

> Hi,
>
> I am trying to access a server-scoped JMS TopicConnectionFactory and  
> Topic on Geronimo 2.02, from a J2EE Application Client, but am  
> encountering problems. Here are the steps I took:
>
> 1) Deployed JMS TopicConnectionFactory & Topic in Resource Adapter:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.2">
>     <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2 
> ">
>         <dep:moduleId>
>             <dep:groupId>console.jms</dep:groupId>
>             <dep:artifactId>topic</dep:artifactId>
>             <dep:version>1.0</dep:version>
>             <dep:type>rar</dep:type>
>         </dep:moduleId>
>         <dep:dependencies>
>             <dep:dependency>
>                 <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>                 <dep:artifactId>activemq-broker</dep:artifactId>
>                 <dep:type>car</dep:type>
>             </dep:dependency>
>         </dep:dependencies>
>     </dep:environment>
>     <resourceadapter>
>         <resourceadapter-instance>
>             <resourceadapter-name>eventTopicResourceAdapter</ 
> resourceadapter-name>
>         <config-property-setting
>         name="ServerUrl">tcp://localhost:61616</config-property- 
> setting>
>         <config-property-setting name="UserName">system</config- 
> property-setting> <config-property-setting          
> name="Password">manager</config-property-setting>
>             <nam:workmanager xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2 
> ">
>                 <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
>             </nam:workmanager>
>         </resourceadapter-instance>
>         <outbound-resourceadapter>
>             <connection-definition>
>                 <connectionfactory- 
> interface>javax.jms.TopicConnectionFactory</connectionfactory- 
> interface>
>                 <connectiondefinition-instance>
>                     <name>jms/topicConnectionFactory</name>
>                     <connectionmanager>
>                         <xa-transaction>
>                             <transaction-caching/>
>                         </xa-transaction>
>                         <single-pool>
>                             <match-one/>
>                         </single-pool>
>                     </connectionmanager>
>                 </connectiondefinition-instance>
>             </connection-definition>
>         </outbound-resourceadapter>
>     </resourceadapter>
>     <adminobject>
>         <adminobject-interface>javax.jms.Queue</adminobject-interface>
>         <adminobject- 
> class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
>     </adminobject>
>     <adminobject>
>         <adminobject-interface>javax.jms.Topic</adminobject-interface>
>         <adminobject- 
> class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
>         <adminobject-instance>
>             <message-destination-name>topic</message-destination-name>
>             <config-property-setting name="PhysicalName">topic</ 
> config-property-setting>
>         </adminobject-instance>
>     </adminobject>
> </connector>
>
> 2) I created a dummy J2EE application client with the following  
> deployment descriptors:
> application.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee 
> " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd 
> ">
>     <resource-ref>
>         <res-ref-name>jms/topicConnectionFactory</res-ref-name>
>         <res-type>javax.jms.TopicConnectionFactory</res-type>
>         <res-auth>Container</res-auth>
>         <res-sharing-scope>Shareable</res-sharing-scope>
>     </resource-ref>
>     <message-destination-ref>
>         <message-destination-ref-name>topic</message-destination-ref- 
> name>
>         <message-destination-type>javax.jms.Topic</message- 
> destination-type>
>         <message-destination-usage>Consumes</message-destination- 
> usage>
>         <message-destination-link>topic</message-destination-link>
>     </message-destination-ref>
>     <message-destination>
>         <message-destination-name>topic</message-destination-name>
>     </message-destination>
> </application-client>
>
> and geronimo-application-client.xml:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0 
> "
>   xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
>   xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
>   xmlns:security="http://geronimo.apache.org/xml/ns/security-2.0"
>   xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2 
> ">
>
>   <dep:client-environment>
>     <dep:moduleId>
>       <dep:groupId>client</dep:groupId>
>       <dep:artifactId>jmsClient</dep:artifactId>
>       <dep:version>1</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:dependencies/>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:client-environment>
>   <dep:server-environment>
>     <dep:moduleId>
>       <dep:groupId>console.jms</dep:groupId>
>       <dep:artifactId>topic</dep:artifactId>
>       <dep:version>1.0</dep:version>
>       <dep:type>rar</dep:type>
>     </dep:moduleId>
>     <dep:dependencies/>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:server-environment>
>   <resource-ref>
>    <ref-name>jms/topicConnectionFactory</ref-name>
>     <resource-link>jms/topicConnectionFactory</resource-link>
>   </resource-ref>
>   <message-destination>
>     <message-destination-name>topic</message-destination-name>
>     <admin-object-link>topic</admin-object-link>
>   </message-destination>
>   <resource>
>         <external-rar>
>               <dep:groupId>org.apache.geronimo.configs</dep:groupId>
>               <dep:artifactId>activemq-broker</dep:artifactId>
>               <dep:version>2.0.2</dep:version>
>               <dep:type>car</dep:type>
>         </external-rar>
>
>         <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2 
> ">
>         <resourceadapter>
>             <resourceadapter-instance>
>                 <resourceadapter-name>ActiveMQ RA</resourceadapter- 
> name>
>                 <config-property-setting name="ServerUrl">tcp:// 
> 172.168.29.227:61616</config-property-setting>
>                 <config-property-setting name="UserName">system</ 
> config-property-setting>
>                 <config-property-setting name="Password">manager</ 
> 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.apache.activemq.command.ActiveMQTopic</ 
> adminobject-class>
>     <adminobject-instance>
>         <message-destination-name>bacmTopic</message-destination-name>
>         <config-property-setting name="PhysicalName">bacmTopic</ 
> config-property-setting>
>         </adminobject-instance>
> </adminobject>
>
> </connector> </resource>
> </application-client>
>
>
> Bascially, what I'm trying to do is deploy the  
> TopicConnectionFactory and Topic on the server, and use my  
> application client to look them up.
>
> However, when I try to deploy the application client, I get this  
> error: "Error: Unable to distribute MyAppClient.jar: Could not  
> access external rar contents for artifact:  
> org.apache.geronimo.configs/activemq-broker/2.0.2/car Access is  
> denied"
>
> I'm not even sure if I'm doing the right thing by trying to deploy  
> the activemq resource adapter on the client container as well (I  
> picked up that tip online). If anyone could help me figure out how  
> to let my application client access the JMS resources, please let me  
> know!
>
> Thanks a lot,
> Stella
>