How to fix this Spring MVC startup exception in tomcat? - spring

Could somebody help me with this error regarding starting Tomcat + spring ?
I already clean everything, and when I go to localhost:8080/springmvc/hello_world.html I got a 404 page error.
Thank you so much guys.
02/06/2012 00:09:59 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:\Arquivos de programas\Java\jre6\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Arquivos de programas/Java/jre6/bin/client;C:/Arquivos de programas/Java/jre6/bin;C:/Arquivos de programas/Java/jre6/lib/i386;C:\Ruby193\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\Java\jdk1.6.0_25\bin;C:\apache-maven-3.0.3\bin;C:\spring-roo-1.1.3.RELEASE\bin;C:\Arquivos de programas\Android\android-sdk\tools;C:\Arquivos de programas\QuickTime\QTSystem\;C:\eclipse;;.
02/06/2012 00:09:59 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringMVC' did not find a matching property.
02/06/2012 00:10:00 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
02/06/2012 00:10:00 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
02/06/2012 00:10:00 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 791 ms
02/06/2012 00:10:00 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
02/06/2012 00:10:00 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
02/06/2012 00:10:00 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
02/06/2012 00:10:00 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
02/06/2012 00:10:00 org.apache.catalina.startup.Catalina start
INFO: Server startup in 525 ms

if you found page 404, then it might the hello_world.htm page not found.
The easiest way to start is to put in the startup page as index.html so page can be loded in from contex root.

Based on your log output your application is not deploying. Are you sure you added your project to your server? I'm assuming you are using Eclipse. Right click on your Server and select Add / Remove. Your application should be under the configured.

Related

How to turn off INFO: Starting service [Tomcat] Spring Boot

I'm trying to get out these logs in red when spring starts... how could I do that? I've tried several ways.
Feb 23, 2022 5:24:40 PM org.apache.coyote.http11.AbstractHttp11Protocol configureUpgradeProtocol
INFO: The ["https-jsse-nio-8443"] connector has been configured to support negotiation to [h2] via ALPN
Feb 23, 2022 5:24:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["https-jsse-nio-8443"]
Feb 23, 2022 5:24:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Feb 23, 2022 5:24:40 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Feb 23, 2022 5:24:40 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.56]
Feb 23, 2022 5:24:40 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
Feb 23, 2022 5:24:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["https-jsse-nio-8443"]
Feb 23, 2022 5:24:44 PM org.apache.coyote.AbstractPr`enter code here`otocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Feb 23, 2022 5:24:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring DispatcherServlet 'dispatcherServlet'
Spring image logs

Tomcat taking too long to initialize

Why would it take 40+ minutes for the server to initialize the 'http-bio-8443' protocol handler as highlighted below.
This line is single handedly causing all the tomcat startup delay.
Mar 30, 2015 10:12:49 AM. org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
************************************
Mar 30, 2015 10:12:49 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Mar 30, 2015 10:55:26 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
************************************
Mar 30, 2015 10:55:26 AM org.apache.catalina.startup.Catalina load
The OS does not have enough entropy to initialise the cryptography used by the HTTPS connector.

What's the difference between WebappClassLoader and StandardJarScanner?

I'm using the tomcat7-maven-plugin to launch a web application from Maven during the pre-integration-test lifecycle phase so that I can run tests against it locally during the integration-test phase.
I haven't worked much on the web application itself, but for the record it uses JSP and Java controllers which are tied together using Spring MVC 3.0.
When I run Maven (mvn clean verify) on my own machine I see the following output for the plugin:
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
[INFO] Using existing Tomcat server configuration at /Users/alexjohnson/MyWorkspace/MyProject/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7
Jan 27, 2015 2:18:54 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: /Users/alexjohnson/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2015 2:18:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Jan 27, 2015 2:18:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 425 ms
Jan 27, 2015 2:18:54 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2015 2:18:54 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Jan 27, 2015 2:18:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
// More startup stuff
This is working as expected. Note that WebappClassLoader.validateJarFile is called. Also note that the APR info message is expected since we aren't using these libraries in the test environment.
When I run Maven on our build server (mvn clean verify) I see the following output for the plugin:
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
[INFO] Using existing Tomcat server configuration at /opt/jenkins/workspace/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7
Jan 27, 2015 2:30:09 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: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 27, 2015 2:30:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Jan 27, 2015 2:30:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 823 ms
Jan 27, 2015 2:30:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 27, 2015 2:30:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Jan 27, 2015 2:30:10 PM org.apache.tomcat.util.scan.StandardJarScanner scan
WARNING: Failed to scan JAR [file:/opt/jenkins/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7/webapps/../../../../../../../../../../../target/MyProject/WEB-INF/lib/openws-1.5.1.jar] from WEB-INF/lib
java.io.FileNotFoundException: /opt/jenkins/BuildServerWorkspace/src/test/resources/com/MyCompany/MyProject/ui/automation/tomcat7/webapps/../../../../../../../../../../../target/MyProject/WEB-INF/lib/openws-1.5.1.jar (No such file or directory)
// Hundreds more FileNotFoundExceptions for JAR files.
This is not working. Note that this time StandardJarScanner.scan is called. Also note that the missing JAR files appear to have been created during the build on my local machine at the same relative path (11 directories out from webapps and 5 more into the target directory). I believe all of these JAR files are for third-party Maven dependencies.
I've read the official JavaDocs, but I can't find a helpful description of the WebappClassLoader or the StandardJarScanner. All I can really gather is that they're both used for loading classes from JAR files when Tomcat starts up.
What I'd like to know:
What are WebappClassLoader and StandardJarScanner specifically being used for in this context?
What are the key differences between WebappClassLoader and StandardJarScanner?
What sort of configuration could be different on the build server that causes it to use the StandardJarScanner instead of the WebappClassLoader when running Maven there (All of the environment variables and Maven parameters which I know of are already the same)?
have a look at this issue https://issues.apache.org/jira/browse/MTOMCAT-239
Sounds like some weird paths from jenkins, I can't figure out why..
WebAppClassLoader and StandardJarScanner are apples and oranges. StandardJarScanner always runs before WebAppClassLoader but only produces log statements if something goes wrong. This means that the StandardJarScanner log statements were appearing at the same point in the failing build as the WebAppClassLoader log statements in the passing build.
Since I was mis-reading these log statements I ended up asking the wrong question. My original problem still stands. I've opened a new question for it at Why is Tomcat throwing FileNotFoundExceptions for existing JAR files?.

