RESTful webservice doesn't start on Tomcat 8.0.5 - java

I wrote a simple webservice that parses an XMLfile with JAXB. This service works when I 'Run' it from the menu of NetBeans(Tomcat 8.0.3), But if I put the WAR file into webapps folder of tomcat and start tomcat(server.xml is identical between the two servers), I get the following error:
Please help resolve this:
01-Sep-2015 15:07:45.979 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
01-Sep-2015 15:07:46.006 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
01-Sep-2015 15:07:46.009 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8443"]
01-Sep-2015 15:07:46.277 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
01-Sep-2015 15:07:46.280 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
01-Sep-2015 15:07:46.283 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
01-Sep-2015 15:07:46.283 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 824 ms
01-Sep-2015 15:07:46.330 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
01-Sep-2015 15:07:46.330 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.5
01-Sep-2015 15:07:46.356 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\k4kReadOrderService.war
01-Sep-2015 15:07:46.372 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
01-Sep-2015 15:07:46.972 SEVERE [localhost-startStop-1] org.apache.catalina.startup.ContextConfig.processServletContainerInitializers Failed to process JAR found at URL [/k4kReadOrderService] for ServletContainerInitializers for context with name [{1}]
java.io.IOException: java.lang.ClassCastException: Cannot cast org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer to javax.servlet.ServletContainerInitializer
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:185)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:151)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1597)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1125)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1762)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: Cannot cast org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer to javax.servlet.ServletContainerInitializer
at java.lang.Class.cast(Unknown Source)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:182)
... 19 more
01-Sep-2015 15:07:47.006 SEVERE [localhost-startStop-1] org.apache.catalina.startup.ContextConfig.configureStart Marking this application unavailable due to previous error(s)
01-Sep-2015 15:07:47.015 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error getConfigured
01-Sep-2015 15:07:47.017 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/k4kReadOrderService] startup failed due to previous errors
01-Sep-2015 15:07:47.027 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\docs
01-Sep-2015 15:07:47.142 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\examples
01-Sep-2015 15:07:47.604 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\host-manager
01-Sep-2015 15:07:47.647 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\manager
01-Sep-2015 15:07:47.698 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.5-windows-x64\apache-tomcat-8.0.5\webapps\ROOT
01-Sep-2015 15:07:47.726 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
01-Sep-2015 15:07:47.732 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8443"]
01-Sep-2015 15:07:47.734 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
01-Sep-2015 15:07:47.736 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1452 ms

Check if your servlet-api is included several times with:
mvn dependency:tree -Dverbose
If so, you can exclude transitional dependencies in one of them using (example of how I fixed same problem):
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jetty</artifactId>
<version>2.23.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>

Related

Deploying Web App Manually on TomCat

