HelloworldJsp中引入tomcat-juli处理

OS:centos66

eclipse jee-Mar.1

tomcat6

jdk1.8


找了一篇HelloworldJSP的文章来学习Jsp。

大体流程:

1 创建动态网页项目

2 增加jsp文件

系统自动协助创建了jsp内容。

3 编译执行。


编译执行出的错误如下,


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

    at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:55)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

    ... 1 more

错误是说org/apache/juli/logging/LogFactory没有找到。这个类在tomcat-juli.jar中,需要引入到ClassPath里面。

引入方法:

(由于本人的eclipse版本window-preferences-tomcat下没有tomcat4.0||tomcat5.0||tomcat6.0等版本信息)

1.在eclipse的project explorer的workspace上,有多个项目,包括HelloworldJsp,还有一个Servers项目。

选择Servers项目

2 右键有Run As, Debug As等菜单项,选择其中的Profiles as->Profile configurations...,会弹出Create, manage and run configuration选项卡

3 选中弹出的选项卡的Tomcat6->Classpath选项卡

4 在此选项卡的User Entries中,选择Add External jars,将/usr/share/tomcat6/bin/tomcat-juli.jar选入。

此后编译成功了。

这是结局。

Oct 20, 2015 9:45:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/lib64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Oct 20, 2015 9:45:58 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloWorldJsp' did not find a matching property.
Oct 20, 2015 9:45:58 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 20, 2015 9:45:58 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 394 ms
Oct 20, 2015 9:45:58 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 20, 2015 9:45:58 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Oct 20, 2015 9:45:58 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 20, 2015 9:45:58 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Oct 20, 2015 9:45:58 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/39  config=null
Oct 20, 2015 9:45:58 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 293 ms

参考:

1 http://blog.163.com/qiu_yin_good/blog/static/167329349201222754911818/

2 http://blog.csdn.net/lissdy/article/details/7424568




你可能感兴趣的:(HelloworldJsp中引入tomcat-juli处理)