-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate2.1 cause WLS 8.1 SP4Server JVM crash
PostPosted: Tue Sep 06, 2005 12:49 pm 
Newbie

Joined: Tue Sep 06, 2005 11:05 am
Posts: 3
Hibernate version:2.1

JDK version:1.4.2_05

[b]Name and version of the database you are using:

Database Oracle 9i: JDBC 10G thin driver come with BEA 8.1 sp4

Short description of problem:
We use Hibernate inside BEA weblogic 8.1sp4 server try to import data of a master/detail structure record. lets said HeaderRecord/DetailRecord respectively. every time when we do the insert we first delete the old recod and then do the insert. this sound very simple process but it crash the whole BEA JVM when this process is running against 50 HeaderRecord with 1700 DetailRecord. Server is quite when we do the import.

We have ton of memory on this machine we assign 1G to JVM.

We work through BEA support team, we didn't get enough support from them because they think it is Hibernate native code cause this crash.

We painfully migrate the Hibernate to pure JDBC code it is now running on our production for more than three weeks without crash.

We are 99% sure at this moment the crash is related to Hibernate, we would like to ask someone here experience the same problem and could help us out.


Hibernate configure
Code:
<hibernate-configuration>

   <!-- a SessionFactory instance listed as /jndi/name -->
   <session-factory>

      <!-- properties -->
      <property name="connection.datasource">DBConnection</property>
      <property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
      <property name="show_sql">false</property>
      <property name="use_outer_join">false</property>
         <property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
         <property name="hibernate.cglib.use_reflection_optimizer">true</property>

      <property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
      <property name="jndi.url">t3://virtual-app:9001</property>

      <!-- mapping files -->
      
      <mapping resource="com/onlane/inspection/vis/DetailRecord.hbm.xml"/>
      <mapping resource="com/onlane/inspection/vis/HeaderRecord.hbm.xml"/>
      
   </session-factory>

</hibernate-configuration>



