eclipse java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7955442/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:39:01  来源:igfitidea点击:

java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

eclipsetomcat

提问by Michael

Seem to have a problem starting my Java app:

启动我的 Java 应用程序时似乎有问题:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:37) Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more

线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:37) 由:java.lang.ClassNotFoundException: org. apache.juli.logging.LogFactory 在 java.net.URLClassLoader$1.run(URLClassLoader.java:366) 在 java.net.URLClassLoader$1.run(URLClassLoader.java:355) 在 java.security.AccessController.doPrivileged(Native Method) ) 在 java.net.URLClassLoader.findClass(URLClassLoader.java:354) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:423) 在 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 在 java .lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more

Tried the solution here: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

在这里尝试了解决方案: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

But I see tomcat-juli.jar already. Also I'm using Tomcat 7. What might be wrong?

但是我已经看到了 tomcat-juli.jar。此外,我正在使用 Tomcat 7。可能有什么问题?

采纳答案by Max Zerbini

Your vm does not find the class org/apache/juli/logging/LogFactorycheck if this class is present in the tomcat-juli.jar that you use (unzip it and search the file), if it's not present download the library from apache web site else if it's present put the tomcat-juli.jar in a path (the lib directory) that Tomcat use to load classes. If your Tomcat does not find it you can copy the jar in the lib directory of the JRE that you are using.

org/apache/juli/logging/LogFactory的虚拟机没有找到类检查这个类是否存在于你使用的 tomcat-juli.jar 中(解压它并搜索文件),如果它不存在,从 apache 网站下载库,否则如果它存在,把 tomcat -juli.jar 位于 Tomcat 用于加载类的路径(lib 目录)中。如果您的 Tomcat 没有找到它,您可以将 jar 复制到您正在使用的 JRE 的 lib 目录中。

回答by Kyle Krull

I ran into this problem when using tomcat-embed-core::7.0.47, from Maven. I'm not sure why they didn't add tomcat-utilas a runtime dependency, so I added my own runtime dependency to my own project.

我在使用tomcat-embed-core::7.0.47, from Maven时遇到了这个问题。我不确定他们为什么不添加tomcat-util为运行时依赖项,所以我将自己的运行时依赖项添加到我自己的项目中。

<dependency>
  <groupId>org.apache.tomcat</groupId>
  <artifactId>tomcat-util</artifactId>
  <version><!-- version from tomcat-embed-core --></version>
  <scope>runtime</scope>
</dependency>

回答by hertzsprung

This happened to me because I was using a Tomcat 5.5 catalina.shfile with a Tomcat 7 installation. Using the catalina.shthat came with the Tomcat 7 install fixed the problem.

这发生在我身上,因为我在catalina.shTomcat 7 安装中使用了 Tomcat 5.5文件。使用catalina.shTomcat 7 安装附带的解决了该问题。

回答by Prasad Bhimaraju

If you are using jsvc to run tomcat as tomcat (run /etc/init.d/tomcatas root), edit /etc/init.d/tomcatand add $CATALINA_HOME/bin/tomcat-juli.jarto CLASSPATH.

如果您使用 jsvc 以 tomcat 身份运行 tomcat(/etc/init.d/tomcat以 root身份运行),请编辑/etc/init.d/tomcat并添加$CATALINA_HOME/bin/tomcat-juli.jarCLASSPATH.

回答by StationaryTraveller

I had the same problem, What helped me was:

我遇到了同样的问题,对我有帮助的是:

  1. Right click on the project.
  2. Click 'Properties'
  3. Go to 'Java Build Path'
  4. And then: 'Libraries'
  5. In there, Click: Add External Jars
  6. Add: ''Path/To/Tomcat/Bin/tomcat-juli.jar
  1. 右键单击项目。
  2. 单击“属性
  3. 转到“ Java 构建路径
  4. 然后:'图书馆'
  5. 在那里,单击:添加外部罐子
  6. 添加:'' Path/To/Tomcat/Bin/tomcat-juli.jar

Done .

完毕 。

回答by Wolfgang Fahl

On Ubuntu 14.04 LTS

在 Ubuntu 14.04 LTS 上

/usr/share# mv /opt/tomcat/apache-tomcat-7.0.56/ tomcat7

fixed the issue for me. There was a symbolic link there to /opt. Inside that opt directory there where ../../java links that would not point to /usr/share/java since the files physically were in /opt

为我解决了这个问题。那里有一个指向 /opt 的符号链接。在 opt 目录中,../../java 链接不会指向 /usr/share/java,因为文件实际上位于 /opt

回答by RMorrisey

In our case, the wrong version of the Sysdeo Tomcat plugin for Eclipse 3.5 was being used. The fix:

在我们的例子中,使用了错误版本的 Eclipse 3.5 Sysdeo Tomcat 插件。修复:

  • Use tomcatPluginV33instead of tomcatPluginV321(extract to C:\eclipse\dropins)
  • Ensure that DevloaderTomcat7.jarwas placed in the tomcat libfolder
  • In Window > Preferences > Tomcat, set the Tomcat version to 7.x
  • 使用tomcatPluginV33代替tomcatPluginV321(提取到C:\eclipse\dropins
  • 确保DevloaderTomcat7.jar被放置在tomcatlib文件夹中
  • 在 Window > Preferences > Tomcat 中,将 Tomcat 版本设置为 7.x

This problem may have been unique to our environment; but, I'll record it here anyway, for posterity's sake.

这个问题可能是我们环境所独有的;但是,为了后人的缘故,无论如何我都会在这里记录下来。