geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aman Nanner/MxI Technologies <aman.nan...@mxi.com>
Subject Re: Accessing EJB via JNDI from a web application
Date Fri, 19 Jan 2007 16:46:23 GMT
Thanks for the reply.

I built the geronimo-global-jndi plugin and included it into my Geronimo
server.  I've declared a dependency on it in my app, and have also
registered it as a GBean.  However, during deployment of my app, I get an
exception when it tries to deploy the GBean:

     [java] Caused by:
org.apache.geronimo.gbean.InvalidConfigurationException: Could not find a
valid constructor for GBean: org.apache.geronimo.gjndi.binding.EjbBindings
     [java]     at
org.apache.geronimo.gbean.GBeanInfoBuilder.getConstructorTypes(GBeanInfoBuilder.java:500)
     [java]     at
org.apache.geronimo.gbean.GBeanInfoBuilder.getBeanInfo(GBeanInfoBuilder.java:438)
     [java]     at
org.apache.geronimo.gjndi.binding.EjbBindings.<clinit>(EjbBindings.java:106)

The following is my GBean declaration:

    <sys:gbean name="EjbBindings"
class="org.apache.geronimo.gjndi.binding.EjbBindings">
        <attribute name="homeContext">remote</attribute>
        <attribute name="localHomeContext">local</attribute>
    </sys:gbean>

I checked the source of the EjbBindings.java file, and it seems like the
constructor is declared as follows:

----
    static {
        GBeanInfoBuilder builder =
GBeanInfoBuilder.createStatic(EjbBindings.class, "EjbBindings");
        builder.setConstructor(new String[]{"kernel", "homeContext",
"localHomeContext"});
        GBEAN_INFO = builder.getBeanInfo();
    }

    public EjbBindings(Kernel kernel, String homeContext, String
localHomeContext) throws NamingException {
        super("", new AbstractNameQuery(null, Collections.EMPTY_MAP,
RpcEjbDeployment.class.getName()), kernel);
        NameParser parser = getNameParser();
        this.homeContext = parser.parse(homeContext);
        this.localHomeContext = parser.parse(localHomeContext);
    }

----

What is this "kernel" attribute that I'm supposed to pass into the
constructor?  I suppose this is the reason that it is failing...



                                                                           
             David Jencks                                                  
             <david_jencks@yah                                             
             oo.com>                                                    To 
                                       user@geronimo.apache.org            
             01-18-2007 08:24                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: Accessing EJB via JNDI from a   
             Please respond to         web application                     
             user@geronimo.apa                                             
                  che.org                                                  
                                                                           
                                                                           
                                                                           
                                                                           





On Jan 18, 2007, at 3:02 PM, Aman Nanner/MxI Technologies wrote:

>
> Hi,
>
> I'm running into an issue using the Geronimo 1.2 beta release.
>
> I'm running a web application from which an EJB is being looked up
> via its
> JNDI name as declared in the openejb-jar.xml descriptor that
> resides in the
> EJB module.  In my web.xml for the web application, I have the EJB
> declared
> as a reference.
>
> The problem is that I get a NameNotFoundException by looking up the
> EJB via
> the JNDI name.  However, if I look up the EJB via it's EJB
> reference, as
> defined in the ejb-jar.xml, then the lookup succeeds.  I know that
> I should
> be using the EJB reference to look up the EJB anways, but I've got
> a legacy
> app that I'm trying to port to Geronimo that is littered with EJB
> lookups
> using direct JNDI names.
>
> Before I dive into the Geronimo source code, perhaps somebody knows
> for
> sure that EJB JNDI lookups are supposed to fail from within a server
> context (i.e. it will fail by design) and let me know?

You have to do a bit of work to enable this -- we didn't end up
including all the pieces in geronimo.

If you check out https://svn.apache.org/repos/asf/geronimo/sandbox/
plugins/global-jndi you'll find a class EjbBindings.  I don't think
this made it into geronimo itself.  If you build this little project
and deploy an instance of this ejbBindings gbean in your ejb app it
should result in each ejb getting bound in the global java:context
under the names you specified in the openejb-jar plan.

I think the gbean config would look something like

<gbean name="EjbBindings"
class="org.apache.geronimo.gjndi.binding.EJBBindings">
     <attribute name="homeContext">remote</attribute>
     <attribute name="localHomeContext">local</attribute>
</gbean>

Then a typical remote home would be bound at java:remote/foo.

Hope this helps and sorry for not making it easier.

thanks
david jencks

>
> Thanks,
> Aman
>
> ______________________________________________________________________
> ____________
> * This message is intended only for the use of the individual or
> entity to which it is addressed, and may contain information that
> is privileged, confidential and exempt from disclosure under
> applicable law. Unless you are the addressee (or authorized to
> receive for the addressee), you may not use, copy or disclose the
> message or any information contained in the message. If you have
> received this message in error, please advise the sender by reply e-
> mail , and delete the message, or call (collect) 001 613 747 4698. *
>



__________________________________________________________________________________
* This message is intended only for the use of the individual or entity to which it is addressed,
and may contain information that is privileged, confidential and exempt from disclosure under
applicable law. Unless you are the addressee (or authorized to receive for the addressee),
you may not use, copy or disclose the message or any information contained in the message.
If you have received this message in error, please advise the sender by reply e-mail , and
delete the message, or call (collect) 001 613 747 4698. *


Mime
View raw message