After upgrading from 3.0.2 to 3.0.4 it seems JBoss handles EJB properties of type Serializable in a different way.

 

My whole solution is running the way it used to except for one thing:  Those of my EJB’s which have CMP fields which are of type serializable object fail. For instance, one of my beans has a field called “validator” which stores a serialized java object. After I started using JBoss 3.0.4 it was no longer possible to read these beans from the database. JBoss threw this exception:

 

java.sql.SQLException: Got a [B[cl=0, value=[B@1ab7626] while looking for a dk.r

ockit.puls.value.property.validator.Validator[cl=31889293]

        at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.coerceToJavaType(JDBCUtil.jav

a:570)

        at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.getResult(JDBCUtil.java:437)

        at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.load

ArgumentResults(JDBCAbstractCMPFieldBridge.java:359)

        at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.load

InstanceResults(JDBCAbstractCMPFieldBridge.java:312)

 

Extensive testing has shown that all EJBs which have a serializable object field with a non-null value cannot be read from or written to the database (a SAP DB). As another example, I have an EJB which has a field called “menuBar” which stores a serialized java object. When setting a non-null value for this field on my EJB I get the following exception:

 

javax.ejb.EJBException: Internal error setting parameters for field menuBar; Cau

sedByException is:

        Cannot put ASCII data into this long column

        at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setA

rgumentParameters(JDBCAbstractCMPFieldBridge.java:297)

        at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.setI

nstanceParameters(JDBCAbstractCMPFieldBridge.java:270)

        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCSto

reEntityCommand.java:85)

        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStore

Manager.java:589)

        at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenc

eManager.java:458)

 

Now, my database is exactly the same namely a SAP database, and I checked that the standardjbosscmp-jdbc configuration is also the same – looking at the exception above it seems JBoss tries to store the object as a ascii string of some sort. Both my 3.0.2 and 3.0.4 has this setting

 

         <mapping>

            <java-type>java.lang.Object</java-type>

            <jdbc-type>JAVA_OBJECT</jdbc-type>

            <sql-type>LONG BYTE</sql-type>

         </mapping>

 

which is exactly the setting I want. I went as far as dropping the whole database and reconstructing it using the new 3.0.4 in hopes the error was caused by some inconsistency between the two versions – no luck, the 3.0.4 is simply not able to handle my Serializable fields.

 

If anyone has any idea what is different in JBoss 3.0.4 I shall be very pleased to hear from you. Finally I should mention that I based my 3.0.2 deployment on the “all” deployment configuration (with virtually no changes), and my 3.0.4 deployment is now based on the “default” deployment configuration (with virtually no changes). I did this to improve startup performance (it actually lowered the startup time by one third).

 

 

Yours

 

Randahl

 

 

 

 

 

Reply via email to