I am trying to deploy a web app manually on Tomcat.
I have created a "myapp" folder in webapps folder with following files and folders:-
1) myapp\WEB-INF\index.html
2) myapp\WEB-INF\classes
3) myapp\WEB-INF\lib
4) myapp\WEB-INF\myapp-servlet.xml
5) myapp\WEB-INF\web.html
But I am getting the following exception :-
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I linked my classes folder in tomcat and rest of the files I just copy pasted. I was able to run this like some time back. But I am not getting what i am missing. Is it build.xml? Thanks!
Update 1:-
05-Mar-2018 16:18:51.089 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.28
05-Mar-2018 16:18:51.093 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 6 2018 23:10:25 UTC
05-Mar-2018 16:18:51.093 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.28.0
05-Mar-2018 16:18:51.093 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
05-Mar-2018 16:18:51.094 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
05-Mar-2018 16:18:51.094 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
05-Mar-2018 16:18:51.094 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_161\jre
05-Mar-2018 16:18:51.094 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_161-b12
05-Mar-2018 16:18:51.094 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
05-Mar-2018 16:18:51.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28
05-Mar-2018 16:18:51.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28
05-Mar-2018 16:18:51.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\conf\logging.properties
05-Mar-2018 16:18:51.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
05-Mar-2018 16:18:51.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28
05-Mar-2018 16:18:51.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\temp
05-Mar-2018 16:18:51.097 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.16] using APR version [1.6.3].
05-Mar-2018 16:18:51.097 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
05-Mar-2018 16:18:51.097 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
05-Mar-2018 16:18:52.219 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2m 2 Nov 2017]
05-Mar-2018 16:18:52.442 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
05-Mar-2018 16:18:52.801 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2018 16:18:52.826 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
05-Mar-2018 16:18:52.831 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
05-Mar-2018 16:18:52.833 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2489 ms
05-Mar-2018 16:18:52.872 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
05-Mar-2018 16:18:52.872 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.28
05-Mar-2018 16:18:52.890 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\docs]
05-Mar-2018 16:18:53.476 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\docs] has finished in [586] ms
05-Mar-2018 16:18:53.478 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\examples]
05-Mar-2018 16:18:54.474 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\examples] has finished in [997] ms
05-Mar-2018 16:18:54.475 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\host-manager]
05-Mar-2018 16:18:54.528 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\host-manager] has finished in [54] ms
05-Mar-2018 16:18:54.529 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\myapp]
05-Mar-2018 16:18:54.623 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot#5323bab5]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4868)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5003)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet#3cbf78d5]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:113)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 13 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:142)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 16 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734)
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at sun.misc.IOUtils.readFully(IOUtils.java:65)
at java.util.jar.JarFile.getBytes(JarFile.java:425)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:193)
at java.util.jar.JarFile.getManifest(JarFile.java:180)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140)
... 17 more
05-Mar-2018 16:18:54.627 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\myapp]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Update 2:-
Adding POM.xml now I am getting following exception
05-Mar-2018 16:33:41.240 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name [myapp]
at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3155)
at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3145)
at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1375)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1189)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:774)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5113)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
05-Mar-2018 16:33:41.242 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [C:\Software Applications\apache-tomcat-8.5.28-windows-x64\apache-tomcat-8.5.28\webapps\myapp]
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/myapp]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1141)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
You can start by cheking if you are using jdk path for the runtime enviroments, you must use jre path. Make sure that tomcat uses the same java version as your application.
Based on previous answer I did following things :-
1) Added pom.xml instead of lib folder
2) Changed the servlet name in the web.xml
Deployed the above web app successfully on tomcat.
Update :
It's not pom.xml that makes tomcat fail but some jars that conflicts with tomcat lib on removing those everything is fine.

Could not contact localhost:8005. Tomcat may not be running error while shutdown tomcat

