【问题标题】:Eclipse jetty plugin -- class not found websocketfactoryEclipse jetty 插件——找不到类 websocketfactory
【发布时间】:2015-01-13 07:03:02
【问题描述】:

我有一个网络应用,在 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 出现上述错误

但是我有 NO 使用 eclipse luna 和 jetty 9.2.5 的 opensuse 错误

也没有我在 suse 企业服务器下部署 web 时是否有错误,使用 jetty 9.2.5 作为战争文件。

有人知道怎么回事吗?

ps:我查看了线程(java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory)。作者说的是OSGi环境,是不是有问题?

【问题讨论】:

    标签: eclipse eclipse-plugin websocket jetty


    【解决方案1】:

    没关系,我想通了。

    只需勾选 jetty 插件中的全局复选框。

    同样将 common 和 server jar 放在 buildpath 中。

    【讨论】:

      猜你喜欢
      • 2015-02-20
      • 2015-07-22
      • 2010-11-29
      • 2016-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-07
      • 2012-07-02
      相关资源
      最近更新 更多