Java NoClassDefFoundError: org/apache/catalina/startup/Bootstrap 从 exe/as 服务运行 tomcat 时

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

NoClassDefFoundError: org/apache/catalina/startup/Bootstrap when running tomcat from exe/as service

javatomcattomcat6

提问by Vinc

I have been running a Tomcat 6.0.37 server for quite some time via the startup.bat.Now I want to run tomcat as a service that starts automatically when the machine starts up.

我已经通过startup.bat运行Tomcat 6.0.37服务器很长一段时间了。现在我想将tomcat作为机器启动时自动启动的服务运行。

I created the service with the bat : service.bat install.This created the service succesfully.When trying to start it however I get the error in the title.I then tried running just the exe(tomcat6.exe).This gave me the exact same error.

我用 bat 创建了服务:service.bat install。这成功地创建了服务。尝试启动它时,但是我在标题中收到错误。然后我尝试只运行 exe(tomcat6.exe)。这给了我完全相同的错误。

I have checked that CATALINA_HOME,JAVA_HOME and JRE_HOME is set correctly.bootstrap.jar does exist in tomcat/bin.Path to the jvm is correct.jvm.dll does exist in jre6/bin/server.

我已经检查过 CATALINA_HOME、JAVA_HOME 和 JRE_HOME 设置是否正确。bootstrap.jar 确实存在于 tomcat/bin 中。jvm 的路径是正确的。jvm.dll 确实存在于 jre6/bin/server 中。

I also found a thread with a different class missing where they said rt.jar was missing from the jre,I checked this and mine exists in jre6/lib/.I really don't have anymore ideas as to what can be wrong.

我还发现了一个缺少不同类的线程,他们说 jre 中缺少 rt.jar,我检查了这个,我的存在于 jre6/lib/ 中。我真的不知道什么可能是错的。

采纳答案by blackbird014

try to update the service by executing (adapt to your path):

尝试通过执行(适应您的路径)来更新服务:

  C:\> tomcat6 //US//Tomcat6 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \
  C:\> --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar

US means: update service.
This should fix the classpath.

美国的意思是:更新服务。
这应该修复类路径。

All the necessary information are in the official website:
http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html

所有需要的资料都在官网:http:
//tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html

回答by Darrell Teague

Recommend using one of the "Java as a Windows Service" frameworks as they handle adding JARs to the classpath, etc. This can be done manually however via the "java -cp {set your classpath here...}" options as well.

建议使用“Java 作为 Windows 服务”框架之一,因为它们处理将 JAR 添加到类路径等。但这也可以通过“java -cp {set your classpath here...}”选项手动完成。