Results 1 to 8 of 8

Thread: java.lang.NoClassDefFoundError: org/dom4j/DocumentException dom4j-1.6.1.jar added

  1. #1
    Join Date
    Aug 2006
    Posts
    17

    Default 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
    org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    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

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    Maybe a stupid question but is the dom4j-1.6.1.jar in your WEB-INF/lib directory?
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Aug 2006
    Posts
    17

    Default

    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

  4. #4
    Join Date
    Aug 2006
    Posts
    17

    Default

    Hi

    I solved the problem by modifing the build.xml file. Thx mdeinum for your help

  5. #5
    Join Date
    Jun 2012
    Posts
    2

    Default

    Hi there,
    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

  6. #6
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    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.

  7. #7
    Join Date
    Jun 2012
    Posts
    2

    Default

    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.. ."

  8. #8
    Join Date
    Mar 2012
    Posts
    1

    Default avoid spring-2.5.jar

    Quote Originally Posted by justin_lzy View Post
    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.. ."
    NoClassDefFoundError: org/dom4j/DocumentException


    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •