信息:没有在类路径上检测到Spring WebApplicationInitializer类型 [英] INFO: No Spring WebApplicationInitializer types detected on classpath

查看:2219
本文介绍了信息:没有在类路径上检测到Spring WebApplicationInitializer类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从eclipse部署时,我有一个在我的tomcat7服务器上正常运行的spring项目:Run As >>在服务器上运行。
在eclipse选项卡Servers中我看到:

I have a spring project that runs fine on my tomcat7 server when I deploy from eclipse: Run As >> Run on server. In the eclipse tab "Servers" I see:

Servers
 Tomcat v7.0 Server at localhost [Started, Synchronized]
   my_project [Synchronized]
     spring-web-3.2.4-RELEASE.jar

我的项目:


  • 不使用web.xml,我使用javaconf @ annotations。

  • 不使用maven,我使用用户库

我看到项目在:

/srv/applications/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0

而且,我还看到文件夹:conf,logs,temp,webapps,work,wtpwebapps

And, I also see the folders: conf,logs,temp,webapps,work,wtpwebapps

当我从eclipse部署时,我确认我的tomcat7服务器上的所有运行正常!

I confirm that all runs fine on my tomcat7 server when I deploy from eclipse!

在eclipse控制台中我得到:

In eclipse console I get:

Apr 08, 2014 3:26:59 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:my_project' did not find a matching property.
Apr 08, 2014 3:27:00 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8888"]
Apr 08, 2014 3:27:00 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8843"]
Apr 08, 2014 3:27:01 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3215 ms
Apr 08, 2014 3:27:01 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 08, 2014 3:27:01 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Apr 08, 2014 3:27:11 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [my_project.web.context.WebApplicationInitializer@3599e94c]
Apr 08, 2014 3:27:12 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Apr 08, 2014 3:27:24 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Apr 08, 2014 3:27:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8888"]
Apr 08, 2014 3:27:24 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8843"]
Apr 08, 2014 3:27:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 23821 ms

现在:问题
当我在相同的tomcat7服务器/ var / lib / tomcat7 /中部署相同的应用程序(使用文件.war)时webapps

Now: The problem It is when I deploy the same app (using a file .war) in the same tomcat7 server /var/lib/tomcat7/webapps

我可以打开我的初始页面网页但没有数据,

I can open the my initial page web BUT without data,

我在日志中看到:

INFO: No Spring WebApplicationInitializer types detected on classpath

当我重新启动tomcat7时,我进入了日志文件:

When I restart tomcat7 I get in the log file:

INFO: Destroying ProtocolHandler ["http-bio-8843"]
Apr 8, 2014 3:25:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:my_project' did not find a matching property.
Apr 8, 2014 3:25:30 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8888"]
Apr 8, 2014 3:25:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8843"]
Apr 8, 2014 3:25:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1664 ms
Apr 8, 2014 3:25:31 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 8, 2014 3:25:31 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Apr 8, 2014 3:25:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8888"]
Apr 8, 2014 3:25:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8843"]
Apr 8, 2014 3:25:38 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7576 ms


推荐答案

我发现了错误:
我有一个使用jdk 1.6构建的库。 Spring主控制器和组件位于此库中。我如何使用jdk 1.7,它没有找到1.6中构建的类。

I found the error: I have a library that it was built using jdk 1.6. The Spring main controller and components are in this library. And how I use jdk 1.7, It does not find the classes built in 1.6.

该解决方案全部使用编译器合规级别:1.7和生成的.class文件兼容性:1.6,源兼容性:1.6构建。

The solution was built all using "compiler compliance level: 1.7" and "Generated .class files compatibility: 1.6", "Source compatibility: 1.6".

我在Eclipse中设置了这个选项:
Preferences\Java \ Compiler。

I setup this option in Eclipse: Preferences\Java\Compiler.

谢谢大家。

这篇关于信息:没有在类路径上检测到Spring WebApplicationInitializer类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