-->
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.  [ 2 posts ] 
Author Message
 Post subject: could not deserialize caused by StreamCorruptedException
PostPosted: Mon Mar 06, 2006 5:43 pm 
Newbie

Joined: Thu Aug 11, 2005 12:11 pm
Posts: 8
Hibernate version: 3.0.3

Mapping documents:
Code:
<hibernate-mapping>
    <class name="com.xxx.vo.TableClass" table="TABLE_CLASS">
        <id name="id" type="java.math.BigDecimal">
            <column name="ID" precision="22" scale="0" />
            <generator class="assigned" />
        </id>
        <many-to-one name="tableClassType" class="com.xxx.vo.TableClassType" fetch="select">
            <column name="COLUMN1_TYPE" precision="22" scale="0" not-null="true" />
        </many-to-one>
        <many-to-one name="tableClassType2" class="com.xxx.vo.tableClassType" fetch="select">
            <column name="COLUMN2_TYPE" precision="22" scale="0" not-null="true" />
        </many-to-one>
        <property name="FKId" type="java.math.BigDecimal">
            <column name="F_K_ID" precision="22" scale="0" not-null="true" />
        </property>
        <property name="name" type="java.lang.String">
            <column name="NAME" length="99" not-null="true" />
        </property>
        <property name="description" type="java.lang.String">
            <column name="DESCRIPTION" />
        </property>
        <property name="path" type="java.lang.String">
            <column name="PATH" />
        </property>
        <property name="dateCreated" type="java.util.Date">
            <column name="DATE_CREATED" length="7" />
        </property>
        <property name="createdBy" type="java.lang.String">
          <column name="CREATED_BY" length="20"/>
        </property>
        <property name="objectData" type="java.io.Serializable">
            <column name="OBJECT_DATA" />
        </property>
    </class>
   
    <sql-query name="getTableClassByFKId">
      <return alias="alias_x" class="com.xxx.vo.TableClass"/>
      <![CDATA[
        SELECT {alias_x.*} FROM TABLE_CLASS alias_x WHERE F_K_ID = :fkId ORDER BY NAME
      ]]>
    </sql-query>

Hibernate Object Mapped to:
Code:
public class TableClass  implements java.io.Serializable {
  private BigDecimal id;
  private tableClassType tableClassByTableClassType;
  private tableClassType tableClassByTableClassType2;
  private BigDecimal fkId;
  private String fileName;
  private String description;
  private String path;
  private Date dateCreated;
  private String createdBy;
  private Serializable objectData;
...
}


Full stack trace of any exception that occurs:
Code:
org.hibernate.type.SerializationException: could not deserialize
     at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
     at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234)
     at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
     at org.hibernate.type.SerializableType.get(SerializableType.java:39)
     at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
     at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
     at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
     at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1680)
     at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:958)
     at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:909)
     at org.hibernate.loader.Loader.getRow(Loader.java:822)
     at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:297)
     at org.hibernate.loader.Loader.doQuery(Loader.java:395)
     at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
     at org.hibernate.loader.Loader.doList(Loader.java:1562)
     at org.hibernate.loader.Loader.list(Loader.java:1545)
     at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:103)
     at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1406)
     at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:151)
     at com.xxx.dao.DAO.getTableClassByFKId(DAO.java:30)
     at com.xxx.bo.Bo.getTableClassByFKId(Bo.java:23)
     at com.xxx.actions.portlets.Main.searchRequestbyID(Main.java:689)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.fireEvent(PortletActionEvent.java:176)
     at org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.executeEvents(PortletActionEvent.java:133)
     at org.apache.jetspeed.modules.actions.portlets.GenericMVCAction.perform(GenericMVCAction.java:115)
     at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
     at org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:143)
     at org.apache.turbine.modules.Page.build(Page.java:90)
     at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
     at org.apache.turbine.Turbine.doGet(Turbine.java:563)
     at org.apache.turbine.Turbine.doPost(Turbine.java:658)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at com.xxx.hibernate.persistence.HibernateFilter.doFilter(HibernateFilter.java:53)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
     at java.lang.Thread.run(Unknown Source)
Caused by: java.io.StreamCorruptedException: invalid stream header
     at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
     at java.io.ObjectInputStream.<init>(Unknown Source)
     at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:246)
     at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:203)
     ... 64 more

Name and version of the database you are using: Oracle 9.2.0.7


The generated SQL (show_sql=true):
Code:
SELECT alias_x.ID as ID0_,
       alias_x.COLUMN1_TYPE as COLUMN2_43_0_,
       alias_x.COLUMN2_TYPE as COLUMN3_43_0_,
       alias_x.F_K_ID as FK4_43_0_,
       alias_x.NAME as NAME5_43_0_,
       alias_x.DESCRIPTION as DESCRIPT6_43_0_,
       alias_x.PATH as PATH43_0_,
       alias_x.DATE_CREATED as DATE8_43_0_,
       alias_x.CREATED_BY as CREATED9_43_0_,
       alias_x.OBJECT_DATA as OBJECT10_43_0_
FROM TABLE_CLASS alias_x
WHERE F_K_ID = ?
ORDER BY NAME


Alrighty, I've looked in the docs, annotations, tutorial, and the forums, and cannot find a solution to my specific problem.

What I'm looking at, as specified above, is that I have a Serializable datatype mapped to a Serializable type in the hibernate object, comming from a Blob in the Oracle database. I am able to enter data into the database using Hibernate fine, but when I execute the query to return a collection/list of hibernate objects containing the Serializable object, it gives me teh "could not deserialize" error with the root cause of a java.io.StreamCorruptedException when it goes to initilize the CustomeObjectInputStream object using the input stream passed to the deserialize method.

I really have no idea why its complaining about this Serializable object, since it should be creating the ByteArrayInputStream properly from the generated Byte array from Hibernate.BINARY.get(rs, name); The header shouldn't be corrupt, should it?

I've tinkered with the mapping document and the datatypes to no avail, and the last state given here, is the most recent (moving from hibernate types to java types, and removing a many-to-one mapping for a fk that I had mannually put into the mapping that was not generated using the Hibernate Tools).

I appreciate any and all help that can be given, and I thank you in advance for you time and information.


Top
 Profile  
 
 Post subject: Try the latest driver
PostPosted: Tue Aug 01, 2006 8:13 am 
Newbie

Joined: Wed Jul 26, 2006 2:48 am
Posts: 2
Location: Bangalore
I also faced similar issue.
I downloaded the latest Oracle Drivers (10G) and used it. The problem was resolved. May be you want to try that


JassonBourne

---If you find it useful, do rate the answer.

_________________
-------------------
Dont Try to be a man of importance.
Try to be a man of value.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.