Tomcat运行正常,但不知道出了什么问题? [英] tomcat was working properly but don't know what went wrong?

查看:119
本文介绍了Tomcat运行正常,但不知道出了什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用tomcat,并且运行良好,但是从昨天开始,我在启动它时遇到了麻烦.我也重新安装了它.我在其日志文件中得到的错误报告发布在下面....

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

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

线程"main"中的异常

Exception in thread "main"

推荐答案

实际上我将库从tomcat复制到了jdk的ext文件夹中.

您不应该那样做.这会导致类加载灾难.您不应移动/复制/更改servlet容器自己的库.您应该取消触摸它们,并且切勿在JRE/JDK /lib/lib/ext文件夹中丢弃与Java SE没有任何关系的任意JAR.清理那些文件夹.

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.

在相关说明中,即使您似乎尚未这样做,也不应将servlet容器特定的JAR文件放置在webapp的/WEB-INF/lib文件夹中.

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.

这是一个常见的入门错误,目的是规避JSP/Servlet API上的编译错误,或简化"编译而无需摆弄%CLASSPATH%-cp/-classpath.如果使用的是Eclipse/Netbeans之类的IDE,则实际上应该已经在IDE中注册了服务器运行时,并将其与Web项目关联为目标运行时".如果使用的是普通javac,则实际上应该已经使用-cp/-classpath参数来指定要编译的servlet容器特定的JAR文件.为了进一步避免抽象化,以避免重新输入整个类路径值,您应该将命令放在可重复使用的.bat.cmd文件中,或者仅拥有像Ant,Ivy或Eclipse这样的IDE等不错的构建工具/Netbeans.

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 Ant, Ivy or even an IDE like Eclipse/Netbeans.

  • 如何可以在我的Eclipse项目中导入javax.servlet API吗?-如果您实际使用的是Eclipse
  • How do I import the javax.servlet API in my Eclipse project? - helpful if you're actually using Eclipse

这篇关于Tomcat运行正常,但不知道出了什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