Issue running a spring 3 app on tomcat

I am using Spring Tool Suite with as server VMware vFabric tc Server Developer but I have to change for tomcat6.
There isn't any errors or exceptions when I launch the app but I can't access it because of a 404 error from tomcat.
Here are the logs
23 avr. 2013 10:13:12 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: D:\javatools\java\jdk1.6.0_12\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\PuTTY;D:\javatools\java\jdk1.6.0_12;D:\javatools\apache-maven-2.0.10\bin;D:\javatools\java\jdk1.6.0_12;D:\strawberry\c\bin;D:\strawberry\perl\site\bin;D:\strawberry\perl\bin
23 avr. 2013 10:13:13 org.apache.tomcat.util.digester.SetPropertiesRule begin
ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:dashboard' did not find a matching property.
23 avr. 2013 10:13:13 org.apache.coyote.http11.Http11Protocol init
INFO: Initialisation de Coyote HTTP/1.1 sur http-8080
23 avr. 2013 10:13:13 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 599 ms
23 avr. 2013 10:13:13 org.apache.catalina.core.StandardService start
INFO: Démarrage du service Catalina
23 avr. 2013 10:13:13 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
23 avr. 2013 10:13:13 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\Utilisateurs\a553416\Documents\workspace-sts-3.1.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\dashboard\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
23 avr. 2013 10:13:13 org.apache.coyote.http11.Http11Protocol start
INFO: Démarrage de Coyote HTTP/1.1 sur http-8080
23 avr. 2013 10:13:13 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
23 avr. 2013 10:13:13 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18 config=null
23 avr. 2013 10:13:13 org.apache.catalina.startup.Catalina start
INFO: Server startup in 604 ms
Someone would know what's wrong with tomcat or the config ?
Thank you
The context path for your application has been changed. Follow this link
How to change context root of a dynamic web project in Eclipse?
Set the context path to URI which is the entry point of your application or which is working in VMware vFabric tc Server.
Undeploy the application from Tomcat and deploy it again.

How do I configure this Spring project correctly?

Me and my team are trying to setup a Spring project, and would like to implement REST services. But when I try to deploy it to tomcat 7, I get an error. Here is the output:
Jan 22, 2012 9:39:34 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: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Jan 22, 2012 9:39:34 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:niths' did not find a matching property.
Jan 22, 2012 9:39:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 22, 2012 9:39:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 22, 2012 9:39:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 497 ms
Jan 22, 2012 9:39:34 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 22, 2012 9:39:34 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Jan 22, 2012 9:39:34 PM org.apache.catalina.startup.ContextConfig webConfig
SEVERE: Unable to determine URL for WEB-INF/classes
javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
at org.apache.naming.resources.BaseDirContext.listBindings(BaseDirContext.java:733)
at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:546)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Jan 22, 2012 9:39:37 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 22, 2012 9:39:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 22, 2012 9:39:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 22, 2012 9:39:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3208 ms
I have tried Googling javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found without luck. I am guessing the project was not deployed at all.
The project is hosted on this GitHub repo.
Deployment descriptor
The REST controller
I have added a very simple method for testing my application: getBaz(), which I guess would be invoked at localhost:8080/niths/rest/baz.
I am having a hard time figuring out what is missing as this is my first Spring project, and would therefore be grateful if someone skilled in the arts of Spring would point out what's the problem!
From your pom.xml file, it seems that you excluded your classes and libs from the generated war :
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
Try again by removing this line.

Resources