Mapping documents:
<mapping resource="com/onlane/inspection/vis/HeaderRecord.hbm.xml"/>
Code:
<hibernate-mapping>

    <class
        name="com.onlane.inspection.vis.HeaderRecord"
        table="ONL_STAGING_VIS_VEHICLE"
    >

        <id
            name="refID"
            column="REFID"
            type="java.lang.String"
            length="15"
        >
            <generator class="assigned">
            </generator>
        </id>

        <property
            name="recordType"
            type="string"
            update="false"
            insert="false"
            column="RECTYPE"
            length="1"
        />

        <property
            name="inspID"
            type="string"
            update="true"
            insert="true"
            column="INSPID"
            length="10"
        />

        <property
            name="status"
            type="string"
            update="true"
            insert="true"
            column="STATUSCODE"
            length="1"
        />

        <property
            name="reason"
            type="string"
            update="true"
            insert="true"
            column="REASONCODE"
            length="2"
        />

        <property
            name="apptDate"
            type="date"
            update="true"
            insert="true"
            column="APPTDATE"
            length="10"
        />

        <property
            name="contactLastname"
            type="string"
            update="true"
            insert="true"
            column="LASTNAME"
            length="40"
        />

        <property
            name="contactFirstname"
            type="string"
            update="true"
            insert="true"
            column="FIRSTNAME"
            length="20"
        />

        <property
            name="contactInitial"
            type="string"
            update="true"
            insert="true"
            column="MIDDLEINIT"
            length="1"
        />

        <property
            name="contactAddr1"
            type="string"
            update="true"
            insert="true"
            column="ADDR1"
            length="35"
        />

        <property
            name="contactAddr2"
            type="string"
            update="true"
            insert="true"
            column="ADDR2"
            length="35"
        />

        <property
            name="contactCity"
            type="string"
            update="true"
            insert="true"
            column="CITY"
            length="30"
        />

        <property
            name="contactState"
            type="string"
            update="true"
            insert="true"
            column="STATECODE"
            length="2"
        />

        <property
            name="contactZip"
            type="string"
            update="true"
            insert="true"
            column="ZIPCODE"
            length="5"
        />

        <property
            name="contactZipExt"
            type="string"
            update="true"
            insert="true"
            column="ZIPCODEPLUS"
            length="4"
        />

        <property
            name="contactPostalCode"
            type="string"
            update="true"
            insert="true"
            column="POSTALCODE"
            length="6"
        />

        <property
            name="contactCountry"
            type="string"
            update="true"
            insert="true"
            column="COUNTRYCODE"
            length="3"
        />

        <property
            name="custLastname"
            type="string"
            update="true"
            insert="true"
            column="CUSTLASTNAME"
            length="40"
        />

        <property
            name="custFirstname"
            type="string"
            update="true"
            insert="true"
            column="CUSTFIRSTNAME"
            length="20"
        />

        <property
            name="custInitial"
            type="string"
            update="true"
            insert="true"
            column="CUSTMIDDLEINIT"
            length="1"
        />

        <property
            name="VIN"
            type="string"
            update="true"
            insert="true"
            column="VIN"
            length="17"
        />

        <property
            name="year"
            type="java.lang.Short"
            update="true"
            insert="true"
            column="YEAR"
            length="4"
        />

        <property
            name="make"
            type="string"
            update="true"
            insert="true"
            column="MAKE"
            length="25"
        />

        <property
            name="model"
            type="string"
            update="true"
            insert="true"
            column="MODEL"
            length="25"
        />

        <property
            name="license"
            type="string"
            update="true"
            insert="true"
            column="VEHLICENSE"
            length="8"
        />

        <property
            name="stateCode"
            type="string"
            update="true"
            insert="true"
            column="VEHSTATECODE"
            length="2"
        />

        <property
            name="odometer"
            type="string"
            update="true"
            insert="true"
            column="ODOMETER"
            length="10"
        />

        <property
            name="testDrive"
            type="string"
            update="true"
            insert="true"
            column="TESTDRIVEN"
            length="1"
        />

        <property
            name="diagNeeded"
            type="string"
            update="true"
            insert="true"
            column="DIAGREQUIRED"
            length="1"
        />

        <property
            name="engineSize"
            type="string"
            update="true"
            insert="true"
            column="ENGINESIZE"
            length="20"
        />

        <property
            name="trim"
            type="string"
            update="true"
            insert="true"
            column="BODYTYPE"
            length="20"
        />

        <property
            name="transmission"
            type="string"
            update="true"
            insert="true"
            column="TRANSMISSION"
            length="20"
        />

        <property
            name="inspDate"
            type="date"
            update="true"
            insert="true"
            column="INSPDATE"
            length="10"
        />

        <property
            name="seriesName"
            type="string"
            update="true"
            insert="true"
            column="SERIESNAME"
            length="15"
        />

        <property
            name="extColour"
            type="string"
            update="true"
            insert="true"
            column="EXTCOLOUR"
            length="12"
        />

        <property
            name="driveDesc"
            type="string"
            update="true"
            insert="true"
            column="DRIVEDESC"
            length="20"
        />

        <property
            name="intColour"
            type="string"
            update="true"
            insert="true"
            column="INTCOLOUR"
            length="12"
        />

    </class>

</hibernate-mapping>


<mapping resource="com/onlane/inspection/vis/DetailRecord.hbm.xml"/>
Code:
<hibernate-mapping>

    <class
        name="com.onlane.inspection.vis.DetailRecord"
        table="ONL_STAGING_VIS_DETAIL"
    >

        <id
            name="recID"
            column="RECID"
            type="java.lang.String"
            length="32"
        >
            <generator class="uuid.hex">
             
            </generator>
        </id>

        <property
            name="refID"
            type="java.lang.String"
            update="true"
            insert="true"
            column="REFID"
            length="15"
        />

        <property
            name="recordType"
            type="string"
            update="false"
            insert="false"
            column="RECTYPE"
            length="1"
        />

        <property
            name="area"
            type="string"
            update="true"
            insert="true"
            column="AREA"
            length="25"
        />

        <property
            name="part"
            type="string"
            update="true"
            insert="true"
            column="part"
            length="25"
        />

        <property
            name="description"
            type="string"
            update="true"
            insert="true"
            column="description"
            length="25"
        />

        <property
            name="repair"
            type="string"
            update="true"
            insert="true"
            column="repair"
            length="1"
        />

        <property
            name="replace"
            type="string"
            update="true"
            insert="true"
            column="replace"
            length="1"
        />

        <property
            name="refinish"
            type="string"
            update="true"
            insert="true"
            column="refinish"
            length="1"
        />

        <property
            name="metalHrs"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="metalHrs"
            length="5"
        />

        <property
            name="paintHrs"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="paintHrs"
            length="5"
        />

        <property
            name="generalHrs"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="generalHrs"
            length="5"
        />

        <property
            name="labourCost"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="labourCost"
            length="10"
        />

        <property
            name="partsCost"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="partsCost"
            length="10"
        />

        <property
            name="wearAndTear"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            column="wearAndTear"
            length="10"
        />

        <property
            name="flag"
            type="string"
            update="true"
            insert="true"
            column="flag"
            length="1"
        />

    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
