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: JNDI Question
Date Wed, 15 Mar 2006 17:00:24 GMT

On Mar 15, 2006, at 12:55 AM, johnxmas wrote:

>> On Mar 14, 2006, at 7:58 AM, johnxmas wrote:
>>
>>> Hi List,
>>>
>>> I have a Resource Adapter (both inbound and outbound) and an
>>> MDB. When the MBD is called, it tries to use the oubound part of
>>> the RA, looking up
>>> for the ConnectionFactory, the InteractionSpec and the
>>> ConnectionSpec (the two laters
>>> having been deployead as admin objects)
>>>
>>> My questions:
>>>
>>> a) how are the jndi-names of this three objects declared in
>>> geronimo-ra.xml
>>
>> We don't have global jndi context, so the jndi names you can use are
>> really determined by the ejb-jar.xml + openejb-jar.xml.  The name you
>> specify in the geronimo-ra.xml for the admin object also has
>> something to do with it :-)
>
> Here is my geronimo-ra.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"
>            configId="ScortJcaAdapter15"
>            version="1.5">
>
>   <resourceadapter>
>
>     <resourceadapter-instance>
>       <resourceadapter-name>ScortJcaAdapter15</resourceadapter-name>
>       <workmanager>
>         <gbean-link>DefaultWorkManager</gbean-link>
>       </workmanager>
>     </resourceadapter-instance>
>
>     <outbound-resourceadapter>
>       <connection-definition>
>         <connectionfactory- 
> interface>javax.resource.cci.ConnectionFactory</connectionfactory- 
> interface>
>         <connectiondefinition-instance>
>           <name>demoInbound.managedConnectionFactory</name>
>           <implemented- 
> interface>com.scort.ctg.cics.eci.jca.EciConnectionFactory</ 
> 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>com.scort.ctg.cics.eci.jca.EciConnectionSpecInterface</ 
> adminobject-interface>
>       <adminobject- 
> class>com.scort.ctg.cics.eci.jca.EciConnectionSpec</adminobject-class>
>       <adminobject-instance>
>         <message-destination-name>demoInbound.CS</message- 
> destination-name>
>         <config-property-setting name="userName">aa</config- 
> property-setting>
>         <config-property-setting name="password">aa</config- 
> property-setting>
>       </adminobject-instance>
>   </adminobject>
>
>     <adminobject>
>       <adminobject- 
> interface>com.scort.ctg.cics.eci.jca.EciInteractionSpecInterface</ 
> adminobject-interface>
>       <adminobject- 
> class>com.scort.ctg.cics.eci.jca.EciInteractionSpec</adminobject- 
> class>
>       <adminobject-instance>
>         <message-destination-name>demoInbound.IS</message- 
> destination-name>
>         <config-property-setting name="commareaLength">20000</ 
> config-property-setting>
>         <config-property-setting name="compactOutgoingData">true</ 
> config-property-setting>
>         <config-property-setting name="dumpCodePage">cp037</config- 
> property-setting>
>         <config-property-setting name="executionTimeout">10000</ 
> config-property-setting>
>         <config-property-setting name="mode">1</config-property- 
> setting>
>       </adminobject-instance>
>   </adminobject>
>
> </connector>
>
>
>
>>>
>>> b) must my MDB have a resource-ref entry on these objects ?
>>
>> It needs a resource-ref for the connection factory and a resource- 
>> env-
>> ref for each of the InteractionSpec and ConnectionSpecs.  We've added
>> a resource-env-link element that may be helpful to shorten the
>> openejb-jar.xml entry you will need, but I think it only works within
>> an ear, so you may well have to specify the target admin object  
>> fully.
>
> BTW, my MDB is deployed as an ear
>
> Here are my ebj-jar.xml and openejb-jar.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>          http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
>          version="2.1">
>
>   <enterprise-beans>
>     <message-driven>
>       <ejb-name>ScortInboundCustListMdb</ejb-name>
>       <ejb- 
> class>com.scort.inbound.test.custlist.GeronimoInboundCustListMdb</ 
> ejb-class>
>       <messaging-type>com.scort.inbound.jca.api.InboundListener</ 
> messaging-type>
>       <transaction-type>Container</transaction-type>
>
>       <activation-config>
>         <activation-config-property>
>           <activation-config-property-name>id</activation-config- 
> property-name>
>           <activation-config-property-value>CUSTLIST</activation- 
> config-property-value>
>         </activation-config-property>
>         <activation-config-property>
>           <activation-config-property-name>port</activation-config- 
> property-name>
>           <activation-config-property-value>23072</activation- 
> config-property-value>
>         </activation-config-property>
>       </activation-config>
>

 >>>>>>>>>>>>>>>>>>>>>>>
