StreamCorruptedException: invalid stream header mapping result set when using EJB2.1 entity beans on JBoss
Issue
We're upgrading JBOSS 4.3 CP10 to 5.1.1 and we're encountering an issue loading a BigDecimal field on an Entity Bean (EJB2.1).
We're getting a StremCorruptedException in JDBCUtil.converToObject
Caused by: java.sql.SQLException: Unable to load to deserialize result: java.io.StreamCorruptedException: invalid stream header: 020401EF
at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.convertToObject(JDBCUtil.java:305)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.convertToObject(JDBCUtil.java:254)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCResultSetReader$4.readResult(JDBCResultSetReader.java:153)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCResultSetReader$AbstractResultSetReader.get(JDBCResultSetReader.java:488)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.loadArgumentResults(JDBCAbstractCMPFieldBridge.java:482)
This exception happens when processing a DECIMAL db field into a java.math.BigDecimal.
Our standardjbosscmp-jdbc.xml for BigDecimal is:
<mapping>
<java-type>java.math.BigDecimal</java-type>
<jdbc-type>DECIMAL</jdbc-type>
<sql-type>DECIMAL</sql-type>
</mapping>
I also tried no mapping and
<mapping>
<java-type>java.math.BigDecimal</java-type>
<jdbc-type>NUMERIC</jdbc-type>
<sql-type>DECIMAL</sql-type>
</mapping>
regardless of the mapping I get the same error.
Our database is MSSQL 2008 R2, with MSSQL JDBC Driver, db column is DECIMAL(7,2). We're running vanilla 5.1.1 on Windows 7 64 bit with JDK 1.6.0_27
Environment
JBoss Enterprise Application Platform (EAP) 5.1.1.GA
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
