geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <ammul...@alumni.princeton.edu>
Subject Re: JNDI Lookup Problem..!
Date Wed, 19 Apr 2006 17:49:37 GMT
OK, if the EJB is looking up the database pool, the same lookup code I
gave should work for you (so long as you have a resource reference in
the ejb-jar.xml that matches the resource reference in
openejb-jar.xml).  The lookup code you posted in your first message
won't work.

Thanks,
    Aaron

On 4/19/06, Santosh Koti <Santosh_Koti@infosys.com> wrote:
>
>
>
> Thanks Aaron, for ur reply.
>
>
>
> But, the component is ejb (session bean) & the openejb-jar.xml is:
>
>
>
> <enterprise-beans>
>
> <session>
>
>    <ejb-name>AccountsInfoEJB</ejb-name>
>
>    <jndi-name>ejb/AccountsInfoEJB</jndi-name>
>
>  <ejb-ref>
>
>     <ref-name>ejb/AccountDetailsEJB</ref-name>
>
>     <ejb-link>AccountDetails</ejb-link>
>
>  </ejb-ref>
>
>  <ejb-ref>
>
>      <ref-name>ejb/CustomerEJB</ref-name>
>
>      <ejb-link>Customer</ejb-link>
>
>  </ejb-ref>
>
>
>
>  <resource-ref>
>
>        <ref-name>testbank</ref-name>
>
>              <resource-link>testbank</resource-link>
>
>        </resource-ref>
>
>
>
> </session>
>
>
>
> </enterprise-beans>
>
>
>
>
>
> But still , I get the same exception …!
>
> What have I done is correct..?
>
>
>
> Thanks,
>
> Santosh.
>
> "Don't talk about yourself; it will be done when you leave. "
>
>
>
>
>
>
> -----Original Message-----
>  From: ammulder@gmail.com [mailto:ammulder@gmail.com] On Behalf Of Aaron
> Mulder
>  Sent: Wednesday, April 19, 2006 9:51 PM
>  To: user@geronimo.apache.org
>  Subject: Re: JNDI Lookup Problem..!
>
>
>
> If a component within the web app (e.g. a servlet, Struts action,
>
> etc.) is looking up the database, it should have code like this:
>
>
>
> DataSource ds = (DataSource)new
>
> InitialContext().lookup("java:comp/env/testbank");
>
>
>
> Thanks,
>
>     Aaron
>
>
>
> On 4/19/06, Santosh Koti <Santosh_Koti@infosys.com> wrote:
>
> >
>
> >
>
> >
>
> >
>
> > Hi Folks,
>
> >
>
> >
>
> >
>
> > I am facing a problem in making a JNDI lookup. I am new to Geronimo
> (actually I am using websphere community edition )
>
> >
>
> >
>
> >
>
> > Here are my details:
>
> >
>
> >
>
> >
>
> > 1) My database deployment Plan (mydb-plan.xml)is:
>
> >
>
> >
>
> >
>
> >          <?xml version="1.0" encoding="UTF-8"?>
>
> >
>
> >
>
> >
>
> > <connector
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector"
>
> >
>
> >   version="1.5"
>
> >
>
> >   configId="testbank"
>
> >
>
> >   >
>
> >
>
> >
>
> >
>
> > <dependency>
>
> >
>
> >     <groupId>jars</groupId>
>
> >
>
> >     <artifactId>oracle-driver-ojdbc</artifactId>
>
> >
>
> >     <version>14.0</version>
>
> >
>
> > </dependency>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >   <resourceadapter>
>
> >
>
> >   <outbound-resourceadapter>
>
> >
>
> >       <connection-definition>
>
> >
>
> >         <connectionfactory-interface>
>
> >
>
> >           javax.sql.DataSource
>
> >
>
> >         </connectionfactory-interface>
>
> >
>
> >         <connectiondefinition-instance>
>
> >
>
> >           <name>testbank</name>
>
> >
>
> >           <config-property-setting name="UserName">
>
> >
>
> >             setlbank
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <config-property-setting name="Password">
>
> >
>
> >             setlbank
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <config-property-setting name="Driver">
>
> >
>
> >             oracle.jdbc.driver.OracleDriver
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <config-property-setting name="ConnectionURL">
>
> >
>
> >
> jdbc:oracle:thin:@172.25.203.148:1521:setlbank
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <config-property-setting name="CommitBeforeAutocommit">
>
> >
>
> >              false
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <config-property-setting name="ExceptionSorterClass">
>
> >
>
> >
> org.tranql.connector.NoExceptionsAreFatalSorter
>
> >
>
> >           </config-property-setting>
>
> >
>
> >           <connectionmanager>
>
> >
>
> >             <local-transaction/>
>
> >
>
> >             <single-pool>
>
> >
>
> >                <max-size>10</max-size>
>
> >
>
> >                <min-size>0</min-size>
>
> >
>
> >                <blocking-timeout-milliseconds>
>
> >
>
> >                   5000
>
> >
>
> >                 </blocking-timeout-milliseconds>
>
> >
>
> >                 <idle-timeout-minutes>
>
> >
>
> >                   30
>
> >
>
> >                 </idle-timeout-minutes>
>
> >
>
> >                 <match-one/>
>
> >
>
> >             </single-pool>
>
> >
>
> >           </connectionmanager>
>
> >
>
> >
>
> >
>
> >          <!-- <global-jndi-name> jdbc/testbank </global-jndi-name>
-->
>
> >
>
> >
>
> >
>
> >         </connectiondefinition-instance>
>
> >
>
> >       </connection-definition>
>
> >
>
> >     </outbound-resourceadapter>
>
> >
>
> > </resourceadapter>
>
> >
>
> > </connector>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > 2) My Geronimo-web.xml file is:
>
> >
>
> >
>
> >
>
> > <?xml version="1.0" encoding="UTF-8"?>
>
> >
>
> > <web-app
>
> >
>
> >
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.0"
>
> >
>
> >
> xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.0"
>
> >
>
> >     configId="MyConfigName"
>
> >
>
> >     parentId="SBank/Entities"
>
> >
>
> >   >
>
> >
>
> >         <naming:resource-ref>
>
> >
>
> >
> <naming:ref-name>testbank</naming:ref-name>
>
> >
>
> >
> <naming:resource-link>testbank</naming:resource-link>
>
> >
>
> >     </naming:resource-ref>
>
> >
>
> >
>
> >
>
> > </web-app>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > 3) My web.xml contains:
>
> >
>
> >
>
> >
>
> >   <resource-ref>
>
> >
>
> >                 <res-ref-name>testbank</res-ref-name>
>
> >
>
> >                 <res-type>javax.sql.DataSource</res-type>
>
> >
>
> >                 <res-auth>Container</res-auth>
>
> >
>
> >
> <res-sharing-scope>Shareable</res-sharing-scope>
>
> >
>
> >       </resource-ref>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > 4) And my Geronimo-application.xml file contains:
>
> >
>
> >
>
> >
>
> > <module>
>
> >
>
> > <connector>tranql-connector-1.1.rar</connector>
>
> >
>
> > <alt-dd>mydb-plan.xml</alt-dd>
>
> >
>
> > </module>
>
> >
>
> >
>
> > </application>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > 5) Deployment is happening fine, but runtime it is giving the following
> exception:
>
> >
>
> >
>
> >
>
> > Caused by: javax.naming.NameNotFoundException: testbank
>
> >
>
> >         at
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:108)
>
> >
>
> >         at
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:116)
>
> >
>
> >         at
> javax.naming.InitialContext.lookup(InitialContext.java:361)
>
> >
>
> >         at
> com.infosys.j2ee.utils.misc.ServiceLocator.getDataSource(ServiceLocator.java:234)
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > 6) InitalContext parameters were :
>
> >
>
> >         <Param name="JndiName" value ="testbank" />
>
> >
>
> >         <Param name="Provider-Url" value="rmi://localhost:1099"/>
>
> >
>
> >         <Param name="Initial-Contextfactory"
> value="com.sun.jndi.rmi.registry.RegistryContextFactory"/>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > And my rmi port is running at 1099 (as specified in the config.xml).
>
> >
>
> > Let me know , what I am missing. I have tried it many times, but no
> success..! :-(
>
> >
>
> > Can some help me out in proceeding further…!
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Thanks,
>
> >
>
> > Santosh.
>
> >
>
> >
>
> >
>
> >
>
> > **************** CAUTION - Disclaimer *****************
>
> >  This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
> solely for the use of the addressee(s). If you are not the intended
> recipient, please notify the sender by e-mail and delete the original
> message. Further, you are not to copy, disclose, or distribute this e-mail
> or its contents to any other person and any such actions are unlawful. This
> e-mail may contain viruses. Infosys has taken every reasonable precaution to
> minimize this risk, but is not liable for any damage you may sustain as a
> result of any virus in this e-mail. You should carry out your own virus
> checks before opening the e-mail or attachment. Infosys reserves the right
> to monitor and review the content of all messages sent to or from this
> e-mail address. Messages sent to or from this e-mail address may be stored
> on the Infosys e-mail system.
>
> >  ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
> >
>

Mime
View raw message