ejb@glassfish.java.net

AW: AW: Cannot call EJB outside the project

From: Corrado Marinaro <corrado.marinaro_at_marinaro.ch>
Date: Wed, 5 Mar 2008 16:43:12 +0100

Hello cheng,

 

you right. The SFul is the name of the sample from Suns-Page. I just renamed
it do ASFul (everything) because it was easier to find in the log … (Sful is
similar to succesSful -> hard to find the bean in the log …)

 

anyway, the problem still persists … I still have no clou where to look at …
or what to change … I mean, the lookup works fine … why should the EJB stuff
not working? Is it something with the version of glassfish 9.1? or do I have
to look into a special folder of the Glassfish Server? Is there any XML I
have to configure (like the faces-config -> there you have to register the
Beans)?

 

Anyhelp would be terrific ... sorry about that small issue, it’s a big one
for me … (looks like) …

 

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

 



Corrado Marinaro wrote:

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?

Yes, using @Remote annotation should suffice.

From what I can see, the difference between the 2 clients is casting to Sful
or ASful. When you look up a bean of a remote business interface type, you
always cast and assign to this type, or supertype thereof.

-cheng



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

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