Aug 29th, 2006, 09:28 AM
java.lang.NoClassDefFoundError: org/dom4j/DocumentException dom4j-1.6.1.jar added
Hi from newbie
I'm having this error:
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'pkg.bean.ServiceLocatorBean'.. class pkg.bean.ServiceLocatorBean : org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFac toryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
I keep reciving this error though that i've added the dom4j-1.6.1.jar to the project. Any idea why?
I'm using JSF 1.2 Spring 1.2.8. Hibernate 3.1
Thx for any kind of help
Aug 29th, 2006, 09:47 AM
Maybe a stupid question but is the dom4j-1.6.1.jar in your WEB-INF/lib directory?
Aug 31st, 2006, 01:26 AM
Hi from newbie
Yes my dom4j-1.6.1.jar file is in the WEB-INF\lib as well as in common\lib under tomcat dir. I've also added it via the eclipse package manager. That's why it's so strange for me that the package couldn't be found.
Thx for any help
Aug 31st, 2006, 02:03 AM
I solved the problem by modifing the build.xml file. Thx mdeinum for your help
Jun 29th, 2012, 07:39 AM
I have the same problem. Can you tell me how you fixed it. I mean how did you modify the build.xml.
Thx for reply
Jul 2nd, 2012, 02:29 AM
Since the dom4j is already inside Tomcat's common libs, you shouldn't add it to your web-inf/lib folder. Alien01 probably solved by excluding the jar from the ant build copy command.
Jul 2nd, 2012, 09:01 AM
Thx Enrico.I didn't use Tomcat but Glassfish instead. I found the solution this morning. Just like you mentioned,it's in Tomcats'libs,but not in Glassfish's.So I added it into the lib also others jars. That could solve all the problems about "java.lang.NoClassDefFoundError:...Exception.. ."
Sep 4th, 2012, 03:05 PM
Originally Posted by justin_lzy
if you put your sessionFactory (org.springframework.orm.hibernate3.LocalSessionFa ctoryBean), dataSource, DAO beans etc.,
you will need spring-2.5.jar (to avoid ClassNotFoundException: org.springframework.orm.hibernate3.LocalSessionFac toryBean)
But if you put spring-2.5.jar in your lib/global, you get .NoClassDefFoundError: org/dom4j/DocumentException
which is will lead down the path tp nowhere