Hi I am trying to shutdown and startup tomcat server. But i am getting below error while running shutdown.sh. Please check below error and suggest me to complete.
Error:
Using CATALINA_BASE: /opt/tomcat8
Using CATALINA_HOME: /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_74
Using CLASSPATH: /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-ju li.jar
Jul 24, 2017 11:01:47 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 24, 2017 11:01:48 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja va:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket Impl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java :188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
Also please find log:
24-Jul-2017 23:48:28.884 SEVERE [main] org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:8005]:
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:420)
at org.apache.catalina.startup.Catalina.await(Catalina.java:717)
at org.apache.catalina.startup.Catalina.start(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
24-Jul-2017 23:48:28.988 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.990 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
There is some Application running on port 8005 due to which tomcat is not able to bind network on the port. Your shutdown.sh will throw exception because server is not started yet (as there was an issue in starting the server)
Solution 1(Recommended): Change the port from 8005 to 8006 in /opt/tomcat8/conf/server.xml
Solution 2: Please check which application is using 8005 by netstat -tulnp | grep 8005 and turn it off.
if the timestamps are correct, it suggests that your tomcat startup failed around 23:00 and you tried to shutdown a non existing tomcat service at 11:00 hours
You can try to add
export JRE_HOME=$JAVA_HOME/jre
in /etc/profile,then run
source /etc/profile
it is avalible for me.
http://blog.51cto.com/zero01/2053974. I meet the same problem today. When i want to execute shudown.sh, the log shows that tomcat may not be running, and the connection to port 8005 is refused. When i use netstat -atunp, i find there is no process listening port 8005. So tomcat should fail to start. I search,and find the answer in the link showed below. The key is to change $JAVA_HOME/jre/lib/security/java.security. The data to change is to add char 'u' before 'random':
securerandom.source=file:/dev/urandom
Or set -Dsecurerandom.source=file:/dev/./urandom in Tomcat's CATALINA_OPTS.
and it works. This helps in a specific scenario of an incomplete Tomcat start up resulting from some operation blocking in '/dev/random' reads in the event of low system entropy. The Tomcat shutdown port is only listening after a full start up, so if a start attempt hangs in a '/dev/random' read or due to any other issue, the shutdown port is not listening and a shutdown attempt relying on it fails with the connection refused error. If start up hangs in '/dev/random', then the urandom change addresses this as /dev/urandom never blocks and hangs waiting for system entropy.
A CATALINA_PID may be set to shutdown Tomcat using a pid file and OS signal without issue in this event instead of the shutdown port.
try to start from ./catalina.sh run
is every thing is ok then it will come on screen
or it will show some error
like in my case
[root#localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Invalid maximum heap size: -Xmx512MB
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
change memory heap size then it will definately work
[root#localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
10-Oct-2017 02:28:13.782 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.23
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 28 2017 10:30:11 UTC
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.23.0
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-123.el7.x86_64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /root/Desktop/jdk1.8.0_144/jre
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_144-b01
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/root/Desktop/tomcat/apache-tomcat-8.5.23/conf/logging.properties
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.812 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/root/Desktop/tomcat/apache-tomcat-8.5.23/temp
10-Oct-2017 02:28:13.812 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 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]
10-Oct-2017 02:28:15.306 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:15.518 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.551 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:15.558 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.568 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 4756 ms
10-Oct-2017 02:28:15.869 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
10-Oct-2017 02:28:15.870 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
10-Oct-2017 02:28:16.072 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT]
10-Oct-2017 02:28:18.435 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT] has finished in [2,362] ms
10-Oct-2017 02:28:18.436 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs]
10-Oct-2017 02:28:18.540 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs] has finished in [89] ms
10-Oct-2017 02:28:18.541 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples]
10-Oct-2017 02:28:20.151 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples] has finished in [1,611] ms
10-Oct-2017 02:28:20.152 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager]
10-Oct-2017 02:28:20.320 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager] has finished in [168] ms
10-Oct-2017 02:28:20.321 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager]
10-Oct-2017 02:28:20.438 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager] has finished in [117] ms
10-Oct-2017 02:28:20.461 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:20.540 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:20.547 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4978 ms
^C10-Oct-2017 02:29:29.604 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:29.695 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:29.748 INFO [Thread-5] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
10-Oct-2017 02:29:30.063 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.069 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:30.077 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.094 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
[root#localhost bin]# ./startup.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Tomcat started.
then again try to shutdown
from /bin# ./shutdown
[root#localhost bin]# ./shutdown.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
good luck

project doesnt run - netbeabs

i try to run my web project.
i really dont know what is the problem..
this is the result of
apache Tomcat console on net beans:
Using CATALINA_BASE: "C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15"
Using CATALINA_TMPDIR: "C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_65"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15\bin\tomcat-juli.jar"
08-Feb-2016 11:35:54.644 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.15
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Nov 2 2014 19:25:20 UTC
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.15.0
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JAVA_HOME: C:\Program Files\Java\jdk1.8.0_65\jre
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_65-b17
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base
08-Feb-2016 11:35:54.645 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|study-computer
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\logging.properties
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15\endorsed
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\temp
08-Feb-2016 11:35:54.646 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 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_65\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;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 (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP;C:\Program Files\apache-maven-3.3.9\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\nodejs\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\CineForm\Tools;C:\Program Files (x86)\Windows Live\Shared;C:\Users\Maor\AppData\Roaming\npm;.
08-Feb-2016 11:35:54.787 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8084"]
08-Feb-2016 11:35:54.846 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
08-Feb-2016 11:35:54.849 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
08-Feb-2016 11:35:54.857 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
08-Feb-2016 11:35:54.857 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 504 ms
08-Feb-2016 11:35:54.878 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
08-Feb-2016 11:35:54.878 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.15
08-Feb-2016 11:35:54.886 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\chinesecheckers.xml
08-Feb-2016 11:35:54.926 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 11:35:57.108 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
08-Feb-2016 11:35:57.180 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\chinesecheckers.xml has finished in 2,294 ms
08-Feb-2016 11:35:57.180 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml
08-Feb-2016 11:35:57.183 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 11:35:57.820 INFO [localhost-startStop-1] com.sun.jersey.api.core.WebAppResourceConfig.init Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
08-Feb-2016 11:35:58.053 INFO [localhost-startStop-1] com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found:
class controllers.ProfileController
class controllers.MainController
08-Feb-2016 11:35:58.053 INFO [localhost-startStop-1] com.sun.jersey.api.core.ScanningResourceConfig.init No provider classes found.
08-Feb-2016 11:35:58.156 INFO [localhost-startStop-1] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
08-Feb-2016 11:35:58.732 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml has finished in 1,552 ms
08-Feb-2016 11:35:58.732 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\manager.xml
08-Feb-2016 11:35:58.805 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
08-Feb-2016 11:35:58.811 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\manager.xml has finished in 79 ms
08-Feb-2016 11:35:58.811 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\ROOT.xml
08-Feb-2016 11:35:58.889 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
08-Feb-2016 11:35:58.892 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\ROOT.xml has finished in 81 ms
08-Feb-2016 11:35:58.892 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\upload.xml
08-Feb-2016 11:35:58.895 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 11:35:58.897 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/upload]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot#4900d9b0]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4875)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5004)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Caused by: java.lang.IllegalArgumentException: The main resource set specified [C:\Users\Maor\Documents\NetBeansProjects\upload\build\web] is not valid
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:670)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 13 more
08-Feb-2016 11:35:58.898 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\upload.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/upload]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:581)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1683)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
08-Feb-2016 11:35:58.899 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\upload.xml has finished in 6 ms
08-Feb-2016 11:35:58.899 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\upload2.xml
08-Feb-2016 11:35:58.901 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 11:35:59.005 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
08-Feb-2016 11:35:59.008 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\upload2.xml has finished in 108 ms
08-Feb-2016 11:35:59.011 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8084"]
08-Feb-2016 11:35:59.027 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
08-Feb-2016 11:35:59.036 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4179 ms
08-Feb-2016 11:35:59.870 INFO [http-nio-8084-exec-3] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/linkeride]
08-Feb-2016 11:35:59.913 INFO [http-nio-8084-exec-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml
08-Feb-2016 11:35:59.915 WARNING [http-nio-8084-exec-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 11:36:00.482 INFO [http-nio-8084-exec-1] com.sun.jersey.api.core.WebAppResourceConfig.init Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
08-Feb-2016 11:36:00.670 INFO [http-nio-8084-exec-1] com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found:
class controllers.MainController
class controllers.ProfileController
08-Feb-2016 11:36:00.670 INFO [http-nio-8084-exec-1] com.sun.jersey.api.core.ScanningResourceConfig.init No provider classes found.
08-Feb-2016 11:36:00.757 INFO [http-nio-8084-exec-1] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
08-Feb-2016 11:36:01.213 INFO [http-nio-8084-exec-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml has finished in 1,299 ms
08-Feb-2016 11:36:01.240 INFO [http-nio-8084-exec-7] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/linkeride]] after start() had already been called. The second call will be ignored.
08-Feb-2016 11:36:15.775 INFO [http-nio-8084-exec-9] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/linkeride]
08-Feb-2016 12:01:24.353 INFO [http-nio-8084-exec-15] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml
08-Feb-2016 12:01:24.356 WARNING [http-nio-8084-exec-15] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
08-Feb-2016 12:01:25.320 INFO [http-nio-8084-exec-15] com.sun.jersey.api.core.WebAppResourceConfig.init Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
08-Feb-2016 12:01:25.494 INFO [http-nio-8084-exec-15] com.sun.jersey.api.core.ScanningResourceConfig.logClasses Root resource classes found:
class controllers.ProfileController
class controllers.MainController
08-Feb-2016 12:01:25.494 INFO [http-nio-8084-exec-15] com.sun.jersey.api.core.ScanningResourceConfig.init No provider classes found.
08-Feb-2016 12:01:25.564 INFO [http-nio-8084-exec-15] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
08-Feb-2016 12:01:25.923 INFO [http-nio-8084-exec-15] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\Maor\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\Catalina\localhost\linkeride.xml has finished in 1,570 ms
08-Feb-2016 12:01:25.948 INFO [http-nio-8084-exec-16] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/linkeride]] after start() had already been called. The second call will be ignored.
this is my web.xml file:
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Archetype Created Web Application
<servlet>
<servlet-name>myrest1</servlet-name>
<servlet-class>
com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>InitialTimerServlet</servlet-name>
<servlet-class>generalServlet.InitialTimerServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myrest1</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
i try to open the project on the browser but cannot,
anynone know what can be the problem?

Tomcat: War file deploys locally but not on online server [duplicate]

This question already has answers here:
java.lang.IllegalArgumentException: The servlets named [X] and [Y] are both mapped to the url-pattern [/url] which is not permitted
(7 answers)
Closed 7 years ago.
I've a war file of a web app that runs on tomcat 8 via netbeans as well as tomcat 8 independently without IDE. But if I try to run the same war file on tomcat 8 installed in an online server(I'm using koding.com vm for the purpose), I'm getting the following log in catalina.out:
19-Oct-2015 04:47:21.458 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.28
19-Oct-2015 04:47:21.459 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Oct 7 2015 18:25:21 UTC
19-Oct-2015 04:47:21.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.28.0
19-Oct-2015 04:47:21.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
19-Oct-2015 04:47:21.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.13.0-29-generic
19-Oct-2015 04:47:21.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
19-Oct-2015 04:47:21.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-7-openjdk-amd64/jre
19-Oct-2015 04:47:21.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.7.0_79-b14
19-Oct-2015 04:47:21.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
19-Oct-2015 04:47:21.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/stutech/tomcat
19-Oct-2015 04:47:21.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/stutech/tomcat
19-Oct-2015 04:47:21.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/stutech/tomcat/conf/logging.properties
19-Oct-2015 04:47:21.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
19-Oct-2015 04:47:21.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/home/stutech/tomcat/endorsed
19-Oct-2015 04:47:21.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/stutech/tomcat
19-Oct-2015 04:47:21.463 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/stutech/tomcat
19-Oct-2015 04:47:21.463 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/stutech/tomcat/temp
19-Oct-2015 04:47:21.463 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 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/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
19-Oct-2015 04:47:21.731 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
19-Oct-2015 04:47:21.782 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Oct-2015 04:47:21.788 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
19-Oct-2015 04:47:21.794 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Oct-2015 04:47:21.796 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1307 ms
19-Oct-2015 04:47:21.871 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
19-Oct-2015 04:47:21.880 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28
19-Oct-2015 04:47:21.961 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/stutech/tomcat/webapps/Whiteboard.war
19-Oct-2015 04:47:21.979 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
19-Oct-2015 04:47:23.573 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Whiteboard]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: The servlets named [register] and [com.whiteboard.servlet.register] are both mapped to the url-pattern [/register] which is not permitted
at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:308)
at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2342)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2024)
at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:1918)
at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:1913)
at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:1913)
at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:1913)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1139)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5080)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
19-Oct-2015 04:47:23.575 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /home/stutech/tomcat/webapps/Whiteboard.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Whiteboard]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
19-Oct-2015 04:47:23.584 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/stutech/tomcat/webapps/Whiteboard.war has finished in 1,615 ms
19-Oct-2015 04:47:23.585 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/stutech/tomcat/webapps/docs
19-Oct-2015 04:47:23.918 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/stutech/tomcat/webapps/docs has finished in 333 ms
19-Oct-2015 04:47:23.922 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/stutech/tomcat/webapps/examples
19-Oct-2015 04:47:24.499 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/stutech/tomcat/webapps/examples has finished in 577 ms
19-Oct-2015 04:47:24.499 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/stutech/tomcat/webapps/host-manager
19-Oct-2015 04:47:24.529 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/stutech/tomcat/webapps/host-manager has finished in 30 ms
19-Oct-2015 04:47:24.533 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/stutech/tomcat/webapps/ROOT
19-Oct-2015 04:47:24.567 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/stutech/tomcat/webapps/ROOT has finished in 33 ms
19-Oct-2015 04:47:24.567 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/stutech/tomcat/webapps/manager
19-Oct-2015 04:47:24.626 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /home/stutech/tomcat/webapps/manager has finished in 59 ms
19-Oct-2015 04:47:24.641 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
19-Oct-2015 04:47:24.656 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
19-Oct-2015 04:47:24.660 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 2863 ms
Caused by: java.lang.IllegalArgumentException: The servlets named
[register] and [com.whiteboard.servlet.register] are both mapped to
the url-pattern [/register] which is not permitted
This Error clearly states that same url-mapping is mapped to two Servlets.
Modify your web.xml and you are good to go.

