-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate with Websphere server
PostPosted: Tue Nov 14, 2006 4:43 pm 
Newbie

Joined: Tue Nov 14, 2006 3:44 pm
Posts: 5
Hi,

I am developing a simple Hibernate code to run on a websphere portal server 5.1.0.1. I took the sample from Hibernate tutorial and when ran as a java program it works fine. But running on the server it is giving a class not found and give me an exception:

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration

In my config file I tried running using either the JDBC url or using datasource. But none of them works. The code goes to the catch block when it comes to SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

Hibernate version: 3.2

Mapping documents:
<session-factory>

<!-- Database connection settings -->
<!-- <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property> -->

<!-- <property name="connection.url">jdbc:hsqldb:hsql://localhost</property>
<property name="connection.url">jdbc:db2://localhost:50000/SAMPLE</property> -->

<property name="hibernate.connection.datasource">java:/comp/env/jdbc/test</property>

<property name="connection.username">db2admin</property>
<property name="connection.password">db2admin</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property>

<!-- SQL dialect -->
<!-- <property name="dialect">org.hibernate.dialect.HSQLDialect</property> -->
<property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>

<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping resource="events/Event.hbm.xml"/>


</session-factory>


Code between sessionFactory.openSession() and session.close():
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();

Event theEvent = new Event();
theEvent.setTitle(title);
theEvent.setDate(theDate);

session.save(theEvent);

session.getTransaction().commit();

session.close();



Full stack trace of any exception that occurs:

R Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
[11/14/06 15:11:28:649 EST] 11df11df SystemErr R java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
[11/14/06 15:11:28:978 EST] 11df11df SystemErr R at java.lang.Throwable.<init>(Throwable.java:59)
[11/14/06 15:11:28:978 EST] 11df11df SystemErr R at java.lang.Throwable.<init>(Throwable.java:73)
[11/14/06 15:11:28:978 EST] 11df11df SystemErr R at java.lang.Class.initialize(Class.java:318)
[11/14/06 15:11:28:978 EST] 11df11df SystemErr R at testhibernate.TestHibernatePortlet.doView(TestHibernatePortlet.java)

Name and version of the database you are using: DB2 Express C

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 5:05 pm 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
You are missing the Hibernate JARs in your Classpath. Please check your Classpath.

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 5:36 pm 
Newbie

Joined: Tue Nov 14, 2006 3:44 pm
Posts: 5
Hi Mike,

Thanks for replying. I added the Jars file in the WEB-INF -> lib folder and also to project ->Properties-> Java Build Path added all the libraries.

Is there any other way to add class path while running inside RAD 6.0

Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 6:21 pm 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
well that should it be... IMHO RAD and WebSphere are crap.

Sorry but all I can tell you that it is obvious that you are missing the jars in your CP.

_________________
Please don't forget to rate


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