users@glassfish.java.net

NamingException ejb ref resolution error for remote business interface

From: <glassfish_at_javadesktop.org>
Date: Fri, 02 Nov 2007 17:49:46 PST

ok, after reading MANY REPLIES to MANY threads of the SAME issue . .

i still have the same problem . .
using netbeans 5 with sun app server 9

my Session bean is defined as

@Stateless(mappedName="Person")
public class PersonBean . . . . implements PersonRemote, PersonLocal

the package "com.world.Session" contains:
PersonBean
PersonRemote
PersonLocal


    
in my client's Main Method . . .

I have the NO ARG Intialcontext() that everyone insists on using . . .

InitialContext ic = new InitialContex( );


the following jars (taken right from the server!) as per glassfish's instructions:
appserv-rt.jar
appserv-ext.jar
appserv-deployment-client.jar
and the javaee.jar ( without this you'll get a "PolicyContextException" )


Finally arguments to the vm
-Dorg.omg.CORBA.ORBInitialHost=200.1.1.253
    and
-Dorg.omg.CORBA.ORBInitialPort=3700

** please note, this is from a stand alone client ( a client running on a box different from the location of the Session Bean )**


when i run the list("") from the InitialContext "ic.list("")"

i get the jndi listings in the Appserver as:

init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Administrator\testClient2\build\classes
compile:
run:
Person__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
jdbc: com.sun.enterprise.naming.TransientContext
Person: javax.naming.Reference
UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
ejb: com.sun.enterprise.naming.TransientContext
Person#com.world.Session.PersonRemote: javax.naming.Reference
__SYSTEM: com.sun.enterprise.naming.TransientContext


now, following from the previous thread i've read:
"Object o = ic.lookup("Person");" (judging from the jndi listings above) should work.
but it doesnt, Instead i get:

[b]Exception in thread "main" javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.world.Session.PersonRemote [Root exception is java.lang.ClassNotFoundException: com.world.Session.PersonRemote][/b]

now, if i run:
Object o = ic.lookup "Person__3_x_Internal_RemoteBusinessHome__");
it works.. well it works to the extent that the lookup worked,
but i cant cast it to:
PersonRemote me = (PersonRemote)ic.lookup "Person__3_x_Internal_RemoteBusinessHome__");
i get the error:

java.lang.ClassCastException: com.sun.corba.ee.impl.corba.CORBAObjectImpl cannot be cast

(yes you can cast it this way in EJB 3 the narrow method is only needed in EJB 2.0)

so, that being said . . .
what do i need to do to get [i][u][b]"Object o = ic.lookup("Person") "[/b][/u][/i]
to work ?!?
and i'd prefer to not use:
ic.lookup "Person__3_x_Internal_RemoteBusinessHome__") as an alternative.
[Message sent by forum member 'andymarvinj' (andymarvinj)]

http://forums.java.net/jive/thread.jspa?messageID=243637