Hi there,

I am having problmes to retrieve Object out of database. I am using Jboss 
3.2.6, Sybase ASA 8.0.2.

We have an entity bean, one of the data memeber is a serializable Object, say 
Object_A. Entity bean was created successfully. Data was inserted into Database 
without problems. But when I tried to retrieve the data through direct JDBC 
from the database. I got ClassCastException. If I retrieve the data by calling 
the entity bean finder methods, everything worked fine. 

I am doing the evaluation for our product to see if we can migrate to Jboss. 
Many applications of our product make direct JDBC calls to the database to 
retrieve the data that has been written to DB through entity beans. Because of 
the big number of applications, it's almost impossible to change the 
applications to call the entity bean finder. We didn't have any problem with 
our existing AS.

The jdbc/sql mapping for object is as follows:

      
            <java-type>java.lang.Object</java-type>
            <jdbc-type>BINARY</jdbc-type>
            <sql-type>IMAGE</sql-type>
         
The original mapping coming with Jboss was:
         
            <java-type>java.lang.Object</java-type>
            <jdbc-type>JAVA_OBJECT</jdbc-type>
            <sql-type>IMAGE</sql-type>
         
I had to change the mapping because the version of the Sybase we are using 
doesn't support JDK1.4, while our application uses JDK1.4.

The code to read Object_A:
protected static Object_A getHashtable( InputStream is ) throws IOException {
        if( is == null ) {
            return new Object_A();
        }

        ObjectInputStream ois = new ObjectInputStream(is);
        Object_A sht = null;
        try {
            sht = (Object_A)ois.readObject();
            ois.close();
            is.close();
            return sht;
        } catch( ClassNotFoundException cnfe ) {
            LogSystem.logError(Level.WARNING, " ", cnfe);
            return new Object_A();
        }
    }

The code in bold is the line that causes the exception below:

09:17:37,651 ERROR [STDERR] java.lang.ClassCastException
09:17:37,651 ERROR [STDERR]     at 
product.application.getHashtable(DBUtility.java:601)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.ejb.Container.invoke(Container.java:709)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
09:17:37,661 ERROR [STDERR]     at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
09:17:37,661 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
09:17:37,661 ERROR [STDERR]     at 
sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
09:17:37,661 ERROR [STDERR]     at sun.rmi.transport.Transport$1.run(Unknown 
Source)
09:17:37,661 ERROR [STDERR]     at 
java.security.AccessController.doPrivileged(Native Method)
09:17:37,661 ERROR [STDERR]     at 
sun.rmi.transport.Transport.serviceCall(Unknown Source)
09:17:37,661 ERROR [STDERR]     at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
09:17:37,671 ERROR [STDERR]     at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
09:17:37,671 ERROR [STDERR]     at java.lang.Thread.run(Unknown Source)

Your help will be very much appreciated!

Thanks,
Julia.


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869633#3869633

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869633


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to