ejb@glassfish.java.net

AW: Cannot call EJB outside the project

From: Corrado Marinaro <corrado.marinaro_at_marinaro.ch>
Date: Wed, 5 Mar 2008 15:14:52 +0100

Hello,

 

trhx fort he answer. The ASful is noted with Remote. In the Sun-Example
there is no note about setting any thing. The clou should be : Annotation
and that’s it. That’s apparantely not like that?

I’m using a glassfish server …

 

The following call rocks (but that’s not that I want … ):

 

public class ASfulJavaClient {

    public static void main(String args[]) {

        try {

            InitialContext ic = new InitialContext();

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

            aSful.setId("duke");

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

        } catch(Exception e) {

            e.printStackTrace();

        }

    }

}

 

By the way, the EJB and the SfulJavaClient sits in the same package aswell
as the example above … strange behavior …

 

 

Von: Cheng.Fang_at_Sun.COM [mailto:Cheng.Fang_at_Sun.COM]
Gesendet: Mittwoch, 5. März 2008 15:05
An: ejb_at_glassfish.dev.java.net
Betreff: Re: Cannot call EJB outside the project

 

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(RemoteB
usinessObjectFactory.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

 

--------------------------------------------------------------------- To
unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net For additional
commands, e-mail: ejb-help_at_glassfish.dev.java.net