You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Piotr Przybylski <pi...@us.ibm.com> on 2005/07/12 03:26:59 UTC

JNDI initialization and browsing question.

Hi, 
I have a question about JNDI maybe someone can help me with. Does JNDI 
require any special initialization and is there a way to browse it, other 
than using JNDI API? I am  running into JNDI lookup problem on M3 driver. 
I am using a simple resource adapter RAR file (v 1.5 compliant). When I 
deploy it to the server, it deploys fine. The application (with JSP) also 
deploys fine but when I try to lookup the connection from the jsp 
triggered class, the JNDI context seems empty, the lookup of the following 
does not find anything:
- java:comp/env/test/j2c/po/dii/order/Order_CF
- test/j2c/po/dii/order/Order_CF
- g2MyTestAdapterCF

The global context seems to contain only JMXConnector Object. 

Below are the relevant fragmnets of the configuration files used to deploy 
connector and application. 

Thank you, any help greatly appreciated.

Regards, 

Piotr Przybylski. 

geronimo-jetty.xml:
        <naming:resource-ref>
 <naming:ref-name>test/j2c/po/dii/order/Order_CF</naming:ref-name>
 <naming:resource-link>g2MyTestAdapter</naming:resource-link>
        </naming:resource-ref>


web.xml:
        <resource-ref>
 <res-ref-name>test/j2c/po/dii/order/Order_CF</res-ref-name>
                <res-type>javax.resource.cci.ConnectionFactory</res-type>
                <res-auth>Container</res-auth>
                <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>


geronimo-ra.xml

...
<resourceadapter>
   <outbound-resourceadapter>
   <connection-definition>
 
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface> 

   <connectiondefinition-instance>
      <name>g2MyTestAdapter</name> 
      <config-property-setting 
name="ServerName">localhost</config-property-setting> 
      <config-property-setting 
name="UserName">user</config-property-setting> 
        <connectionmanager>
          <no-transaction /> 
          <single-pool>
            <max-size>10</max-size> 
 <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds> 
            <match-one /> 
          </single-pool>
    </connectionmanager>
    <global-jndi-name>TestAdapterCF</global-jndi-name> 
  </connectiondefinition-instance>
  </connection-definition>
  </outbound-resourceadapter>
  </resourceadapter>
  </connector>




Re: JNDI initialization and browsing question.

Posted by David Jencks <da...@yahoo.com>.
On Jul 11, 2005, at 6:26 PM, Piotr Przybylski wrote:

>
> Hi,
> I have a question about JNDI maybe someone can help me with. Does JNDI  
> require any special initialization and is there a way to browse it,  
> other than using JNDI API? I am  running into JNDI lookup problem on  
> M3 driver. I am using a simple resource adapter RAR file (v 1.5  
> compliant). When I deploy it to the server, it deploys fine. The  
> application (with JSP) also deploys fine but when I try to lookup the  
> connection from the jsp triggered class, the JNDI context seems empty,  
> the lookup of the following does not find anything:
this one should work:
> - java:comp/env/test/j2c/po/dii/order/Order_CF
these should not work:
> - test/j2c/po/dii/order/Order_CF
> - g2MyTestAdapterCF
>
> The global context seems to contain only JMXConnector Object.
I don't recommend using the global context.  Use the java:comp stuff as  
you are trying to do.
>
> Below are the relevant fragmnets of the configuration files used to  
> deploy connector and application.
>
> Thank you, any help greatly appreciated.
>
> Regards,
>
> Piotr Przybylski.
>
> geronimo-jetty.xml:
>         <naming:resource-ref>
>                  
> <naming:ref-name>test/j2c/po/dii/order/Order_CF</naming:ref-name>
>                  
> <naming:resource-link>g2MyTestAdapter</naming:resource-link>
>         </naming:resource-ref>
>
>
> web.xml:
>         <resource-ref>
>                  
> <res-ref-name>test/j2c/po/dii/order/Order_CF</res-ref-name>
>                  
> <res-type>javax.resource.cci.ConnectionFactory</res-type>
>                 <res-auth>Container</res-auth>
>                 <res-sharing-scope>Shareable</res-sharing-scope>
>         </resource-ref>
>
>
> geronimo-ra.xml
>
> ...
> <resourceadapter>
>    <outbound-resourceadapter>
>    <connection-definition>
>        
> <connectionfactory-interface>javax.resource.cci.ConnectionFactory</ 
> connectionfactory-interface>
>    <connectiondefinition-instance>
>       <name>g2MyTestAdapter</name>
>       <config-property-setting  
> name="ServerName">localhost</config-property-setting>
>       <config-property-setting  
> name="UserName">user</config-property-setting>
>         <connectionmanager>
>             <no-transaction />
>           <single-pool>
>               <max-size>10</max-size>
>                
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>               <match-one />
>           </single-pool>
>     </connectionmanager>
>     <global-jndi-name>TestAdapterCF</global-jndi-name>
>   </connectiondefinition-instance>
>   </connection-definition>
>   </outbound-resourceadapter>
>   </resourceadapter>
>   </connector>
>
>

I don't see what is wrong here, this looks correct to me.  Can you look  
in the log  (var/log/geronimo.log) and verify that a gbean for the  
connection factory started? It is probably easiest to search for name=  
g2MyTestAdapter

I would expect that you would get a deployment error if the  
resource-link was not resolvable, so I think the most likely  
explanation is that for some reason the connector didn't start  
properly.  By looking for the object name in the log you may be able to  
find out why.

hope this helps,
david jencks
>