Error 404 after deploying a simple Spring MVC app (without web.xml)

I want to learn some basics of Spring MVC based fully on annotations. I started with this tutorial.
After cloning the repository
hg clone https://bitbucket.org/arnelism/snoutbook
and building the war file
mvn package
I am deploying the app by simply copying the war file to the webapps directory of my Apache Tomcat 7.0.12 instance. I am stopping and starting the server.
INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.12
Sep 12, 2014 3:37:18 PM org.apache.catalina.startup.HostConfig deployWAR
INFORMATION: Deploying web application archive Snoutbook-1.0.0-SNAPSHOT.war
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMATION: Deploying web application directory docs
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMATION: Deploying web application directory examples
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMATION: Deploying web application directory host-manager
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMATION: Deploying web application directory manager
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMATION: Deploying web application directory ROOT
Sep 12, 2014 3:37:27 PM org.apache.coyote.AbstractProtocolHandler start
INFORMATION: Starting ProtocolHandler ["http-bio-8080"]
Sep 12, 2014 3:37:27 PM org.apache.coyote.AbstractProtocolHandler start
INFORMATION: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 12, 2014 3:37:27 PM org.apache.catalina.startup.Catalina start
INFORMATION: Server startup in 8826 ms
Unfortunately after this operation I am receiving the error 404 by displaying the page.
http://localhost:8080/Snoutbook-1.0.0-SNAPSHOT/
I have been looking for a solution for over 2 hours and have not been able to find the cause. Did somebody have a similar issue?
EDIT
I tried with the newest Tomcat version apache-tomcat-8.0.12. The problem persists. There is however more info printed in the console while deploying the web app.
12-Sep-2014 17:13:20.038 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deploying web application archive D:\Users\b21090094\apac
he-tomcat-8.0.12\webapps\Snoutbook-1.0.0-SNAPSHOT.war
12-Sep-2014 17:13:23.132 INFO [localhost-startStop-1] org.apache.catalina.util.S
essionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for s
ession ID generation using [SHA1PRNG] took [255] milliseconds.
12-Sep-2014 17:13:23.169 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.FrameworkServlet.initServletBean FrameworkServlet 'dispatcher': initializa
tion started
12-Sep-2014 17:13:23.182 INFO [localhost-startStop-1] org.springframework.contex
t.support.AbstractApplicationContext.prepareRefresh Refreshing WebApplicationCon
text for namespace 'dispatcher-servlet': startup date [Fri Sep 12 17:13:23 CEST
2014]; root of context hierarchy
12-Sep-2014 17:13:23.278 INFO [localhost-startStop-1] org.springframework.contex
t.annotation.ClassPathScanningCandidateComponentProvider.registerDefaultFilters
JSR-250 'javax.annotation.ManagedBean' found and supported for component scannin
g
12-Sep-2014 17:13:23.281 INFO [localhost-startStop-1] org.springframework.web.co
ntext.support.AnnotationConfigWebApplicationContext.loadBeanDefinitions Register
ing annotated classes: [class com.zeroturnaround.snoutbook.init.WebappConfigJpa]
12-Sep-2014 17:13:23.429 INFO [localhost-startStop-1] org.springframework.contex
t.annotation.ClassPathScanningCandidateComponentProvider.registerDefaultFilters
JSR-250 'javax.annotation.ManagedBean' found and supported for component scannin
g
12-Sep-2014 17:13:23.921 INFO [localhost-startStop-1] org.springframework.beans.
factory.support.DefaultListableBeanFactory.preInstantiateSingletons Pre-instanti
ating singletons in org.springframework.beans.factory.support.DefaultListableBea
nFactory#7169a1: defining beans [org.springframework.context.annotation.internal
ConfigurationAnnotationProcessor,org.springframework.context.annotation.internal
AutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequ
iredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnn
otationProcessor,org.springframework.context.annotation.internalPersistenceAnnot
ationProcessor,webappConfigJpa,org.springframework.context.annotation.Configurat
ionClassPostProcessor$ImportAwareBeanPostProcessor#0,addPetForm,snoutContoller,s
noutDao,org.springframework.aop.config.internalAutoProxyCreator,delegatingWebMvc
Configuration,requestMappingHandlerMapping,viewControllerHandlerMapping,beanName
HandlerMapping,resourceHandlerMapping,defaultServletHandlerMapping,requestMappin
gHandlerAdapter,mvcConversionService,mvcValidator,httpRequestHandlerAdapter,simp
leControllerHandlerAdapter,handlerExceptionResolver,proxyTransactionManagementCo
nfiguration,org.springframework.transaction.config.internalTransactionAdvisor,tr
ansactionAttributeSource,transactionInterceptor,transactionManager,entityManager
Factory,setupViewResolver,getDataSource]; root of factory hierarchy
12-Sep-2014 17:13:24.225 INFO [localhost-startStop-1] org.springframework.orm.jp
a.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory Buildi
ng JPA container EntityManagerFactory for persistence unit 'default'
12-Sep-2014 17:13:24.657 INFO [localhost-startStop-1] org.hibernate.annotations.
common.Version. HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
12-Sep-2014 17:13:24.676 INFO [localhost-startStop-1] org.hibernate.Version.logV
ersion HHH000412: Hibernate Core {4.1.2}
12-Sep-2014 17:13:24.681 INFO [localhost-startStop-1] org.hibernate.cfg.Environm
ent. HHH000206: hibernate.properties not found
12-Sep-2014 17:13:24.686 INFO [localhost-startStop-1] org.hibernate.cfg.Environm
ent.buildBytecodeProvider HHH000021: Bytecode provider name : javassist
12-Sep-2014 17:13:24.772 INFO [localhost-startStop-1] org.hibernate.ejb.Ejb3Conf
iguration.configure HHH000204: Processing PersistenceUnitInfo [
name: default
...]
12-Sep-2014 17:13:25.524 INFO [localhost-startStop-1] org.hibernate.service.jdbc
.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionP
rovider HHH000130: Instantiating explicit connection provider: org.hibernate.ejb
.connection.InjectedDataSourceConnectionProvider
12-Sep-2014 17:13:26.275 INFO [localhost-startStop-1] org.hibernate.dialect.Dial
ect. HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
12-Sep-2014 17:13:26.356 INFO [localhost-startStop-1] org.hibernate.engine.trans
action.internal.TransactionFactoryInitiator.initiateService HHH000268: Transacti
on strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFacto
ry
12-Sep-2014 17:13:26.374 INFO [localhost-startStop-1] org.hibernate.hql.internal
.ast.ASTQueryTranslatorFactory. HHH000397: Using ASTQueryTranslatorFactory
12-Sep-2014 17:13:26.498 INFO [localhost-startStop-1] . HV0000
01: Hibernate Validator 4.3.0.Final
12-Sep-2014 17:13:27.699 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod Mapped "{[/addP
et],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto
public java.lang.String com.zeroturnaround.snoutbook.controllers.AddPetForm.setu
pForm(org.springframework.ui.Model)
12-Sep-2014 17:13:27.700 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod Mapped "{[/addP
et],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto
public java.lang.String com.zeroturnaround.snoutbook.controllers.AddPetForm.han
dleSubmit(com.zeroturnaround.snoutbook.form.PetForm,org.springframework.validati
on.BindingResult,org.springframework.web.bind.support.SessionStatus)
12-Sep-2014 17:13:27.701 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod Mapped "{[/pet/
{petId}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" ont
o public java.lang.String com.zeroturnaround.snoutbook.controllers.SnoutContolle
r.pet(java.lang.Long,org.springframework.ui.Model)
12-Sep-2014 17:13:27.702 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod Mapped "{[/owne
rs],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto pub
lic java.lang.String com.zeroturnaround.snoutbook.controllers.SnoutContoller.lis
tOwners(org.springframework.ui.Model)
12-Sep-2014 17:13:27.762 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.handler.AbstractUrlHandlerMapping.registerHandler Mapped URL path [/**] on
to handler of type [class org.springframework.web.servlet.resource.DefaultServle
tHttpRequestHandler]
12-Sep-2014 17:13:28.129 INFO [localhost-startStop-1] org.springframework.web.se
rvlet.FrameworkServlet.initServletBean FrameworkServlet 'dispatcher': initializa
tion completed in 4960 ms
12-Sep-2014 17:13:28.140 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployWAR Deployment of web application archive D:\Users\b21090094\
apache-tomcat-8.0.12\webapps\Snoutbook-1.0.0-SNAPSHOT.war has finished in 8,103
ms
12-Sep-2014 17:13:28.141 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory D:\Users\b21090
094\apache-tomcat-8.0.12\webapps\docs
12-Sep-2014 17:13:28.167 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory D:\Users\b2
1090094\apache-tomcat-8.0.12\webapps\docs has finished in 26 ms
12-Sep-2014 17:13:28.168 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory D:\Users\b21090
094\apache-tomcat-8.0.12\webapps\examples
12-Sep-2014 17:13:28.537 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory D:\Users\b2
1090094\apache-tomcat-8.0.12\webapps\examples has finished in 370 ms
12-Sep-2014 17:13:28.538 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory D:\Users\b21090
094\apache-tomcat-8.0.12\webapps\host-manager
12-Sep-2014 17:13:28.572 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory D:\Users\b2
1090094\apache-tomcat-8.0.12\webapps\host-manager has finished in 34 ms
12-Sep-2014 17:13:28.573 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory D:\Users\b21090
094\apache-tomcat-8.0.12\webapps\manager
12-Sep-2014 17:13:28.633 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory D:\Users\b2
1090094\apache-tomcat-8.0.12\webapps\manager has finished in 61 ms
12-Sep-2014 17:13:28.633 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deploying web application directory D:\Users\b21090
094\apache-tomcat-8.0.12\webapps\ROOT
12-Sep-2014 17:13:28.659 INFO [localhost-startStop-1] org.apache.catalina.startu
p.HostConfig.deployDirectory Deployment of web application directory D:\Users\b2
1090094\apache-tomcat-8.0.12\webapps\ROOT has finished in 26 ms
12-Sep-2014 17:13:28.663 INFO [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["http-nio-8080"]
12-Sep-2014 17:13:28.676 INFO [main] org.apache.coyote.AbstractProtocol.start St
arting ProtocolHandler ["ajp-nio-8009"]
12-Sep-2014 17:13:28.682 INFO [main] org.apache.catalina.startup.Catalina.start
Server startup in 8701 ms
After that I am still getting Error 404.
Try to use http://localhost:8080/Snoutbook-1.0.0-SNAPSHOT/owners
When you upload war file to webapp folder of tomcat, by default tomcat let you access the webapp with the war's name. And then when you look at the web app initializer (the subtitute of web.xml), it's registering the DispatcherServlet with / mapping. Next, you look at the controller, it have #RequestMapping pointed to /owners.
Hence, the path is:
host:port + war-name + servlet-mapping + controller-mapping
equals to
localhost:8080/ + Snoutbook-1.0.0-SNAPSHOT/ + / + owners
equals to
http://localhost:8080/Snoutbook-1.0.0-SNAPSHOT/owners

Categories

Resources