VAADIN应用在Tomcat下部署下的出现ClassNotFoundException问题

来源:互联网 发布:php源码学习 编辑:程序博客网 时间:2024/05/22 16:31

问题描述

在Tomcat 8下,部署VAADIN 7.3的应用,参考VAADIN的指导进行部署:

This Vaadin zip contains all the jars of the Vaadin Framework. Additionally all dependencies are provided in the lib folder.To use in a web project:1. Copy all vaadin-* files except vaadin-client and vaadin-client-compiler to WEB-INF/lib in your project2. Copy lib/*.jar to WEB-INF/lib in your project3. Copy vaadin-client and vaadin-client-compiler to a lib folder which is on your classpath but will not be deployed. These files are only needed when compiling a module (widget set) to Javascript.If you are using Eclipse and a standard WTP (Dynamic Web Project or Vaadin Project), step 3 can be:Create a /lib folder, copy the files there and right click the lib folder and select "Build Path" -> "Add to Build Path".Once this is done, the "Compile widgetset" button provided by the Vaadin Plug-in for Eclipse will work correctly.

发现在加载VAADIN生成web页面时,出现了ClassNotFoundException异常:

[Servlet execution threw an exception] with root causejava.lang.ClassNotFoundException: org.eclipse.jetty.websocket.WebSocketFactory$Acceptor    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)    at org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket.service(Servlet30AsyncSupportWithWebSocket.java:59)    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1124)    at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:293)    at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:279)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)......

解决方案

经过查找资料和多方验证,最终发现Atmosphere框架发现其运行在错误的服务器上,这个问题的发生通常是由于你的应用配置了错误的依赖文件。在Tomcat的配置环境下,应用部署目录WEB-IF/lib下包含jetty-server.jar,就会抛出上述异常。解决方法就是删除该目录下Jetty相关的jar文件。

此问题困扰了2天,最终google查询到参考资料的web资料,最终得以解决。读者可以参考此资料以了解详细信息。

参考资料

1. ClassNotFoundException at startup

0 0