简体   繁体   English

将Jetty 7.6作为Windows服务运行时发生ClassNotFoundException

[英]ClassNotFoundException while running Jetty 7.6 as a windows service

I went through the solution written by @crowne for the question: Running Jetty 7 as Windows Service 我通过了@crowne编写的解决方案来解决以下问题:将Jetty 7作为Windows服务运行

The command I used to install service: 我用来安装服务的命令:

bin\\JettyService //IS//JettyService --DisplayName="Jetty Service" --Install=D:\\Jetty-7.6\\bin\\JettyService.exe --LogPath=D:\\Jetty-7.6\\logs --LogLevel=Debug --StdOutput=auto --StdError=auto --StartMode=Java --StopMode=Java --Jvm=auto ++JvmOptions=-Djetty.home=D:\\Jetty-7.6 ++JvmOptions=-DSTOP.PORT=8087 ++JvmOptions=-DSTOP.KEY=downB0y ++JvmOptions=-Djetty.logs=D:\\Jetty-7.6\\logs ++JvmOptions=-Dorg.eclipse.jetty.util.log.SOURCE=true ++JvmOptions=-XX:MaxPermSize=128M ++JvmOptions=-XX:+CMSClassUnloadingEnabled ++JvmOptions=-XX:+CMSPermGenSweepingEnabled --Classpath=D:\\Jetty-7.6\\start.jar --StartClass=org.eclipse.jetty.start.Main ++StartParams=OPTIONS=All ++StartParams=D:\\Jetty-7.6\\etc\\jetty.xml ++StartParams=D:\\Jetty-7.6\\etc\\jetty-deploy.xml ++StartParams=D:\\Jetty-7.6\\etc\\jetty-webapps.xml ++StartParams=D:\\Jetty-7.6\\etc\\jetty-contexts.xml ++StartParams=D:\\Jetty-7.6\\etc\\jetty-testrealm.xml --StopClass=org.eclipse.jetty.start.Main ++StopParams=--stop bin \\ JettyService // IS // JettyService --DisplayName =“ Jetty Service” --Install = D:\\ Jetty-7.6 \\ bin \\ JettyService.exe --LogPath = D:\\ Jetty-7.6 \\ logs --LogLevel = Debug --StdOutput =自动--StdError =自动--StartMode = Java --StopMode = Java --Jvm =自动++ JvmOptions = -Djetty.home = D:\\ Jetty-7.6 ++ JvmOptions = -DSTOP.PORT = 8087 ++ JvmOptions = -DSTOP.KEY = downB0y ++ JvmOptions = -Djetty.logs = D:\\ Jetty-7.6 \\ logs ++ JvmOptions = -Dorg.eclipse.jetty.util.log.SOURCE = true ++ JvmOptions =- XX:MaxPermSize = 128M ++ JvmOptions = -XX:+ CMSClassUnloadingEnabled ++ JvmOptions = -XX:+ CMSPermGenSweepingEnabled --Classpath = D:\\ Jetty-7.6 \\ start.jar --StartClass = org.eclipse.jetty.start.Main ++ StartParams = OPTIONS =所有++ StartParams = D:\\ Jetty-7.6 \\ etc \\ jetty.xml ++ StartParams = D:\\ Jetty-7.6 \\ etc \\ jetty-deploy.xml ++ StartParams = D:\\ Jetty- 7.6 \\ etc \\ jetty-webapps.xml ++ StartParams = D:\\ Jetty-7.6 \\ etc \\ jetty-contexts.xml ++ StartParams = D:\\ Jetty-7.6 \\ etc \\ jetty-testrealm.xml --StopClass = org .eclipse.jetty.start.Main ++ StopParams =-停止

but I get this error when starting the jetty server: 但是启动码头服务器时出现此错误:

2013-06-03 14:58:17 Commons Daemon procrun stderr initialized java.lang.NoClassDefFoundError: org/eclipse/jetty/start/Main 2013-06-03 14:58:17 Commons Daemon procrun stderr初始化了java.lang.NoClassDefFoundError:org / eclipse / jetty / start / Main

Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.start.Main 引起原因:java.lang.ClassNotFoundException:org.eclipse.jetty.start.Main

at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method) 在java.security.AccessController.doPrivileged(本机方法)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 在java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 在java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 在java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Could not find the main class: org.eclipse.jetty.start.Main. 找不到主类:org.eclipse.jetty.start.Main。 Program will exit. 程序将会退出。

Exception in thread "main" 线程“主”中的异常

I am using Windows 7, 32 bit and Jetty 7.6. 我正在使用Windows 7、32位和Jetty 7.6。 Can someone please help me out. 有人可以帮我吗。

It seems like the issue was with the prunsrv.exe provided with the commons daemon binaries. 似乎是Commons守护程序二进制文件提供的prunsrv.exe出现问题。 I then used the 64 bit .exe provided on a 64 bit windows system and it worked just fine. 然后,我使用了64位Windows系统上提供的64位.exe,它运行良好。 but why id did not work on 32 bit windows is still a mystery 但是为什么id在32位Windows上不起作用仍然是一个谜

It would appear that you have a classpath issue where the service running java execution does not know about the start.jar file. 看来您有一个类路径问题,其中运行Java执行的服务不知道start.jar文件。 I would look into whatever options are available on that service dealio and figure out how to add something like 我将研究该服务协议上可用的任何选项,并弄清楚如何添加类似的内容

-cp d:\Jetty-7.6\start.jar

so it is on your classpath, from that point on the Jetty start.jar process should craft a reasonable classpath. 所以它就在您的类路径上,从那时起,在Jetty start.jar进程上应该构建一个合理的类路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM