eclipse java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1392383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
提问by Sean R
I have actually figured this problem out, but it took me days, so I thought I would paste my solution here to aide others.
我实际上已经解决了这个问题,但我花了几天时间,所以我想我会在这里粘贴我的解决方案来帮助其他人。
I am using Fedora 11, and in Eclipse I tried adding a Tomcat 6 server and starting it. I would get the following error:
我使用的是 Fedora 11,在 Eclipse 中我尝试添加一个 Tomcat 6 服务器并启动它。我会收到以下错误:
'Starting Tomcat v6.0 Server at localhost' has encountered a problem.
Server Tomcat v6.0 Server at localhost failed to start.
'Starting Tomcat v6.0 Server at localhost' 遇到问题。
Server Tomcat v6.0 Server at localhost 启动失败。
Then in my console I got the following:
然后在我的控制台中,我得到以下信息:
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.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
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
I'll post the solution in an answer below.
我将在下面的答案中发布解决方案。
回答by Sean R
I found the solution here: http://forums.opensuse.org/applications/391114-tomcat6-eclipse-not-working.html
我在这里找到了解决方案:http: //forums.opensuse.org/applications/391114-tomcat6-eclipse-not-working.html
- In Eclipse, Open the "Server" tab.
- Double click on the "Tomcat6" entry to see the configuration.
- Then click on the "Open launch configuration" link in the "General information" block.
- In the dialog, select the "Classpath" tab.
- Click the "Add external jar" button.
- Select the file "/usr/share/tomcat6/bin/tomcat-juli.jar"
- Close the dialog.
- Start tomcat 6 from Eclipse.
- 在 Eclipse 中,打开“服务器”选项卡。
- 双击“Tomcat6”条目以查看配置。
- 然后单击“常规信息”块中的“打开启动配置”链接。
- 在对话框中,选择“类路径”选项卡。
- 单击“添加外部 jar”按钮。
- 选择文件“/usr/share/tomcat6/bin/tomcat-juli.jar”
- 关闭对话框。
- 从 Eclipse 启动 tomcat 6。
Hopefully posting it here will help some poor soul.
希望张贴在这里能帮助一些可怜的人。
回答by Sandor Takats
I copied the contents of the "C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf" directory to the "workspace\Servers\Tomcat v6.0 Server at localhost-config" directory for Eclipse. I refreshed the "Servers\Tomcat v6.0 Server at localhost-config" folder in the Eclipse Project Explorer and then everything was good.
我将“C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf”目录的内容复制到 Eclipse 的“workspace\Servers\Tomcat v6.0 Server at localhost-config”目录。我刷新了 Eclipse 项目资源管理器中的“Servers\Tomcat v6.0 Server at localhost-config”文件夹,然后一切正常。
回答by bioinfornatics
install tomcat
# yum install tomcat6*
edit tomcat conf file
# vim /etc/tomcat6/tomcat-users.xml
安装tomcat
# yum 安装 tomcat6*
编辑tomcat conf文件
# vim /etc/tomcat6/tomcat-users.xml
something like:
就像是:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="TomcatAdmin" password="tomcat" roles="admin,manager"/>
</tomcat-users>
create root directory for your J2EE project, example:
$ mkdir -p ~/Project/java/
do symbolic link, /usr/share/tomcat6/webapps/ to ~/Project/java/
# ln -s /home//Project/java//dist/.war /usr/share/tomcat6/webapps/.war
为您的 J2EE 项目创建根目录,例如:
$ mkdir -p ~/Project/java/
做符号链接,/usr/share/tomcat6/webapps/ 到 ~/Project/java/
# ln -s /home//Project/java//dist/.war /usr/share/tomcat6/webapps/.war
Note: war archive file is created automatcaly when you use netbeans
注意:使用 netbeans 时会自动创建 war 存档文件
0r you can do:
0r 你可以这样做:
# ln -s /home/<login>/Project/java/<myProject>/webapps /usr/share/tomcat6/webapps/<myProject>
check /etc/hosts file, this file must contain the machine name, mine hosts file
jonathan 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
start httpd service
# service httpd start
check loclahost web page
start tomcat6
# service tomcat6 start
check localhost:8080 web page
check that tomcat show your project
if not:- check symbolic link and restart tomcat6 service
- or add manualy with tomcat manager web page
a) Set project name
b) Se path to web.xml file
c) Valid
d) start your project (from web page)
检查/etc/hosts文件,这个文件必须包含机器名,我的hosts文件
乔纳森 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
启动httpd服务
# 服务 httpd 启动
检查 loclahost 网页
启动tomcat6
# 服务 tomcat6 启动
检查本地主机:8080 网页
如果没有,请检查 tomcat 是否显示您的项目:- 检查符号链接并重启 tomcat6 服务
- 或使用 tomcat manager 网页手动添加
a) 设置项目名称
b ) 设置web.xml 文件的路径
c) 有效
d) 启动您的项目(从网页)
for fedora 13 and under they are some problem, how fix it:
对于 Fedora 13 及以下版本,它们存在一些问题,如何解决:
# chmod -R g+w /var/log/tomcat6 /etc/tomcat6/Catalina
# chmod -R g+w /usr/share/tomcat6/work/
check in log files located in /var/log/tomcat6/ if they are anymore "permission denied" message
检查位于 /var/log/tomcat6/ 中的日志文件,如果它们不再是“权限被拒绝”消息
回答by bioinfornatics
aforementioned solutions did not help me, I could solve it by re-installing the Tomcat server which took few seconds.
上述解决方案对我没有帮助,我可以通过重新安装花了几秒钟的 Tomcat 服务器来解决它。
回答by Naushin Shaikh
On my PC I had to open the Tomcat6 entry again after the 7th step mentioned above and then change the default option under Server locations
to Use tomcat installation
.
在我的 PC 上,我必须在上述第 7 步之后再次打开 Tomcat6 条目,然后将默认选项更改Server locations
为Use tomcat installation
.