geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shiva Kumar H R" <shiv...@gmail.com>
Subject Re: Can't connect to ConnectionFactory, need resource-ref?
Date Tue, 03 Jul 2007 11:59:45 GMT
Comments inline.

On 7/3/07, Francisco Borges <francisco@x-hive.com> wrote:
>
> Hello,
>
> I'm trying to port this J2EE module to Geronimo1.2, but I'm not familiar
> with EJB's, so I might be missing something obvious.
>
> [...]
>
> I managed to deploy both our resource adapter to a connection factory (as
> a RAR file), and our sample session (JAR+EJB).
>
> I can start running the sample, but from it I can't get a connection to
> the ConnectionFactory.
>
> From "12.3.6 Resolving References from EJBs" at
> <http://www.chariotsolutions.com/geronimo/geronimo-1.1/ejb-structure.html>
> I gather that on Geronimo (differently from JBoss) after deploying the
> RAR, in order to be able to find it from my sample app, I need to declare
> it as a resource-ref at the sample's "openejb-jar.xml" and "ejb-jar.xml".
> Is this correct?


Yes

If so, how should I do this? I managed to declare a resource-ref on
> openejb-jar.xml, but not on the ejb-jar.xml.
>
> On the openejb-jar.xml, I have:
>
> """"
>       <session>
>          <ejb-name>XhiveSampleSessionBean</ejb-name>
>          <jndi-name>com.xhive.ejb.XhiveSampleSessionEJB</jndi-name>
>          <ejb-ref>
>             <ref-name>ejb/XhiveDS</ref-name>
>             <ejb-link>XhiveDS</ejb-link>
>          </ejb-ref>
>       </session>
> """"


<ejb-ref> is not the element to be used. Please use <resource-ref> as below:

      <session>
         <ejb-name>XhiveSampleSessionBean</ejb-name>
         <jndi-name>com.xhive.ejb.XhiveSampleSessionEJB</jndi-name>
         <nam:resource-ref xmlns:nam="
http://geronimo.apache.org/xml/ns/naming-1.2">
            <ref-name>jdbc/XhiveDS</ref-name>
            <ref-link>XhiveDS</ref-link>
         </nam:resource-ref>
      </session>

What should I add to ejb-jar.xml?
>
> I've tried adding something like
> """
>     <session>
>       <ejb-name>XhiveSampleSessionBean</ejb-name>
>         [....]
>       <resource-ref>
>               <res-ref-name>ejb/XhiveDS</res-ref-name>
>              <res-type>
>
> com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf
>             </res-type>
>      </resource-ref>
>      </session>
> """


JNDI namespace for datasources should ideally be jdbc. Try changing
<res-ref-name> to "jdbc/XhiveDS" (plus update jndi lookup code in your ejbs)
as below, in sync with <ref-name> in openejb-jar.xml, and see if it solves
the problem.

     <resource-ref>
       <res-ref-name>jdbc/XhiveDS</res-ref-name>
       <res-type>
         com.xhive.j2ee.connector.interfaces.XhiveCCIConnectionFactoryIf
       </res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
     </resource-ref>

But with this last change the Sample EJB won't deploy. For clarity, I'm
> attaching the 4 xml files I'm using for RAR and EJB+JAR deployment.
>
> Any hints, or tips are heartily appreciated,


If this doesn't solve, do post the errors you are seeing while
deploying/running.

Cheers,
> --
> Francisco Borges


- Shiva

Mime
View raw message