-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Problem loading a serializable object from database
PostPosted: Wed Jul 14, 2004 7:54 am 
Newbie

Joined: Wed Jul 14, 2004 7:25 am
Posts: 3
Hi all!

I'm having a problem when I try to load data from a table that contains a column of type BLOB that contains a serialized java object (i'm using Oracle 8i and Hibernate 2.1).

I executed the save operation and the object is stored in the database, but when i try to load it again this exception is thrown:

net.sf.hibernate.type.SerializationException: could not deserialize

at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:197)

at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:220)

at net.sf.hibernate.type.SerializableType.fromBytes(SerializableType.java:73)

at net.sf.hibernate.type.SerializableType.get(SerializableType.java:38)

at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)

at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)

at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)

at net.sf.hibernate.loader.Loader.hydrate(Loader.java:611)

at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:552)

at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:511)

at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)

at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)

at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)

at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)

at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)

at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)

at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)

at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)

at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2106)

at net.sf.hibernate.impl.SessionImpl.doLoadByObject(SessionImpl.java:1960)

at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1904)

at la.foton.banklink.infra.dao.hbr.HbrDaoAutorizacao.update(HbrDaoAutorizacao.java:165)

at la.foton.banklink.infra.autorizador.AbstractAutorizador.atualizaStatusAutorizacao(AbstractAutorizador.java:637)

at la.foton.banklink.infra.autorizador.AbstractAutorizador.atualizaAutorizacao(AbstractAutorizador.java:341)

at la.foton.banklink.solicitacredito.AutorizadorCredito.cancela(AutorizadorCredito.java:96)

at la.foton.banklink.infra.autorizador.ejb.session.AutorizadorFacadeBean.cancela(AutorizadorFacadeBean.java:100)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)

at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)

at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)

at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)

at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)

at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)

at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)

at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)

at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)

at org.jboss.ejb.Container.invoke(Container.java:700)

at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)

at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)

at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)

at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

at sun.rmi.transport.Transport$1.run(Transport.java:148)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:536)

Caused by: java.io.StreamCorruptedException: invalid stream header

at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)

at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)

at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:189)

... 56 more


I mapped the column like this:

<property name="objSer" column="objSer" type="serializable"/>

And the mapped class:

public class EstAut
{
private Object objSer;
...

final public Object getObjSer()
{
return objSer;
}

final public void setObjSer(Object pmtObjSer)
{
objSer = pmtObjSer;
}
...
}


Thanks!
Elio


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 8:37 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
at la.foton.banklink.infra.dao.hbr.HbrDaoAutorizacao.update(HbrDaoAutorizacao.java:165)

at la.foton.banklink.infra.autorizador.AbstractAutorizador.atualizaStatusAutorizacao(AbstractAutorizador.java:637)

at la.foton.banklink.infra.autorizador.AbstractAutorizador.atualizaAutorizacao(AbstractAutorizador.java:341)

at la.foton.banklink.solicitacredito.AutorizadorCredito.cancela(AutorizadorCredito.java:96)

at la.foton.banklink.infra.autorizador.ejb.session.AutorizadorFacadeBean.cancela(AutorizadorFacadeBean.java:100)

Look at these lines of your coding perhaps you use some variables that can't be serialized.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 9:57 am 
Newbie

Joined: Wed Jul 14, 2004 7:25 am
Posts: 3
Hi!

Look at these lines of your coding perhaps you use some variables that can't be serialized.

I think that there is another problem, because i've already stored the object in the database. The problem is when Hibernate try to deserialize the object.

Which is the best way to map an serializable java object to a column of type BLOB (using Oracle)?

Thanks!
Elio


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 3:28 pm 
Newbie

Joined: Wed Jul 14, 2004 7:25 am
Posts: 3
Hi all!

Is there any known problem about serializing java object to oracle BLOB column? what can i do to try solve this problem?

Any sugestions are helpful.

Thanks!
Elio


Top
 Profile  
 
 Post subject: did u find a solution to this problem
PostPosted: Mon Aug 21, 2006 7:52 am 
Newbie

Joined: Tue Aug 08, 2006 3:50 pm
Posts: 4
did u find a solution to this problem
i am having the same problem.

it would be great if you can post the solution

thanks in advance
ahuja ji


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 8:02 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
couldnt find a problem with the code except that your class is not tagged as serializable . and u seems to be using hibernate prior to version 3 (ie, 2.x) (guesse from the package name).please try to upgrade to latest version , as it is much much more improved than the version u are using .

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.