我有一个网络应用程序,在WEB-INF / lib
下有以下库servlet-api-3.1.jar
websocket-api-9.2.5.v20141112.jar
websocket-servlet-9.2.5.v20141112.jar
当我用
启动应用程序时eclipse-jetty-integration plugin
( Eclipse Jetty Feature 3.8.0 net.sourceforge.eclipsejetty.feature.feature.group Christian Köberl)
后端没有显示错误:
2015-01-13 14:53:43.452:INFO::main: Logging initialized @605ms
Configuration: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\eclipseJettyPlugin.config.test.xml
Version: 9.2.5.v20141112
Context: /test
Port: 8080
Classpath: C:/Documents and Settings/Administrator/workspace/test/WebContent/WEB-INF/lib/servlet-api-3.1.jar
C:/Documents and Settings/Administrator/workspace/test/WebContent/WEB-INF/lib/websocket-api-9.2.5.v20141112.jar
C:/Documents and Settings/Administrator/workspace/test/WebContent/WEB-INF/lib/websocket-servlet-9.2.5.v20141112.jar
C:/Documents and Settings/Administrator/workspace/test/build/classes
2015-01-13 14:53:44.294:INFO:oejs.Server:main: jetty-9.2.5.v20141112
2015-01-13 14:53:44.736:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
2015-01-13 14:53:44.980:WARN:oejs.SecurityHandler:main: ServletContext@o.e.j.w.WebAppContext@1a4013{/test,file:/C:/Documents%20and%20Settings/Administrator/workspace/test/WebContent/,STARTING}{C:\Documents and Settings\Administrator\workspace\test\WebContent} has uncovered http methods for path: /
2015-01-13 14:53:45.057:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@1a4013{/test,file:/C:/Documents%20and%20Settings/Administrator/workspace/test/WebContent/,AVAILABLE}{C:\Documents and Settings\Administrator\workspace\test\WebContent}
2015-01-13 14:53:45.102:INFO:oejs.ServerConnector:main: Started ServerConnector@1dad27c{HTTP/1.1}{0.0.0.0:8080}
2015-01-13 14:53:45.102:INFO:oejs.Server:main: Started @2640ms
------------------------------------------------
Jetty startup finished in 2.2 s.
Used memory: 3.5 MB of 8.5 MB (123.8 MB maximum)
Console available: type "help".
------------------------------------------------
当我打开index.html时(使用var ws = new WebSocket(' ws:// localhost:8080 / test / websock')) 后端显示错误:
2015-01-13 14:58:36.873:WARN:/test:qtp27621947-31: unavailable
java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory
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 org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:510)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:441)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.load(WebSocketServletFactory.java:63)
at org.eclipse.jetty.websocket.servlet.WebSocketServletFactory$Loader.create(WebSocketServletFactory.java:42)
at org.eclipse.jetty.websocket.servlet.WebSocketServlet.init(WebSocketServlet.java:128)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:612)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:468)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:778)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)
at java.lang.Thread.run(Thread.java:745)
我在windowsxp和mac osx下有eclipse luna和jetty 9.2.5
的错误但是我在使用eclipse luna和jetty 9.2.5的opensuse下有 NO 错误
NOR 我是否在使用jetty 9.2.5作为war文件在suse企业服务器下部署Web时出错。
有人知道错误吗?
ps:我调查线程(java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory)。作者说了一些关于OSGi环境的问题,是什么问题?
答案 0 :(得分:0)
没关系,我明白了。
只需勾选jetty插件中的全局复选框。
同样也将common和server jar放在buildpath中。