Search code examples
jsptomcatservletstomcat7

tomcat was working properly but don't know what went wrong?


I had just started working with tomcat and was working well,however since yesterday i am facing trouble in starting it.I have re-installed it too.the error report i got in its log file is posted below.....

Blockquote

   2013-01-01 19:10:21 Commons Daemon procrun stderr initialized
   java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:60)
   Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 1 more

Exception in thread "main"


Solution

  • actually i copied the libraries from tomcat into the ext folder of jdk..

    You shouldn't be doing that. It causes a classloading disaster. You should not move/copy/change servletcontainer's own libraries. You should untouch them and never drop arbitrary JARs which are not in any way related to Java SE in the JRE/JDK /lib or /lib/ext folder. Cleanup those folders.

    On a related note, even though you seem to not have done that, you should also not be placing servletcontainer-specific JAR files in webapp's /WEB-INF/lib folder.

    This is a common starter's mistake in order to circumvent compilation errors on JSP/Servlet APIs or to "simplify" compilation without fiddling with %CLASSPATH% or -cp/-classpath. If you're using an IDE like Eclipse/Netbeans, then you should actually have registered the server runtime in the IDE and associated it with the web project as "target runtime". If you're using plain javac, then you should actually have used -cp/-classpath argument to specify the servletcontainer-specific JAR files for compile. To abstract that further away in order to avoid retyping the whole classpath value, you should just have placed the command in a reusable .bat or .cmd file or just have a decent build tool like Maven, Gradle or even an IDE like Eclipse/Netbeans.

    See also: