我想使用嵌入式jetty(eclipse luna内置版本)部署vaadin(版本7.2.5)Web应用程序。
目前,我的代码如下:
public class Launcher {
private static int httpPort = 8080;
public static void main(String[] args) throws Exception
{
Server server = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(1000 * 60 * 10);
connector.setSoLingerTime(-1);
connector.setPort(httpPort);
connector.setReuseAddress(false);
QueuedThreadPool pool = new QueuedThreadPool();
pool.setMinThreads(10);
pool.setMaxThreads(100);
server.setConnectors(new Connector[] { connector });
server.setThreadPool(pool);
WebAppContext context = new WebAppContext();
context.setServer(server);
context.setContextPath("/");
context.setWar("ReportWriter.war");
context.setClassLoader(Thread.currentThread().getContextClassLoader());
server.setHandler(context);
try
{
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
我是从vaadin forum thread复制的。服务器似乎启动,WAR实际上被解压缩。
将我的浏览器指向http://localhost:8080/
,而不是启动我的vaadin(版本7.2.5)应用,我看到的只是:
以防它可能很重要:我在eclipse中的WAR项目的目录树:
ReportWriter
| .classpath
| .project
| ivy.xml
| ivysettings.xml
|
+---.settings
| (...)
|
+---build
| \---classes
| +---(...)
| \---META-INF
| persistence.xml
|
+---src
| +---(...)
| \---META-INF
| persistence.xml
|
\---WebContent
| dropDDL.sql
| init.sql
| reportwriter.xml
|
+---META-INF
| MANIFEST.MF
|
+---VAADIN
\---WEB-INF
\---lib
BorderLayout-0.5.jar
confirmdialog-2.0.4.jar
dawn-2.jar
derby.jar
derbynet.jar
derbyrun.jar
derbytools.jar
messagebox-2.0.6.jar
refresher-1.2.1.7.jar
vaadin-jpacontainer-3.1.1-javadoc.jar
vaadin-jpacontainer-3.1.1-sources.jar
vaadin-jpacontainer-3.1.1.jar
wizards-for-vaadin-1.0.1.jar
我的RWRunner(发射器)项目之一:
RWRunner
| .classpath
| .project
| ivy.xml
| ivysettings.xml
| ReportWriter.war <-- The war file generated from the project above
| test.txt
| web.xml
|
+---.settings
| .jsdtscope
| com.vaadin.integration.eclipse.prefs
| org.eclipse.jdt.core.prefs
| org.eclipse.wst.common.component
| org.eclipse.wst.common.project.facet.core.xml
| org.eclipse.wst.jsdt.ui.superType.container
| org.eclipse.wst.jsdt.ui.superType.name
|
+---build
| \---classes
| \---ch
| \---darkspot
| \---rwrunner
| Launcher.class
|
\---src
\---ch
\---darkspot
\---rwrunner
Launcher.java
答案 0 :(得分:1)
看起来你在某种程度上错过了将/ *映射到Vaadin Web应用程序所需的servlet配置。似乎有适当的web.xml应该处理,但检查内容是否指向正确的Servlet / UI类和URI。
除了在web.xml中进行映射之外,您可以在UI类中使用@WebServlet
带注释的servlet(使用JSR 315时):
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyDemoUI.class)
public static class Servlet extends VaadinServlet {
}
此外,上面的WAR结构看起来很可疑(尽管浏览器屏幕截图中的目录列表看起来不错)。确保类位于/WEB-INF/classes/
下,以便对servlet容器可见。还有/ WEB-INF下的web.xml。