aspose file tools*
The moose likes JSF and the fly likes  java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark " java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory" Watch " java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory" New topic
Author

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

Suraj Shekar
Greenhorn

Joined: Jul 25, 2002
Posts: 11
Hi I am new to JSF. I am reading the Core JavaServer Faces 2nd edition book. I was trying the tutorial example from chapter 8 (book-viewer-tiles) project. When I tried to run the application I get the below mentioned exception. Would anyone please help me to resolve this. I am using
Apache Tomcat 6.0.18
JDK 1.6.0.11
JSF 1.2
eclipse 3.4

The files in lib folder under tomcat
annotations-api.jar
catalina.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
el-api.jar
jasper.jar
jasper-el.jar
jasper-jdt.jar
jsp-api.jar
jstl-1.2.jar
server-api.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:468)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

Thanks for the help
Suraj
Daniel Reznick
Ranch Hand

Joined: Oct 23, 2008
Posts: 50

I think your missing one of the following file ( not all together )

commons-logging.jar, commons-logging-api.jar or log4-1.2.11.jar

Try getting it from here Apache commons logging home



Daniel.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
As the classname already hints, it's commons-logging. Get it from http://commons.apache.org/logging
Suraj Shekar
Greenhorn

Joined: Jul 25, 2002
Posts: 11
Thanks for the response. I added the following jar files
commons-logging-1.1.1
commons-logging-adapters-1.1.1
commons-logging-api-1.1.1

Now I see the following exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Can't get definitions factory from context.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:468)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)


Thanks for the help
Suraj
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You have crossposted this question at the Sun forum.
Please read this: http://faq.javaranch.com/java/BeForthrightWhenCrossPostingToOtherSites
Suraj Shekar
Greenhorn

Joined: Jul 25, 2002
Posts: 11
Hi Bauke,
Sorry about the cross posting. As I was not able to get my error resolved, I thought I might get some more feedback from a different(sun) java forum.

Suraj
Ashraf Abu-Aisheh
Ranch Hand

Joined: Apr 17, 2009
Posts: 88
Hi all,
I got the same exception, from the same book code,

Hi I am new to JSF. I am reading the Core JavaServer Faces 2nd edition book. I was trying the tutorial example from chapter 8 (book-viewer-tiles) project. When I tried to run the application I get the below mentioned exception. Would anyone please help me to resolve this. I am using
Apache Tomcat 6.0.18



Can anyone help us please


SCJP 5 - 79%
SCWCD 5 - 100%
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

Apparently this comes from Tiles, based on what I see in Google. Tiles and I never did get along. These days I use Facelets to do my tiling.

From what I could deduce, there may be a problem in your tiles definition file, possible malformed XML. One reporter said the problem went away when he changed "Fun & games" to "Fun Games", and that one would certainly be bad XML - you need to code it as "Fun & Games" using the XML entity escape.

I would really have expected to see more stack trace info, though.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ashraf Abu-Aisheh
Ranch Hand

Joined: Apr 17, 2009
Posts: 88
The stack trace is:


and the tiles.xml is:

and the book.jsp is:

and the headerMenuContentLayout.jsp is:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

Not exactly going out of their way to help you, are they?

Take a look at your tiles:insert tags. As near as I can tell, one of them's trying to insert a resource that it can't find.
 
 
subject: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory