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

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

问题描述

我有一个 spring 项目,当我从 Eclipse 部署时,它在我的 tomcat7 服务器上运行良好:运行方式 >> 在服务器上运行.在 Eclipse 选项卡服务器"中,我看到:

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/webapps 中部署同一个应用程序(使用文件 .war)时

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 中设置了这个选项:首选项Java编译器.

I setup this option in Eclipse: PreferencesJavaCompiler.

谢谢大家.

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

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