I am new to learning Spring MVC. My program listings are below. I have a controller in my src/MySpringMVCProjects folder. I get multiple markers of errors in the controller class, on the Exception, String and getParameter lines.
Controller
package MySpringMVCProjects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloController implements Controller {
public ModelAndView handleRequest(HttpServletRequest req,
HttpServletResponse res) throws Exception {
String name = req.getParameter("name");
Map m = new HashMap();
m.put("msg", "Hello" + name);
ModelAndView mav = new ModelAndView("success", m);
return mav;
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<display-name>FirstMVCHelloWorld</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- default -->
<servlet>
<servlet-name>HelloController</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloController</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
</web-app>
Servlet xml : helloWorld-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- default handler mapping -->
<!-- handler -->
<bean class = "org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<!-- controller -->
<bean name = "/hello.htm" class = "MySpringMVCProjects.HelloController" />
<!-- view resolver -->
<bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name = "prefix" value ="/" />
<property name = "suffix" value =".jsp" />
</bean>
</beans>
index.jsp:
<h1>HelloWorld</h1>
<form action = "./hello.htm">
NAME:<input type="text" value="name"/>
<input type="submit" value="sayHello"/>
</form>
success.jsp:
${msg}
Directory structure:
Apache Tomcat error logs when running server:
Oct 09, 2015 1:25:15 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SimpleWebService' did not find a matching property.
Oct 09, 2015 1:25:15 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FirstMVCHelloWorld' did not find a matching property.
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.64
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Aug 19 2015 17:18:06 UTC
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.64.0
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre7
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_75-b13
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\gafg\Desktop\IVP\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 7.0
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\gafg\Desktop\IVP\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\gafg\Desktop\IVP\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 7.0\endorsed
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Oct 09, 2015 1:25:15 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre7/bin/server;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/amd64;C:\app\gafg\product\11.2.0\client_1\BIN;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\;C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools\Best Practices Analyzer\;C:\Microsoft SQL Server Migration Assistant for Oracle\bin\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\jdk1.7\bin;.;;C:\Users\gafg\Documents\Eclipse - Kepler\Eclipse-Kepler\eclipse;;.
Oct 09, 2015 1:25:15 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8001"]
Oct 09, 2015 1:25:15 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Oct 09, 2015 1:25:15 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 852 ms
Oct 09, 2015 1:25:15 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Oct 09, 2015 1:25:15 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.64
Oct 09, 2015 1:25:15 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\gafg\Desktop\IVP\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\FirstMVCHelloWorld\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Oct 09, 2015 1:25:16 AM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 09, 2015 1:25:16 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [111] milliseconds.
Oct 09, 2015 1:25:16 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\gafg\Desktop\IVP\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\SimpleWebService\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Oct 09, 2015 1:25:17 AM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Oct 09, 2015 1:25:18 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8001"]
Oct 09, 2015 1:25:18 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 09, 2015 1:25:18 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2439 ms
What is the error? How i can resolve this?
Seems the server started properly.
From the project structure it looks like as you are unable to compile the project: Reason being your have added Source files not the actual lib.
You can check out some already available tutorial like:
http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example-annotation/
http://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/
If you still face any problem, please paste the log entries from your log file
Can you please paste the error from Log4j or slf4j.
Related
I've been trying to change to a CAS 5.1.x Server from a 4.X Server for the past 3 days with various searches and research and next to no progress. Whenever I remove the dependency to cas-server-webapp-tomcat, the artifact deploys on the local tomcat apache server however it does not show anything except the standard Apache 404 error page. Here is the log for that case:
"C:\Program Files\Java\jdk1.8.0_144\bin\java" -Dcatalina.base=C:\Users\dhogue\.IntelliJIdea2017.1\system\tomcat\Unnamed_src-cas_2 "-Dcatalina.home=C:\Tomcat 70" "-Djava.io.tmpdir=C:\Tomcat 70\temp" -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -cp "C:\Tomcat 70\bin\bootstrap.jar;C:\Tomcat 70\bin\tomcat-juli.jar" org.apache.catalina.startup.Bootstrap start
[2017-09-27 01:11:17,832] Artifact src-cas:war: Server is not connected. Deploy is not available.
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.63
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 30 2015 08:08:33 UTC
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.63.0
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.8.0_144\jre
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_144-b01
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\dhogue\.IntelliJIdea2017.1\system\tomcat\Unnamed_src-cas_2
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Tomcat 70
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\dhogue\.IntelliJIdea2017.1\system\tomcat\Unnamed_src-cas_2
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Tomcat 70
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=C:\Tomcat 70\temp
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote=
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.port=1099
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.ssl=false
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.rmi.server.hostname=127.0.0.1
Sep 27, 2017 1:11:19 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_144\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\phantomjs-2.1.1-windows\bin;C:\Program Files\jscoverage-0.5.1;C:\Ruby22-x64\bin;C:\Program Files\apache-ant-1.9.9/bin;C:\Program Files\apache-maven-3.0.4\bin;C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files (x86)\Skype\Phone\;.
Sep 27, 2017 1:11:19 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9090"]
Sep 27, 2017 1:11:19 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-9009"]
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 929 ms
Sep 27, 2017 1:11:19 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 27, 2017 1:11:19 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.63
Sep 27, 2017 1:11:19 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9090"]
Sep 27, 2017 1:11:19 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
Sep 27, 2017 1:11:19 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 54 ms
Connected to server
[2017-09-27 01:11:19,924] Artifact src-cas:war: Artifact is being deployed, please wait...
Sep 27, 2017 1:11:22 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Tomcat 70\webapps\ROOT\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Sep 27, 2017 1:11:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat 70\webapps\manager
Sep 27, 2017 1:11:29 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 27, 2017 1:11:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat 70\webapps\manager has finished in 195 ms
Sep 27, 2017 1:11:30 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 27, 2017 1:11:30 PM org.apache.catalina.core.ApplicationContext log
INFO: 1 Spring WebApplicationInitializers detected on classpath
[2017-09-27 01:11:30,468] Artifact src-cas:war: Artifact is deployed successfully
[2017-09-27 01:11:30,468] Artifact src-cas:war: Deploy took 10,544 milliseconds
Whenever I try to run it with the cas-server-webapp-tomcat dependency no matter what I've tried, I've always ended up with an error as shown in the following log: Error with cas-server-webapp-tomcat
Here is my current Pom file...excuse the mess: cas.pom
IDE: IntelliJ IDEA
Not sure what else would be needed, ask and I'll provide whatever you need to help me.
Two things stand out to me:
cas-server-webapp-tomcat contains an embedded tomcat container. If you are using an external one, use cas-server-webapp.
It looks like your external tomcat is 7.x. You need at least Tomcat 8.
https://apereo.github.io/cas/5.1.x/installation/Configuring-Servlet-Container.html
I created spring config where applicationContext has all 'heavy' beans and
servlet context only controllers. My problem is that applicationContext with all 'big' beans is loaded twice. What I am doing wrong?
I read this and this but not helps:
my web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-conf/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-conf/dispatcher.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
applicationContext.xml
<context:annotation-config/>
<context:component-scan base-package="kkl.server.error" />
<context:component-scan base-package="kkl.server.services" />
<context:component-scan base-package="kkl.server.log" />
<context:component-scan base-package="kkl.server.model" />
<context:component-scan base-package="kkl.server.security" />
<context:component-scan base-package="kkl.server.utils" />
<context:component-scan base-package="kkl.server.validation" />
<!-- ///////////////// properties ///////////////////// -->
<context:property-placeholder
location="classpath:spring-conf/properties/application.properties"
order='0' ignore-resource-not-found="false" />
<context:property-placeholder
location="classpath:spring-conf/properties/local.properties" order='-1'
ignore-unresolvable='true' ignore-resource-not-found="true"/>
<import resource="classpath:spring-conf/spring-aop_and_transactions.xml" />
<import resource="classpath:spring-conf/spring-security.xml" />
<import resource="classpath:spring-conf/spring-database.xml" />
dispatcher.xml
<context:annotation-config />
<mvc:annotation-driven>
<mvc:message-converters>
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<bean class="kkl.fireRpg.server.controllers.utils.json.JsonObjectMapper" />
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- ///////////////// scanned packages //////////////////// -->
<context:component-scan base-package="kkl.server.controllers" />
Update
After when I comment every thing in applicationContext and in web.xml (without listener and context-param) my tomcat output looks like this:
`maj 24, 2016 1:13:54 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:firerpg' did not find a matching property.
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 23 2015 11:56:07 UTC
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.18.0
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files (x86)\Java\jdk1.8.0_60\jre
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_60-b27
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\endorsed
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
maj 24, 2016 1:13:54 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.8.0_60\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre1.8.0_60/bin/client;C:/Program Files (x86)/Java/jre1.8.0_60/bin;C:/Program Files (x86)/Java/jre1.8.0_60/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Bitvise SSH Client;D:\programy\java\apache-maven-3.3.9\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\programy\java\eclipseluna\eclipse;;.
maj 24, 2016 1:13:55 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
maj 24, 2016 1:13:55 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
maj 24, 2016 1:13:55 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
maj 24, 2016 1:13:55 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
maj 24, 2016 1:13:55 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 676 ms
maj 24, 2016 1:13:55 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
maj 24, 2016 1:13:55 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.18
maj 24, 2016 1:13:59 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
maj 24, 2016 1:13:59 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
maj 24, 2016 1:13:59 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
maj 24, 2016 1:13:59 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue May 24 01:13:59 CEST 2016]; root of context hierarchy
maj 24, 2016 1:13:59 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-conf/applicationContext.xml]
maj 24, 2016 1:13:59 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/local.properties]
maj 24, 2016 1:13:59 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/application.properties]
maj 24, 2016 1:13:59 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 655 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [265] milliseconds.
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\docs
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\docs has finished in 31 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\examples
maj 24, 2016 1:14:00 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
maj 24, 2016 1:14:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\examples has finished in 375 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\firerpg
maj 24, 2016 1:14:03 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
maj 24, 2016 1:14:03 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
maj 24, 2016 1:14:03 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
maj 24, 2016 1:14:04 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue May 24 01:14:04 CEST 2016]; root of context hierarchy
maj 24, 2016 1:14:04 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-conf/applicationContext.xml]
maj 24, 2016 1:14:04 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/local.properties]
maj 24, 2016 1:14:04 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/application.properties]
maj 24, 2016 1:14:04 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 561 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\firerpg has finished in 3,932 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\host-manager
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\host-manager has finished in 16 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\manager
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\manager has finished in 16 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\ROOT
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\ROOT has finished in 15 ms
maj 24, 2016 1:14:04 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
maj 24, 2016 1:14:04 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9413 ms`
this line:
INFO: Loading XML bean definitions from class path resource [spring- conf/applicationContext.xml]
shows twice.
I fight a lot with this problem. I disabled almost everything but it still exist.
Then I back to my eclipse tomcat config where I set up 'use real installtion'.
After when I change setting to use 'use workspace metadata' problem disappears.
I am using eclipse luna release 2 and tomcat 8
I hope this will spare someones time.
UPDATE
After few tries I see that eclipse is breaking my tomcat installation.
(I tried on a new one to be sure).When I set up 'use real installation'
problem occurs again. After this, it still exist even when I run tomcat without eclipse.
Solution is: delete yours tomcat installation.Setup a new one and never change 'use workspace metadata'
In my spring configuratin file, I have written this code <mvc:view-controller path="/results" view-name="results" /> to map '/results' to viewName 'results'. Its working fine. But the below mappings in the controller are not working.
#RequestMapping(value = "/form", method = RequestMethod.GET)
#RequestMapping(value = "/form", method = RequestMethod.POST)
Its throwing 404 error, when accessing this URL http://localhost:8090/SpringFormValidation/form.
when I removed this code <mvc:view-controller path="/results" view-name="results" />, then the mappings in the controller works fine.
I am just clueless, what is causing it?
I am posting my console output, Controller class and spring configuration file.
My controller class:
package com.github.binoybaranwal.controller;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.github.binoybaranwal.pojo.Person;
#Controller
public class WebController extends WebMvcConfigurerAdapter {
#Override
public void addViewControllers(ViewControllerRegistry registry){
registry.addViewController("/results").setViewName("results");
}
#RequestMapping(value = "/form", method = RequestMethod.GET)
public String showForm(Person person){
return "form";
}
#RequestMapping(value = "/form", method = RequestMethod.POST)
public String checkPersonInfo(#Valid Person person, BindingResult bindingResult){
if(bindingResult.hasErrors()){
return "form";
}
return "redirect:/results";
}
}
My spring configuration file
SpringFormValidation-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.github.binoybaranwal.controller" />
<tx:annotation-driven/>
<mvc:view-controller path="/results" view-name="results" />
</beans>
My console output:
Dec 14, 2015 12:18:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringFormValidation' did not find a matching property.
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.59
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 28 2015 15:51:10 UTC
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.59.0
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.2
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre7
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\wtpwebapps
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\endorsed
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true
Dec 14, 2015 12:18:28 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Dec 14, 2015 12:18:28 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Sony\VAIO Improvement;C:\Program Files (x86)\Sony\VAIO BIOS Data Transfer Utility\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Git\cmd;C:\apache-maven-3.3.9\bin;.
Dec 14, 2015 12:18:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8090"]
Dec 14, 2015 12:18:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 14, 2015 12:18:29 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 982 ms
Dec 14, 2015 12:18:29 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 14, 2015 12:18:29 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.59
Dec 14, 2015 12:18:31 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 14, 2015 12:18:31 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Dec 14, 2015 12:18:31 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Dec 14, 2015 12:18:31 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Dec 14 00:18:31 IST 2015]; root of context hierarchy
Dec 14, 2015 12:18:31 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [META-INF/spring/restws-service-context.xml]
Dec 14, 2015 12:18:31 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 509 ms
Dec 14, 2015 12:18:32 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [307] milliseconds.
Dec 14, 2015 12:18:32 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'SpringFormValidation'
Dec 14, 2015 12:18:32 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'SpringFormValidation': initialization started
Dec 14, 2015 12:18:32 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'SpringFormValidation-servlet': startup date [Mon Dec 14 00:18:32 IST 2015]; parent: Root WebApplicationContext
Dec 14, 2015 12:18:32 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/SpringFormValidation-servlet.xml]
Dec 14, 2015 12:18:32 AM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFO: Mapped URL path [/results] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
Dec 14, 2015 12:18:33 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'SpringFormValidation': initialization completed in 854 ms
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\binoy
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\binoy has finished in 92 ms
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\docs
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\docs has finished in 78 ms
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\examples
Dec 14, 2015 12:18:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Dec 14, 2015 12:18:33 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Dec 14, 2015 12:18:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#6c0f5c75')
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\examples has finished in 591 ms
Dec 14, 2015 12:18:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\host-manager
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\host-manager has finished in 96 ms
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\manager
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\manager has finished in 219 ms
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\ROOT
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\apache-tomcat-7.0.59-windows-x86\apache-tomcat-7.0.59\webapps\ROOT has finished in 70 ms
Dec 14, 2015 12:18:34 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8090"]
Dec 14, 2015 12:18:34 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 14, 2015 12:18:34 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5288 ms
Dec 14, 2015 12:18:36 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/SpringFormValidation/form] in DispatcherServlet with name 'SpringFormValidation'
Dec 14, 2015 12:18:38 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/SpringFormValidation/form] in DispatcherServlet with name 'SpringFormValidation'
Dec 14, 2015 12:18:54 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/SpringFormValidation] has started
Dec 14, 2015 12:18:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'SpringFormValidation'
Dec 14, 2015 12:18:54 AM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFO: Closing WebApplicationContext for namespace 'SpringFormValidation-servlet': startup date [Mon Dec 14 00:18:32 IST 2015]; parent: Root WebApplicationContext
Dec 14, 2015 12:18:54 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Dec 14, 2015 12:18:54 AM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Mon Dec 14 00:18:31 IST 2015]; root of context hierarchy
Dec 14, 2015 12:18:55 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Dec 14, 2015 12:18:55 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Dec 14, 2015 12:18:55 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Dec 14, 2015 12:18:55 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Dec 14 00:18:55 IST 2015]; root of context hierarchy
Dec 14, 2015 12:18:55 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [META-INF/spring/restws-service-context.xml]
Dec 14, 2015 12:18:56 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 478 ms
Dec 14, 2015 12:18:56 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'SpringFormValidation'
Dec 14, 2015 12:18:56 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'SpringFormValidation': initialization started
Dec 14, 2015 12:18:56 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'SpringFormValidation-servlet': startup date [Mon Dec 14 00:18:56 IST 2015]; parent: Root WebApplicationContext
Dec 14, 2015 12:18:56 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/SpringFormValidation-servlet.xml]
Dec 14, 2015 12:18:56 AM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFO: Mapped URL path [/results] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
Dec 14, 2015 12:18:56 AM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'SpringFormValidation': initialization completed in 638 ms
Dec 14, 2015 12:18:56 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/SpringFormValidation] is completed
Dec 14, 2015 1:16:21 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/SpringFormValidation/form] in DispatcherServlet with name 'SpringFormValidation'
I will appreciate your help.
Fixed it by adding annotation #EnableWebMvc in my controller. Thanks
Till now i was using tomcat 7.0.34 and my spring application was loading perfectly. Yesterday i decided to use 7.0.47 and the container is not loading anymore my application. If i switch back to 34 version it works again. I tested on 7.0.52 and the same problem is there.
Not sure what can be the issue.
StackTrace
Mrz 28, 2014 11:03:28 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;d:\imagemagick-6.3.9-q8;C:\Program Files\ImageMagick-6.8.8-Q16;C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\THINKPAD\BLUETOOTH SOFTWARE\;C:\PROGRAM FILES\THINKPAD\BLUETOOTH SOFTWARE\SYSWOW64;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Java\jdk1.7.0_51;D:\apache-cassandra-2.0.5;D:\maven/bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;.
Mrz 28, 2014 11:03:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:daydiary' did not find a matching property.
Mrz 28, 2014 11:03:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mrz 28, 2014 11:03:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mrz 28, 2014 11:03:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 756 ms
Mrz 28, 2014 11:03:28 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mrz 28, 2014 11:03:28 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Mrz 28, 2014 11:03:30 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mrz 28, 2014 11:03:30 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mrz 28, 2014 11:03:30 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2201 ms
The problem i see is my WebApplicationInitializer implementation is not detected somehow. What can be the cause for this.?
I am using JDK 7 , spring 4.0.2
Oh man !.... I just deleted the web.xml file and the WebApplicationInitializer is now loaded.
Previously i had both of them. Just not sure if you can have both with this kind of configuration but looks like you cannot....
I've run this project previously in STS but am trying to replicate it in Eclipse 4.2 to no luck. I'm running the same Spring XML-free base setup as described http://blog.codeleak.pl/2011/06/spring-31-mvc-xml-free-configuration-in.html .
I'm using maven 3 embedded in Eclipse 4.2 and an embedded tomcat 7.
When I start the project up on tomcat 7.0.12...
Aug 05, 2013 1:04:29 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Development\jdks\jdk1.7.0_25_x86\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Development/jdks/jdk1.7.0_25_x86/bin/../jre/bin/client;C:/Development/jdks/jdk1.7.0_25_x86/bin/../jre/bin;C:/Development/jdks/jdk1.7.0_25_x86/bin/../jre/lib/i386;C:\Development\jdks\jdk1.7.0_25_x86\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Dell\DW WLAN Card;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5\;C:\Program Files (x86)\Security Innovation\SI TSS\bin\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Apache\apache-maven-3.0.5\bin;C:\Program Files (x86)\Git\cmd;C:\Development\eclipse-4.2_x86;;.
Aug 05, 2013 1:04:29 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:inst_tdcsim_server' did not find a matching property.
Aug 05, 2013 1:04:29 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Aug 05, 2013 1:04:29 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Aug 05, 2013 1:04:29 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 422 ms
Aug 05, 2013 1:04:29 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 05, 2013 1:04:29 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Aug 05, 2013 1:04:29 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Aug 05, 2013 1:04:29 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Aug 05, 2013 1:04:29 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 259 ms
No mention of mappings being registered and no URL works, just 404s.
I tried changing the context root in Eclipse and the Tomcat server xml to '/' and that dind't help either.
I tried setting debug points in the code and nothing stops.
I tried setting all logging to 'ALL' after I brought in log4j, nothing shows.
I tried creating a blatant nullpointerexception on the first line of the onStartup method and nothing.
How is this spring app not responding to anything I try to do to get a response?
Any help would be hugely appreciated.
The solution involved Eclipse not deploying the assembly correctly.
Goto properties on the project -> Deployment Assembly -> Added "/src/main/java" deployed to "WEB-INF/classes" and then it picked up my Initializer. Not sure why this wasn't there to begin with.