In here, you need the resource-ref for the outbound adapter and  
resource-env-refs for the admin objects.
 >>>>>>>>>>>>>>>>>>>>>>>
>     </message-driven>
>   </enterprise-beans>
>
>   <assembly-descriptor>
>     <container-transaction>
>       <method>
>         <ejb-name>ScortInboundCustListMdb</ejb-name>
>           <method-name>*</method-name>
>        </method>
>        <trans-attribute>NotSupported</trans-attribute>
>       </container-transaction>
>   </assembly-descriptor>
>
> </ejb-jar>
>
>
> 	<openejb-jar
>     xmlns="http://www.openejb.org/xml/ns/openejb-jar"
>     xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
>     xmlns:security="http://geronimo.apache.org/xml/ns/security"
>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
>     configId="ScortInboundCustListMdb"  
> parentId="ScortInboundCustListMessageDrivenBean">
>  <enterprise-beans>
>  	<message-driven>
>     <ejb-name>ScortInboundCustListMdb</ejb-name>
> <!--
>     <resource-adapter>
>       <target- 
> name>geronimo.server:J2EEApplication=null,J2EEServer=geronimo,JCAResou 
> rce=ScortJcaAdapter15,j2eeType=JCAResourceAdapter,name=ScortJcaAdapter 
> 15</target-name>
>     </resource-adapter>
> -->
>     <resource-adapter>
>        <resource-link>ScortJcaAdapter15</resource-link>
>     </resource-adapter>
>     <activation-config>
>       <activation-config-property>
>       	<activation-config-property-name>id</activation-config- 
> property-name>
>         <activation-config-property-value>CUSTLIST</activation- 
> config-property-value>        		
>       </activation-config-property>
>       <activation-config-property>
>       	<activation-config-property-name>port</activation-config- 
> property-name>
>         <activation-config-property-value>23072</activation-config- 
> property-value>        		
>       </activation-config-property>
>     </activation-config>
>
>     <resource-ref>
>       <ref-name>demoInbound.managedConnectionFactory</ref-name>
>         <resource-link>demoInbound.managedConnectionFactory</ 
> resource-link>
>     </resource-ref>
>     <resource-env-ref>
>       <ref-name>demoInbound.IS</ref-name>
>       <message-destination-link>demoInbound.IS</message-destination- 
> link>
>     </resource-env-ref>
>     </resource-env-ref>
>
> 	</message-driven>
>  </enterprise-beans>
>
> </openejb-jar>
>
> Is that correct ?
>
> I tried looking up an adminobject (the InteractionSpec) using as  
> names "demoInBound.IS",
> "java:demoInbound.IS", "java:comp/demoInbound.IS", "java:comp/env/ 
> demoInbound.IS".
> No way: NameNotFoundException.
>
> I tried listing the JNDI
>
> context.listBindings("");
>
> only shows
> JMXConnector:  
> javax.management.remote.rmi.RMIServerImpl_Stub:javax.manageme
> nt.remote.rmi.RMIServerImpl_Stub[RemoteStub [ref: [endpoint: 
> [10.1.10.53:1843](re
> mote),objID:[0]]]]
>
> and context.listBindings("java:") does not show anything
>
>
>> AFAIK no one has tried using admin objects for anything but jms
>> destinations before.
>
> AdminObject are for me a precious features of JCA 1.5, allowing to  
> deploy InteractionSpec
> and ConnectionSpec in the RA and saving a lot of further class  
> loaders problems....

It's a good idea, I just never thought of it :-)
>
> As regards the INBOUND part, I do regret that it seems for most  
> people only to deal with
> JMS (try googling !). My Ra needs to be INBOUND and does not do JMS

That should definitely work fine, there is nothing jms specific about  
the geronimo connector implementation.
>
>>  I think that when you look up an admin object
>> in jndi you get a proxy to the actual object: this may cause problems
>> with your objects.  Please let us know what happens, we may need to
>> make some changes in exactly what we are returning.
>
> I will let you know with great pleasure, as soon as I will succeed,  
> which I'm beginnig to doubt
> (after lot of deployment troubles, see further mails, now JNDI  
> problems !) :-D

I think adding the missing bits to your spec dd for resource-ref and  
resource-env-ref should fix that.

thanks
david jencks

>
> Thanks
> Jean-Noël


Mime
View raw message