ejb@glassfish.java.net

Re: Cannot call EJB outside the project

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Wed, 05 Mar 2008 09:05:07 -0500
Hi,

Did you include com.company.companydb.ejbstuff.ASful and its dependency in your client classpath?  Note the root exception ClassNotFoundException: com.company.companydb.ejbstuff.ASful.  And ASful should be a remote business interface. 

-cheng

Corrado Marinaro wrote:

Hello,

 

This is the deployment on the glassfish server, and I cann see clearliy the : “RemoteBusinessJndiName”

 

 

INFO: EJBSCLookup:: sc.getEjbContainerAvailabilityEnabledFromConfig() ==> false

05.03.2008 07:22:34 com.sun.enterprise.iiop.POARemoteReferenceFactory createReferenceFactory

INFO: POARemoteRefFactory addSFSBVersionPolicy? false

05.03.2008 07:22:34 com.sun.ejb.containers.BaseContainer initializeHome

INFO: **RemoteBusinessJndiName: com.company.companydb.ejbstuff.ASful; remoteBusIntf: com.company.companydb.ejbstuff.ASful

05.03.2008 07:22:34 com.sun.enterprise.naming.NamingManagerImpl bindObjects

INFO: naming.bind

05.03.2008 07:22:34 com.sun.enterprise.iiop.POARemoteReferenceFactory createReferenceFactory

INFO: POARemoteRefFactory checking if SFSBVersionPolicy need to be added

05.03.2008 07:22:34 com.sun.ejb.base.sfsb.util.EJBServerConfigLookup needToAddSFSBVersionInterceptors

INFO: EJBSCLookup:: sc.getEjbContainerAvailabilityEnabledFromConfig() ==> false

05.03.2008 07:22:34 com.sun.enterprise.iiop.POARemoteReferenceFactory createReferenceFactory

 

Call that from another project :

 

package thepackage;

 

import javax.naming.InitialContext;

 

public class SfulJavaClient {

 

    public static void main(String args[]) {

 

        try {

 

            InitialContext ic = new InitialContext();

            Sful sful = (Sful) ic.lookup("com.company.companydb.ejbstuff.ASful");

            sful.setId("duke");

            System.out.println("Sful id = " + sful.getId());

 

        } catch(Exception e) {

            e.printStackTrace();

        }

 

    }

 

}

 

 

This error occur:

javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.company.companydb.ejbstuff.ASful [Root exception is java.lang.ClassNotFoundException: com.company.companydb.ejbstuff.ASful]

      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:367)

      at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)

      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)

      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:344)

      at javax.naming.InitialContext.lookup(InitialContext.java:392)

      at thepackage.SfulJavaClient.main(SfulJavaClient.java:12)

Caused by: java.lang.ClassNotFoundException: com.company.companydb.ejbstuff.ASful

      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

      at java.security.AccessController.doPrivileged(Native Method)

      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)

      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

      at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:621)

      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:337)

      ... 5 more