-->
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: java.lang.NoClassDefFoundError
PostPosted: Sat Sep 04, 2004 6:21 am 
Newbie

Joined: Thu Aug 26, 2004 4:32 am
Posts: 2
Hibernate version:2.1

Mapping documents:<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>

<session-factory name="java:hibernate/HibernateFactory">

<property name="connection.datasource">java:comp/env/oozlooz/hibernate</property>
<property name="show_sql">true</property>



<!-- Settings for a remote MySQL database. -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">mysql://localhost/oozlooz</property>
<property name="connection.username">oozlooz</property>
<property name="connection.password">Jerich0</property>

<!-- Use the C3P0 connection pool. -->
<property name="c3p0.min_size">3</property>
<property name="c3p0.max_size">5</property>
<property name="c3p0.timeout">1800</property>

<!-- Use EHCache but not the query cache. -->
<property name="cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
<property name="cache.use_query_cache">false</property>
<property name="cache.use_minimal_puts">false</property>

<mapping resource="oozlooz/hbm/user.hbm.xml"/>

</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():Session sess=HibernateUtil.currentSession();
tx=sess.beginTransaction();

//Get the user class object referring to the table "user"
user uObj = new user();
//Create the query
Query query=sess.createQuery("SELECT count(userid) FROM user where username= :username");
query.setString("username",username);

//Iterate thorugh the result of this query.
//If it contains > 0 records, there is already a user registered
int userCount=0;
for( Iterator it=query.iterate() ; it.hasNext(); ){
userCount++;
}
if(userCount > 0) //User already Exists.
{
errors.add("user.exists", new ActionError("joinus.user.exists", username));
}

}catch(Exception e){
try{
e.printStackTrace();
if(tx!=null){ tx.rollback(); }
}catch(HibernateException he ){
he.printStackTrace();
}
}finally{
try{
HibernateUtil.closeSession();
}catch(HibernateException he ){
he.printStackTrace();
}


Full stack trace of any exception that occurs:2004-09-04 15:45:53 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
java.lang.NoClassDefFoundError
at oozlooz.forms.JoinForm.validate(JoinForm.java:71)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
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:117)
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:793)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:536)


Name and version of the database you are using:mysql-4

Debug level Hibernate log excerpt:-

--This is a very basic implementation of Hibernate that I am trying to do. I hve initialized context in Tomcat 5 server.xml and web.xml and copied the HibernateUtil.java code from example. I cant understand what is wrong with this.
Please show me the way !


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 6:56 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Make sure you use the latest HibernateUtil.java code from the documentation.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.