[prev in list] [next in list] [prev in thread] [next in thread] 

List:       geronimo-user
Subject:    Re: MDB trouble with references
From:       Viet Nguyen <vnguyen05 () uky ! edu>
Date:       2007-06-14 4:03:00
Message-ID: 4670BDF4.4030709 () uky ! edu
[Download RAW message or body]

David Jencks wrote:
> Also I noticed you are using mappedName which we ignore, try using 
> name instead.
>
> thanks
> david jencks
>
> On Jun 13, 2007, at 8:31 PM, David Jencks wrote:
>
>> You need to include the resource plan as a parent of your web-app in 
>> the geronimo-web environment element.  If this doesn't help please 
>> show your entire geroniimo-web.xml.
>>
>> You can eliminate the resource-ref type stuff from your 
>> geronimo-web.xml if you make the names exactly the same .... e.g. 
>> naming the connection factory "jms/CommonConnectionFactory"
>>
>> There's some support for automatically mapping "common prefixes" but 
>> I don't think I got to jms yet :-)
>>
>> hope this helps
>> david jencks
>>
>> On Jun 13, 2007, at 10:21 AM, Viet Hung Nguyen wrote:
>>
>>> I am trying to get a simple MDB to work using annotations. However, 
>>> when I deploy it into Geronimo 2.0, I get the following error. This 
>>> is with the ConnectionFactory and Queue set up in Geronimo already:
>>>
>>> Error: Unable to distribute order-ear-2.0-SNAPSHOT.ear: Unable to
>>> resolve resource reference 'jms/CommonConnectionFactory' (Could not
>>> auto-map to resource.  Try adding a resource-ref mapping to your
>>> Geronimo deployment plan.
>>>
>>> My deployment plan for the ConnectionFactory and Queues looks like 
>>> this:
>>>
>>> <connector 
>>> xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
>>>    <dep:environment 
>>> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>>>        <dep:moduleId>
>>>            <dep:groupId>org.apache.geronimo.samples</dep:groupId>
>>>            <dep:artifactId>jms-resources</dep:artifactId>
>>>            <dep:version>1.2</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>CommonConnectionFactory</resourceadapter-name>
>>>            <config-property-setting 
>>> name="Password">geronimo</config-property-setting>
>>>            <config-property-setting 
>>> name="UserName">geronimo</config-property-setting>
>>>            <nam:workmanager 
>>> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1">
>>>                <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
>>>            </nam:workmanager>
>>>        </resourceadapter-instance>
>>>        <outbound-resourceadapter>
>>>            <connection-definition>
>>>                
>>> <connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface> 
>>>
>>>                <connectiondefinition-instance>
>>>                    <name>CommonConnectionFactory</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.activemq.message.ActiveMQQueue</adminobject-class> 
>>>
>>>        <adminobject-instance>
>>>            
>>> <message-destination-name>OrderQueue</message-destination-name>
>>>            <config-property-setting 
>>> name="PhysicalName">OrderQueue</config-property-setting>
>>>        </adminobject-instance>
>>>        <adminobject-instance>
>>>            
>>> <message-destination-name>ConsignmentQueue</message-destination-name>
>>>            <config-property-setting 
>>> name="PhysicalName">ConsignmentQueue</config-property-setting>
>>>        </adminobject-instance>
>>>    </adminobject>
>>>    <adminobject>
>>>        <adminobject-interface>javax.jms.Topic</adminobject-interface>
>>>        
>>> <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class> 
>>>
>>>    </adminobject>
>>> </connector>
>>>
>>> I have the MDB with the following annotation
>>>
>>> @MessageDriven(activationConfig = {
>>>    @ActivationConfigProperty(propertyName="destinationType", 
>>> propertyValue="javax.jms.Queue"),
>>>    @ActivationConfigProperty(propertyName="destination", 
>>> propertyValue="jms/OrderQueue")
>>> })
>>>
>>> I have a Servlet with the following annotated Queue and 
>>> ConnectionFactory:
>>>
>>>    @Resource(mappedName="jms/OrderQueue")
>>>    private static Queue receivingQueue;
>>>    @Resource(mappedName="jms/CommonConnectionFactory")
>>>    private static QueueConnectionFactory factory;
>>>
>>> I have the geronimo-web.xml file which has the following:
>>>
>>>  <resource-ref>
>>>    <ref-name>jms/CommonConnectionFactory</ref-name>
>>>    <resource-link>CommonConnectionFactory</resource-link>
>>>  </resource-ref>
>>>  <resource-env-ref>
>>>       <ref-name>jms/OrderQueue</ref-name>
>>>       <admin-object-link>OrderQueue</admin-object-link>
>>>  </resource-env-ref>
>>>
>>> However, I think that these references are unnecessary when the 
>>> annotations are present. But I am new to EJBs in general so I am not 
>>> sure.
>>>
>>> And I also have a web.xml with the following references too
>>>
>>>    <resource-ref>
>>>        <res-ref-name>jms/CommonConnectionFactory</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/OrderQueue</message-destination-ref-name> 
>>>
>>>        
>>> <message-destination-type>javax.jms.Queue</message-destination-type>
>>>        <message-destination-usage>Produces</message-destination-usage>
>>>        <message-destination-link>OrderQueue</message-destination-link>
>>>    </message-destination-ref>
>>>
>>> Am I missing something? I would appreciate any type of feedback.
>>>
>>> Thanks,
>>> Viet Nguyen
>>
>
>
Thanks for helping David. Everything worked out perfectly.

Thanks,
Viet Nguyen
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic