Fedora 9: NoClassDefFoundError (LogFactory) starting Tomcat from Fedora Eclipse
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fedora 9: NoClassDefFoundError (LogFactory) starting Tomcat from Fedora Eclipse

    I feel silly asking this question. I'm not totally a Tomcat/Eclipse/Java noob...but I feel like one asking this question. And Google's even my BFF...but I can't figure this one out...yet.

    I have a brand new clean installation of Fedora 9.
    I let the installer automagically install Fedora Eclipse, Tomcat and Java for me.
    I'm fully patched (yum update).
    Then I installed the Sysdeo Tomcat plugin. From the plugin I pointed to Tomcat base: /usr/share/tomcat5

    When I launch Tomcat, I get the following error:
    Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    	at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
    	... 1 more
    Here is the output from the instructions listed on this page:
    http://fedoraproject.org/wiki/DebuggingEclipseProblems

    Code:
    # for f in `rpm -aq | egrep "eclipse|swt"`; do rpm -qV $f; done
    # which java
    /usr/bin/java
    # readlink -f `which java`
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/bin/java
    # which javac
    /usr/bin/javac
    # readlink -f `which javac`
    /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
    # java -version
    java version "1.6.0"
    OpenJDK  Runtime Environment (build 1.6.0-b09)
    OpenJDK Client VM (build 1.6.0-b09, mixed mode)
    Now here's where it got really interesting. Since it was complaining about LogFactory, I located it inside /usr/share/tomcat5/bin/commons-logging-api.jar

    So, just for grins, I unjar'ed the contents of:
    /usr/share/tomcat5/bin/bootstrap.jar
    and
    /usr/share/tomcat5/bin/commons-logging-api.jar

    Then I jar'ed all of the contents of those two jar files back into:
    /usr/share/tomcat5/bin/bootstrap.jar

    And now I can launch Tomcat just fine.
    What gives? Is this a Fedora configuration problem? I don't even know how to proceed from here to clean up this mess. I'd really like to not launch Tomcat using jar files that I've hacked together...just to get it to run.

  2. #2
    Join Date
    Dec 2004
    Location
    Slovenia
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tomcat 6

    I have installed tomcat 6, with:
    PHP Code:
    yum install tomcat6 
    Then I have started it with:
    PHP Code:
    /etc/init.d/tomcat6 start 
    And my Hello World works

    The only strange thing that I have noticed is, that localhost:8080/admin isn't working and that there is no ROOT directoy in /usr/share/tomcat6/webapps ??

    Does anyone know why ?
    Last edited by messner; 21st May 2008 at 09:12 AM.

  3. #3
    Join Date
    Nov 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I went ahead and installed tomcat6 and pointed everything over to that. Tomcat (both 5 and 6) run fine when launched as messner mentioned. But my problem is launching it from Eclipse.

    So here's the output when launching Tomcat6. The location of LogFactory has moved...into the juli package:

    Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
    	at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
    Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
    	... 1 more
    This time I was able to combine the contents of /usr/share/tomcat6/bin's:
    bootstrap.jar and tomcat-juli.jar --> bootstrap.jar as my much-hated workaround.

  4. #4
    Lord Kada Guest
    I have a simple workaround (simpler than merging bootstrap.jar and commons-logging-api.jar)..

    I investigated a little more and it seems that the META-INF/MANIFEST.MF file in the bootstrap.jar contains a broken reference to the commons-logging-api.jar... In fact mine contains:

    Class-Path: jmx.jar commons-daemon.jar commons-logging-api-1.1.1.jar tomcat-juli.jar
    So I solved the problem by simply creating a symbolic link named commons-logging-api-1.1.1.jar within the tomcat5 bin directory:

    /usr/share/tomcat5/bin>
    ln -s commons-logging-api.jar commons-logging-api-1.1.1.jar
    I hope this helps you..

    PS: by the way I don't know why tomcat5 starts regularly within a shell...

    bye bye

  5. #5
    Join Date
    Nov 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting tweak. Thanks, Lord Kada. However, that same tweak doesn't work for tomcat6. There is no Class-Path element in the META-INF/MANIFEST.MF file inside tomcat6's bootstrap.jar.

    This is the entire contents of that file:
    Code:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 1.6.0-b08 (Sun Microsystems Inc.)
    Main-Class: org.apache.catalina.startup.Bootstrap
    Specification-Title: Catalina
    Specification-Version: 6.0

  6. #6
    Lord Kada Guest
    hmmm...

    why don't you try to edit it adding the "Class-Path" entry??

    Be sure to add all your .jar within the bin directory...

    My MANIFEST (tomcat5) looks like this:

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 4.3.0 20080130 (Red Hat 4.3.0-0.7) (Free Software Foundati
    on, Inc.)
    Main-Class: org.apache.catalina.startup.Bootstrap
    Specification-Title: Catalina
    Specification-Version: 1.0
    Class-Path: jmx.jar commons-daemon.jar commons-logging-api-1.1.1.jar t
    omcat-juli.jar
    Could be an interesting experiment..

    LK

  7. #7
    Join Date
    Nov 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm...well that worked. It's a slightly less annoying workaround. I added this to the manifest.

    Code:
    Class-Path:  bootstrap.jar tomcat-juli.jar
    Now where can I report this to get it fixed in the source?

  8. #8
    Lord Kada Guest
    Should be here...

    http://tomcat.apache.org/bugreport.html

    but I'm not sure..

  9. #9
    Otto42 Guest
    Quote Originally Posted by GregJo
    Hmmm...well that worked. It's a slightly less annoying workaround. I added this to the manifest.

    Code:
    Class-Path:  bootstrap.jar tomcat-juli.jar
    Now where can I report this to get it fixed in the source?
    Thank you! I had this same problem with Eclipse and Tomcat6 in Fedora 10, and rebuilding the bootstrap.jar file with this extra Class-Path solved the problem.

    Of course, for Eclipse to be happy, I also had to create a symlink in /usr/share/tomcat6 from servlet-api.jar to ../tomcat6-servlet-2.5-api-6.0.18.jar as well. But the combination of those two worked and now it runs web services properly.

Similar Threads

  1. setup eclipse to use tomcat on fedora 10
    By unimow in forum Using Fedora
    Replies: 2
    Last Post: 16th December 2008, 07:14 PM
  2. Error starting Tomcat with jsvc on Fedora 8
    By evoges in forum Using Fedora
    Replies: 0
    Last Post: 12th June 2008, 11:37 AM
  3. Replies: 6
    Last Post: 11th October 2005, 01:58 PM
  4. Replies: 3
    Last Post: 6th January 2005, 01:29 AM

Tags for this Thread

Posting Permissions

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