-->
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.  [ 3 posts ] 
Author Message
 Post subject: NoClassDefFound in buildSessionFactory
PostPosted: Fri Jan 14, 2005 9:00 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 10:40 am
Posts: 37
Location: Belgium
Hibernate version: 2.1.7

Name and version of the database you are using:MySQL

J2ee server:Appserver of Sun

Hi,
I'm trying to use hibernate with j2ee and when I call the method buildsessionfactory, I get a classdefnotfound error. Here's a piece of the error:
Code:
Caused by: java.lang.NoClassDefFoundError
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:796)



For completeness a larger piece of error:
Code:
[#|2005-01-15T01:30:09.062+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|Use outer join fetching: true|#]

[#|2005-01-15T01:30:09.062+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.connection.DriverManagerConnectionProvider|_ThreadID=16;|Using Hibernate built-in connection pool (not for production use!)|#]

[#|2005-01-15T01:30:09.062+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.connection.DriverManagerConnectionProvider|_ThreadID=16;|Hibernate connection pool size: 1|#]

[#|2005-01-15T01:30:09.062+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.connection.DriverManagerConnectionProvider|_ThreadID=16;|using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/ruleengine|#]

[#|2005-01-15T01:30:09.062+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.connection.DriverManagerConnectionProvider|_ThreadID=16;|connection properties: {user=root, password=stijnderoo}|#]

[#|2005-01-15T01:30:09.078+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.transaction.TransactionManagerLookupFactory|_ThreadID=16;|No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)|#]

[#|2005-01-15T01:30:09.265+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|Use scrollable result sets: true|#]

[#|2005-01-15T01:30:09.265+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|Use JDBC3 getGeneratedKeys(): true|#]

[#|2005-01-15T01:30:09.265+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|Optimize cache for minimal puts: false|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|echoing all SQL to stdout|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|Query language substitutions: {no='N', true=1, yes='Y', false=0}|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|cache provider: net.sf.hibernate.cache.EhCacheProvider|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.SettingsFactory|_ThreadID=16;|query cache factory: net.sf.hibernate.cache.StandardQueryCacheFactory|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|net.sf.hibernate.cfg.Configuration|_ThreadID=16;|instantiating and configuring caches|#]

[#|2005-01-15T01:30:09.281+0100|INFO|sun-appserver-pe8.1|javax.enterprise.system.container.ejb|_ThreadID=16;|EJB5070: Exception creating stateless session bean : [{0}]
java.lang.reflect.InvocationTargetException
   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 com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:410)
   at com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:75)
   at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:597)
   at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
   at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
   at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
   at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
   at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:126)
   at $Proxy23.addRule(Unknown Source)
   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 com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:167)
   at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
   at ejb._RuleEngineEJB_DynamicStub.addRule(_RuleEngineEJB_DynamicStub.java)
   at org.apache.jsp.RuleEngineClient_jsp._jspService(RuleEngineClient_jsp.java:92)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
   at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
   at java.security.AccessController.doPrivileged(Native Method)
   at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
   at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
   at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
   at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
   at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:184)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
   at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
   at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Caused by: java.lang.NoClassDefFoundError
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:796)
   at ejb.RuleEngineEJBBean.ejbCreate(RuleEngineEJBBean.java:150)
   ... 55 more
|#]


Sorry, I posted this message in the wrong forum. That's why I post It here again.

Thanks in advance...


Top
 Profile  
 
 Post subject: Re: NoClassDefFound in buildSessionFactory
PostPosted: Fri Jan 14, 2005 10:03 pm 
Newbie

Joined: Tue Sep 14, 2004 5:57 pm
Posts: 6
Location: Sunnyvale
Configuration.java:796 is

return new SessionFactoryImpl(this, settings);

So if you got NoClassDef here, that would suggest that the class net.sf.hibernate.impl.SessionFactoryImpl was not found in your classpath (and the call was done through reflection, so it became a runtime problem.) Very strange given that both it and the Configuration interface are in the hibernate jar.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 17, 2005 1:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
SessionFactoryImpl is not the problem.
Be sure to read and follow the lib/readme.txt
esp odmg and ehcache are required in you CP

_________________
Emmanuel


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