public class HibernateUtil {

private static Configuration   config = null;
    private static SessionFactory sessionFactory=null;
    private static Logger _log = LogFactory.getInstance(HibernateUtil.class);

    static {
        try {
            // Create the SessionFactory
            config = new Configuration().configure();
            sessionFactory = config.buildSessionFactory();
        } catch (HibernateException ex) {
            LogFactory.getInstance(HibernateUtil.class).error("Configuration problem: " + ex.getMessage(), ex);
        }
        System.err.println( "HibernateUtil: static initializer: session factory = '" +
          sessionFactory + "'" );
    }

    public static final ThreadLocal session = new ThreadLocal();

    public static Session currentSession() throws HibernateException {
        Session s = (Session) session.get();
        // Open a new Session, if this Thread has none yet
        if (s == null || !s.isOpen()) {
           if( sessionFactory == null )
              throw( new HibernateException( "HibernateUtil: currentSession: sessionFactory is null" ) );
            s = sessionFactory.openSession();
            session.set(s);
        }
        else if(!s.isConnected()){
            s.reconnect();
        }
        return s;
    }

    public static void closeSession() throws HibernateException {
        Session s = (Session) session.get();
        session.set(null);
        if (s != null){
            s.close();
        }

    }

   public static PersistentClass getPersistentClass( Class clazz ) {
      if( config == null )
         return( null );
      return( config.getClassMapping( clazz ) );
   }
}


My Hibernate client code
Code:
        Session session = null;
        Transaction transaction = null;
        try {
            session = HibernateUtil.currentSession();
            transaction = session.beginTransaction();
            //my code start here
       ...           
            //my code end here
            transaction.commit();
           
        } catch (HibernateException e) {
            try{ if (transaction != null) transaction.rollback();} catch (HibernateException ex){}
            _log.error("", e);
        }finally{
            try {HibernateUtil.closeSession();} catch (HibernateException e1) {}
        }


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is of course utter nonsense. Hibernate has no native code, and hence nothing that could cause a JVM crash.

Possibly it is the JDBC driver to blame, but it is certainly not Hibernate.


Top
 Profile  
 
 Post subject: Hibernate2.1 cause WLS 8.1 SP4Server JVM crash
PostPosted: Tue Sep 06, 2005 2:12 pm 
Newbie

Joined: Tue Sep 06, 2005 11:05 am
Posts: 3
gavin wrote:
This is of course utter nonsense. Hibernate has no native code, and hence nothing that could cause a JVM crash.

Possibly it is the JDBC driver to blame, but it is certainly not Hibernate.


Hi,Gavin

I totally agree with you that Hibernate is written 100% in pure java, but as you know when we migrate Hibernate code to pure JDBC code, this issue is gone, which at least means that regular JDBC code dosen't cause the server crash.

AS you imply, I can also open a support ticket to Oracle for JDBC driver issue, guess what might happen, they might blame either BEA or Hibernate because pure JDBC code work fine.
I know it doesn't help me to solve the problem neither dose it help the other people in this forum to bring up the question like we have.
Again I am not here to find someone to blame, instead I am trying to find someone that could help us out.

thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 2:47 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
Hi,

Any more information why the JVM crashes (OutOfMemoryError or such)?. Are there any javacore that could give any hint?

We had problems with "Hibernate crashing the JVM" (with OutOfMemoryError) in one of our projects - of course we were the problem ;-), but we had to review the code in details to understand what was going on (some stupidities with not closing the session...).

At the moment I can only wish good luck and recommend you to assume that the error is in your code until Hibernate's "guilt" is demonstrated ;-).

Erik


Top
 Profile  
 
 Post subject: Hibernate2.1 cause WLS 8.1 SP4Server JVM crash
PostPosted: Tue Sep 06, 2005 3:08 pm 
Newbie

Joined: Tue Sep 06, 2005 11:05 am
Posts: 3
ErikFK wrote:

Any more information why the JVM crashes (OutOfMemoryError or such)?.
Erik


Hi,Erik
JVM crashed abnormally, that is why it is really panic because we couldn't do the thread dumping, usually when we do analysis of thread dump we could pinpoint the root cause. but as you know when it happen abnormally none can get more detail out of JVM after it die.

I don't believe we have OutOfMemoryError like you mentioned on your preview project, I double check my code which close very session carefully.

Anyway thanks for you to share the information with us.

thanks,


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