为了账号安全,请及时绑定邮箱和手机立即绑定

启动jetty时报找不到spring webApplicationInitializer

2015-09-06 17:22:48.519:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath

2015-09-06 17:22:48.570:INFO:/:main: Initializing Spring root WebApplicationContext

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

2015-09-06 17:22:48.712:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@73b634b1{/,file:/F:/Eclipseworkspace/spring-mvc-study/src/main/webapp/,STARTING}{file:/F:/Eclipseworkspace/spring-mvc-study/src/main/webapp/}

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]


正在回答

3 回答

public static void main(String[] args) {
  JFinal.start("src/main/webapp", 80, "/");// 启动配置项
}

将这里的端口号与

pom.xml里面的port端口号一致就行

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>9.2.2.v20140723</version>
  <configuration>
     <httpConnector>
        <port>80</port><!-- 启动端口号 -->
     </httpConnector>
     <stopPort>99</stopPort>
     <stopKey>stop</stopKey>
     <scanIntervalSeconds>10</scanIntervalSeconds>
     <webApp>
        <contextPath>/</contextPath>
     </webApp>
     <!-- 适应测试阶段的jetty,日志写入目录,tomcat写入tomcat/logs下 -->
     <systemProperties>
        <systemProperty>
           <name>catalina.base</name>
           <value>.</value>
        </systemProperty>
     </systemProperties>
  </configuration>
</plugin>

我是用IDEA的jetty启动的

0 回复 有任何疑惑可以回复我~

[INFO] Initializing Spring root WebApplicationContext

[INFO] started o.m.j.p.JettyWebAppContext{/,file:/E:/EclipseProject/Mybatis/web-parent/web-app/src/main/webapp/},file:/E:/EclipseProject/Mybatis/web-parent/web-app/src/main/webapp/

[INFO] Initializing Spring FrameworkServlet 'dispatcher'

[INFO] Started SelectChannelConnector@0.0.0.0:80

[INFO] Started Jetty Server


0 回复 有任何疑惑可以回复我~

估计你是不是乱改路劲了?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

启动jetty时报找不到spring webApplicationInitializer

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信