Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoClassDefFoundError: org/dom4j/DocumentException dom4j-1.6.1.jar added Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Maybe a stupid question but is the dom4j-1.6.1.jar in your WEB-INF/lib directory?

    Comment


    • #3
      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

      Comment


      • #4
        Hi

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

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


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

              Comment


              • #8
                avoid spring-2.5.jar

                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

                Comment

                Working...
                X