Bugs item #434620, was opened at 2001-06-19 14:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=434620&group_id=22866

Category: JBossCMP
Group: v2.2.1 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Nobody/Anonymous (nobody)
Summary: Oracle BLOB and byte array

Initial Comment:
I have tried different way of getting attention but 
without success.   So I try here.


I didn't get any responses on the previous post and I 
have tried JAWS mailing list and still no response. 
I do suspect there is a bug or a config problem 
somewhere.  Anyone?
Kar
 
----- Original Message ----- 
From: Kar YEOW 
To: [EMAIL PROTECTED] 
Sent: Monday, June 18, 2001 9:09 AM
Subject: Fw: byte[] fields with oracle blob problem


I post this on the JBOSS list and got no response, so 
I thought I post it here.
Anyway, I kind of got it to work but with the 
following HACK in the JDBCCommand.java and change the 
JAW mapping for java.lang.Object to BLOB.
            <mapping>
                <java-type>java.lang.Object</java-type>
<!--
                <jdbc-type>JAVA_OBJECT</jdbc-type>
-->
                <jdbc-type>BLOB</jdbc-type>
                <sql-type>BLOB</sql-type>
<!-- Change this from BLOB to RAW(255) if you know your
     serialized object will be <= 255 bytes -->
            </mapping>

 
 
        if( bytes == null ) {
            result = null;
        } if (destination == byte[].class) {
            result = bytes;
        } else {
           // We should really reuse these guys
 
            ByteArrayInputStream bais = new 
ByteArrayInputStream(bytes);
 
           // Use the class loader to deserialize
 
            try {
    ObjectInputStream ois = new ObjectInputStream
(bais);
 
 
 
----- Original Message ----- 
From: Kar YEOW 
To: [EMAIL PROTECTED] 
Sent: Thursday, June 14, 2001 8:20 AM
Subject: byte[] fields with oracle blob problem


I am having some problems using byte[] field with 
Oracle Blob.
I have an EJB with a field id of type String and bytes 
of type byte[].
I found that there is 2 problems:
 
1.  if the bytes field is null during creation you get 
exception of 'Invalid column type'.
2.  if you sucessfully 'inserted' something in the 
Blob and subsequently re-deploy the bean to retrieve 
the field you get a CorruptStreamException.
 
I had a look at the source.  The first exception is 
cause by setNull on a JAVA_OBJECT type.  And the 
second exception is caused by trying to read in a byte
[] as Java Serializable object.
 
I had this problem in JBOSS-2.0-FINAL but I thought it 
was fixed in JBOSS-2.2.1.  Anyone?
 
Any help is appreciated.
 
Kar
 
-------------------------------------------------------
------ Invalid column exception --------------------
[JAWS] Exists command executing: SELECT COUNT(*) FROM 
BYTEARRAY WHERE id=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, 
value=hello
[JAWS] Create, id is hello
[JAWS] Exists command executing: SELECT COUNT(*) FROM 
BYTEARRAY WHERE id=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, 
value=hello
[JAWS] Create command executing: INSERT INTO BYTEARRAY 
(bytes,id) VALUES (?,?)
[JAWS] Set parameter: idx=1, jdbcType=JAVA_OBJECT, 
value=NULL
[JAWS] java.sql.SQLException: Invalid column type
[JAWS]  at 
oracle.jdbc.dbaccess.DBError.throwSqlException
(DBError.java:168)
[JAWS]  at 
oracle.jdbc.dbaccess.DBError.throwSqlException
(DBError.java:210)
[JAWS]  at 
oracle.jdbc.dbaccess.DBError.throwSqlException
(DBError.java:273)
[JAWS]  at 
oracle.jdbc.driver.OracleStatement.get_internal_type
(OracleStatement.java:4560)
[JAWS]  at 
oracle.jdbc.driver.OraclePreparedStatement.setNull
(OraclePreparedStatement.java:869)
[JAWS]  at 
org.opentools.minerva.jdbc.PreparedStatementInPool.setN
ull(PreparedStatementInPool.java:92)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setParamete
r(JDBCCommand.java:280)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand
.setParameters(JDBCCreateEntityCommand.java:165)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute
(JDBCCommand.java:159)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand
.execute(JDBCCreateEntityCommand.java:135)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.creat
eEntity(JAWSPersistenceManager.java:122)
[JAWS]  at 
org.jboss.ejb.plugins.CMPPersistenceManager.createEntit
y(CMPPersistenceManager.java:207)
[JAWS]  at org.jboss.ejb.EntityContainer.createHome
(EntityContainer.java:441)
[JAWS]  at java.lang.reflect.Method.invoke(Native 
Method)
[JAWS]  at 
org.jboss.ejb.EntityContainer$ContainerInterceptor.invo
keHome(EntityContainer.java:639)
[JAWS]  at 
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.
invokeHome(EntitySynchronizationInterceptor.java:160)
[JAWS]  at 
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeH
ome(EntityInstanceInterceptor.java:87)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext
(TxInterceptorCMT.java:135)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
ons(TxInterceptorCMT.java:263)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome
(TxInterceptorCMT.java:86)
[JAWS]  at 
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome
(SecurityInterceptor.java:164)
[JAWS]  at 
org.jboss.ejb.plugins.LogInterceptor.invokeHome
(LogInterceptor.java:106)
[JAWS]  at org.jboss.ejb.EntityContainer.invokeHome
(EntityContainer.java:316)
[JAWS]  at 
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.
invokeHome(JRMPContainerInvoker.java:369)
[JAWS]  at java.lang.reflect.Method.invoke(Native 
Method)
[JAWS]  at sun.rmi.server.UnicastServerRef.dispatch
(UnicastServerRef.java:241)
[JAWS]  at sun.rmi.transport.Transport$1.run
(Transport.java:142)
[JAWS]  at java.security.AccessController.doPrivileged
(Native Method)
[JAWS]  at sun.rmi.transport.Transport.serviceCall
(Transport.java:139)
[JAWS]  at 
sun.rmi.transport.tcp.TCPTransport.handleMessages
(TCPTransport.java:443)
[JAWS]  at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.ru
n(TCPTransport.java:643)
[JAWS]  at java.lang.Thread.run(Thread.java:484)
 
---------------------------- corrupt stream exception -
----------------------------------
[JAWS] Exists command executing: SELECT COUNT(*) FROM 
BYTEARRAY WHERE id=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, 
value=hello
[au.com.apir.test.Entity] Activated bean 
au.com.apir.test.Entity with id = hello
[JAWS] Load command executing: SELECT bytes,id FROM 
BYTEARRAY WHERE id=?
[JAWS] Set parameter: idx=1, jdbcType=VARCHAR, 
value=hello
[JAWS] Got a oracle.sql.BLOB: 'oracle.sql.BLOB@135133' 
while looking for a [B
[JAWS] java.sql.SQLException: Unable to load a 
ResultSet column into a variable of type '[B': 
java.io.StreamCorruptedException: InputStream does not 
contain a serialized object
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultOb
ject(JDBCCommand.java:483)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultOb
ject(JDBCCommand.java:499)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.h
andleResult(JDBCLoadEntityCommand.java:119)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.execut
eStatementAndHandleResult(JDBCQueryCommand.java:59)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute
(JDBCCommand.java:160)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.e
xecute(JDBCLoadEntityCommand.java:82)
[JAWS]  at 
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadE
ntity(JAWSPersistenceManager.java:150)
[JAWS]  at 
org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity
(CMPPersistenceManager.java:341)
[JAWS]  at 
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.
invoke(EntitySynchronizationInterceptor.java:192)
[JAWS]  at 
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke
(EntityInstanceInterceptor.java:186)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext
(TxInterceptorCMT.java:133)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
ons(TxInterceptorCMT.java:263)
[JAWS]  at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke
(TxInterceptorCMT.java:99)
[JAWS]  at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke
(SecurityInterceptor.java:190)
[JAWS]  at org.jboss.ejb.plugins.LogInterceptor.invoke
(LogInterceptor.java:195)
[JAWS]  at org.jboss.ejb.EntityContainer.invoke
(EntityContainer.java:323)
[JAWS]  at 
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.
invoke(JRMPContainerInvoker.java:392)
[JAWS]  at java.lang.reflect.Method.invoke(Native 
Method)
[JAWS]  at sun.rmi.server.UnicastServerRef.dispatch
(UnicastServerRef.java:241)
[JAWS]  at sun.rmi.transport.Transport$1.run
(Transport.java:142)
[JAWS]  at java.security.AccessController.doPrivileged
(Native Method)
[JAWS]  at sun.rmi.transport.Transport.serviceCall
(Transport.java:139)
[JAWS]  at 
sun.rmi.transport.tcp.TCPTransport.handleMessages
(TCPTransport.java:443)
[JAWS]  at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.ru
n(TCPTransport.java:643)
[JAWS]  at java.lang.Thread.run(Thread.java:484)

 

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=434620&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to