Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INFO: No Spring WebApplicationInitializer types detected on classpath

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 

My project:

  • does not use web.xml, I use javaconf @ annotations.
  • does not use maven, I use a User Library

I see that the project is in:

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

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

I confirm that all runs fine on my tomcat7 server when I deploy from 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 

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,

I see in the log:

INFO: No Spring WebApplicationInitializer types detected on classpath 

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 
like image 748
Aron Avatar asked Apr 08 '14 13:04

Aron


People also ask

What is WebApplicationInitializer in spring?

In Spring, WebApplicationInitializer is an Interface and it is Servlet 3.0+ implementation to configure ServletContext programmatically in comparison to the traditional way to do this using the web. xml file. This interface is used for booting Spring web applications.


1 Answers

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.

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

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

Thanks everybody.

like image 52
Aron Avatar answered Sep 18 '22 15:09

Aron