Java 为什么我的简单springmvc web应用程序会关闭Jetty?

Java 为什么我的简单springmvc web应用程序会关闭Jetty?,java,spring,spring-mvc,ubuntu,jetty,Java,Spring,Spring Mvc,Ubuntu,Jetty,查看我的一个简单的springmvc应用程序的日志文件,homecontroller索引操作输出“hello world”,该站点似乎因为某种原因关闭了 我只是将.war文件推送到jetty_home/webapps文件夹,然后启动jetty服务 ubuntu@ip-10-123-44-55:/usr/share/jetty/logs$ cat 2011_11_01.stderrout.log.022538550 2011-11-01 02:15:26.080:INFO::jetty-6.1.

查看我的一个简单的springmvc应用程序的日志文件,homecontroller索引操作输出“hello world”,该站点似乎因为某种原因关闭了

我只是将.war文件推送到jetty_home/webapps文件夹,然后启动jetty服务

ubuntu@ip-10-123-44-55:/usr/share/jetty/logs$ cat 2011_11_01.stderrout.log.022538550 
2011-11-01 02:15:26.080:INFO::jetty-6.1.24
2011-11-01 02:15:26.192:INFO::Deploy /etc/jetty/contexts/javadoc.xml -> org.mortbay.jetty.handler.ContextHandler@8b819f{/javadoc,file:/usr/share/jetty/javadoc}
2011-11-01 02:15:26.338:INFO::Extract file:/var/lib/jetty/webapps/springmvc.war to /var/cache/jetty/data/Jetty__8080_springmvc.war__springmvc__s1aryk/webapp
2011-11-01 02:15:26.821:INFO::NO JSP Support for /springmvc, did not find org.apache.jasper.servlet.JspServlet
2011-11-01 02:15:28.245:INFO:/springmvc:Initializing Spring FrameworkServlet 'springmvc'
0    [main] INFO  org.springframework.web.servlet.DispatcherServlet  - FrameworkServlet 'springmvc': initialization started
69   [main] INFO  org.springframework.web.context.support.XmlWebApplicationContext  - Refreshing WebApplicationContext for namespace 'springmvc-servlet': startup date [Tue Nov 01 02:15:28 UTC 2011]; root of context hierarchy
145  [main] INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/servlet-context.xml]
504  [main] INFO  org.springframework.context.annotation.ClassPathBeanDefinitionScanner  - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
795  [main] INFO  org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor  - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
853  [main] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1cd107f: defining beans [homeController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0]; root of factory hierarchy
1064 [main] INFO  org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping  - Root mapping to handler 'homeController'
1446 [main] INFO  org.springframework.web.servlet.DispatcherServlet  - FrameworkServlet 'springmvc': initialization completed in 1445 ms
2011-11-01 02:15:29.738:INFO::NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
2011-11-01 02:15:29.746:INFO::Opened /var/log/jetty/2011_11_01.request.log
2011-11-01 02:15:29.810:INFO::Started SelectChannelConnector@:8080
hello, world!
2011-11-01 02:24:01.775:INFO::Shutdown hook executing
2011-11-01 02:24:01.775:INFO::Graceful shutdown SelectChannelConnector@:8080
2011-11-01 02:24:01.828:INFO::Graceful shutdown org.mortbay.jetty.handler.ContextHandler@8b819f{/javadoc,file:/usr/share/jetty/javadoc}
2011-11-01 02:24:01.828:INFO::Graceful shutdown org.mortbay.jetty.webapp.WebAppContext@caf0ed{/springmvc,file:/var/lib/jetty/webapps/springmvc.war}
2011-11-01 02:24:01.828:INFO::Graceful shutdown org.mortbay.jetty.webapp.WebAppContext@18f6559{,file:/var/lib/jetty/webapps/root/}
2011-11-01 02:24:02.828:INFO::Stopped SelectChannelConnector@:8080
2011-11-01 02:24:02.829:INFO:/springmvc:Destroying Spring FrameworkServlet 'springmvc'
514583 [Shutdown] INFO  org.springframework.web.context.support.XmlWebApplicationContext  - Closing WebApplicationContext for namespace 'springmvc-servlet': startup date [Tue Nov 01 02:15:28 UTC 2011]; root of context hierarchy
514584 [Shutdown] INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1cd107f: defining beans [homeController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0]; root of factory hierarchy
2011-11-01 02:24:02.834:INFO::Shutdown hook complete
这是一个IntelliJ.war文件,它是使用maven项目构建的

这是我的第一次部署,所以请不要以为我知道我在做什么:

更新

实际上,当我运行wget localhost:8080/springmvc/I时,我会得到以下消息:

Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 500 JSP support not configured
2011-11-01 02:33:34 ERROR 500: JSP support not configured.

由于某些原因,这在jetty上不起作用,在tomcat上效果很好?

如果这是一个maven项目,请将yetty插件添加到pom文件中

<plugins>
  <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.10</version>
  </plugin>
</plugins>

如果这是一个maven项目,将yetty插件添加到pom文件中

<plugins>
  <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.10</version>
  </plugin>
</plugins>

Jetty不直接实现JSP。相反,它使用servlet来提供servle规范所需的功能。[…]2.5servlet规范的配套规范是2.1JSP规范

因此,您需要一个带有JSP的jar

如果您在maven插件中使用Jetty 6,我想Peter Szanto回答的依赖关系将解决这个问题。另一方面,如果将其作为应用程序的一部分使用,则需要添加适当的jsp jar

例如,对于使用Jetty 6.1的Maven项目,可以在pom.xml中包括:

Jetty不直接实现JSP。相反,它使用servlet来提供servle规范所需的功能。[…]2.5servlet规范的配套规范是2.1JSP规范

因此,您需要一个带有JSP的jar

如果您在maven插件中使用Jetty 6,我想Peter Szanto回答的依赖关系将解决这个问题。另一方面,如果将其作为应用程序的一部分使用,则需要添加适当的jsp jar

例如,对于使用Jetty 6.1的Maven项目,可以在pom.xml中包括:


在web上搜索jetty和jsp支持;这是一个已知的配置/库问题,事实上在一两天前回答了一个SO问题;这是一个已知的配置/库问题,实际上在一两天前回答了一个SO问题。
<dependency>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jsp-2.1</artifactId>
  <version>6.1.14</version>
</dependency>