dcsimg
Big Decimal Deserialization Bug
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Phillip_Rubio
Posted On:   Monday, June 25, 2001 11:21 AM

I have created an Entity Bean with CMP that stores a BigDecimal along with a few other Strings. Using a standalone client, I recieve a CORBA error when trying to retrieve this BigDecimal from the remote object. Here is my client code main method: String JNDI_URL = "iiop://127.0.0.1:1050"; String INIT_FACTORY="com.sun.jndi.cosnaming.CNCtxFactory"; java.util.Properties props= new java.util.Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, INIT_FACTORY); props.put(Context.PROVIDER_URL, JNDI_URL); InitialContext initial = new InitialContext(props); Object objref = initial.lookup("ejb/tableuserconnectionr"); TblUserConn   More>>

I have created an Entity Bean with CMP that stores a BigDecimal along with a few other Strings. Using a standalone client, I recieve a CORBA error when trying to retrieve this BigDecimal from the remote object. Here is my client code main method:


String JNDI_URL = "iiop://127.0.0.1:1050";
String INIT_FACTORY="com.sun.jndi.cosnaming.CNCtxFactory";


java.util.Properties props= new java.util.Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, INIT_FACTORY);
props.put(Context.PROVIDER_URL, JNDI_URL);


InitialContext initial = new InitialContext(props);
Object objref = initial.lookup("ejb/tableuserconnectionr");


TblUserConnRHome home = (TblUserConnRHome)PortableRemoteObject.narrow(objref,
TblUserConnRHome.class);


BigDecimal bg = new BigDecimal(15634);
TblUserConnR tbl = home.create(bg, "This is a test");


System.out.println("connName: " + tbl.getConnName());


BigDecimal bgOut = tbl.getUserUid(); // <-- THIS LINE THROWS AN EXCEPTION! WHY?


System.out.println("uid: " + bgOut.toString());


The exception is rather long, but here is a trimmed version:


java.lang.NullPointerException

at java.util.Hashtable.get(Hashtable.java:320)

at com.sun.corba.se.internal.iiop.IIOPConnection.getCodeBase(IIOPConnect
ion.java:1061)

...

at com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStre
am.java:914)

at com.sun.corba.se.internal.core.UEInfoServiceContext. (UEInfoServ
iceContext.java:33)

at java.lang.reflect.Constructor.newInstance(Native Method)

...

org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe

org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe

at com.sun.corba.se.internal.core.UEInfoServiceContext. (UEInfoServ
iceContext.java:37)

...

at com.sun.corba.se.internal.iiop.ReaderThread.run(IIOPConnection.java:1
09)


The exception is thrown at the marked line in the code. I know the tbl object is valid because the line above it works just fine.


I am running the latest releases of JDK 1.3.1 and J2EE 1.2.1 on Windows 2K. Using the cloudscape database, and everything is run on the local machine.


My research has found that there is a bug in JDK1.3 (bug parade id: 4389300) where BigDecimal and BigInteger are not being serialized properly, but the bug has been closed.


Here is the funny part, if I take out the properties that is passed to the InitialContext, an exception is thrown at home.create(...). Does this mean that the server is not Serializing the BigDecimal properly? Is there a way to tell the server to use the same com.sun.jndi.cosnaming.CNCtxFactory as the client?


Does anyone know of a way around this?

   <<Less
About | Sitemap | Contact