C
Christian Naeger
Hi all,
I desperately need your help.
I have written a simple Statless Session Bean and successfully deployed
it to Sun App Server 8.2. Moreover, I have written a small Java
application (a standalone application, with the jar from asadmin
get-client-stubs on the classpath) that looks up the Session Bean. The
look up is successful and I get an object of the correct type. The
narrowing does not throw an exception but unfortunately it does return
a null pointer. Please, have a look at the client code and the output
below.
I have tried everything I can think of and I believe I have done
everything correctly. Yet, it just doesn't work. Could anyone please
give a hint what I am probably doing wrong (the API does not mention
narrow returning null and google didn't bring up a solution either)?
Any help is greatly appreciated.
Greetings, Chris
Client-Code:
=========
Hashtable props = new Hashtable();
props.put("java.naming.factory.initial",
"com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", "iiop://localhost:3700");
Context ic = new InitialContext(props);
Object o = ic.lookup("ejb/BankMgr");
if (o == null)
System.out.println("Null Pointer");
else
System.out.println("No Null Pointer");
System.out.println(o.getClass().getName());
System.out.println(o.toString());
System.out.println(BankMgrHome.class);
o = PortableRemoteObject.narrow(o, BankMgrHome.class);
if (o == null)
System.out.println("Null Pointer");
else
System.out.println("No Null Pointer");
Output:
=======
No Null Pointer
com.sun.corba.se.impl.corba.CORBAObjectImpl
IOR:000000000000002f524d493a6e696e762e656e7469746965732e42616e6b4d6772486f6d653a303030303030303030303030303030300000000000010000000000000178000102000000000a3132372e302e302e31000e7400000056afabcb00000000260000003f00000009533141532d4f5242000000000000000200000008526f6f74504f41000000001237343637393631373538323037313830380000000000000d010950b76df1000000000001ff14000000000007000000010000002000000000000100010000000205010001000100200001010900000001000101000000002600000002000200000000000300000014000000000000000a3132372e302e302e31000eec0000000300000014000000000000000a3132372e302e302e31000f500000001f00000004000000030000002000000004000000010000002100000078000000000000000100000000000000240000001c0000006600000000000000010000000a3132372e302e302e31000eec00400000000000080606678102010101000000170401000806066781020101010000000764656661756c74000400000000000000000000010000000806066781020101010000000f
interface ninv.entities.BankMgrHome
Null Pointer
I desperately need your help.
I have written a simple Statless Session Bean and successfully deployed
it to Sun App Server 8.2. Moreover, I have written a small Java
application (a standalone application, with the jar from asadmin
get-client-stubs on the classpath) that looks up the Session Bean. The
look up is successful and I get an object of the correct type. The
narrowing does not throw an exception but unfortunately it does return
a null pointer. Please, have a look at the client code and the output
below.
I have tried everything I can think of and I believe I have done
everything correctly. Yet, it just doesn't work. Could anyone please
give a hint what I am probably doing wrong (the API does not mention
narrow returning null and google didn't bring up a solution either)?
Any help is greatly appreciated.
Greetings, Chris
Client-Code:
=========
Hashtable props = new Hashtable();
props.put("java.naming.factory.initial",
"com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", "iiop://localhost:3700");
Context ic = new InitialContext(props);
Object o = ic.lookup("ejb/BankMgr");
if (o == null)
System.out.println("Null Pointer");
else
System.out.println("No Null Pointer");
System.out.println(o.getClass().getName());
System.out.println(o.toString());
System.out.println(BankMgrHome.class);
o = PortableRemoteObject.narrow(o, BankMgrHome.class);
if (o == null)
System.out.println("Null Pointer");
else
System.out.println("No Null Pointer");
Output:
=======
No Null Pointer
com.sun.corba.se.impl.corba.CORBAObjectImpl
IOR:000000000000002f524d493a6e696e762e656e7469746965732e42616e6b4d6772486f6d653a303030303030303030303030303030300000000000010000000000000178000102000000000a3132372e302e302e31000e7400000056afabcb00000000260000003f00000009533141532d4f5242000000000000000200000008526f6f74504f41000000001237343637393631373538323037313830380000000000000d010950b76df1000000000001ff14000000000007000000010000002000000000000100010000000205010001000100200001010900000001000101000000002600000002000200000000000300000014000000000000000a3132372e302e302e31000eec0000000300000014000000000000000a3132372e302e302e31000f500000001f00000004000000030000002000000004000000010000002100000078000000000000000100000000000000240000001c0000006600000000000000010000000a3132372e302e302e31000eec00400000000000080606678102010101000000170401000806066781020101010000000764656661756c74000400000000000000000000010000000806066781020101010000000f
interface ninv.entities.BankMgrHome
Null Pointer