• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java -jar $CATALINA_HOME/webapps/myapp.war is ok but service tomcat8 start not ok!

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a Spring Boot myapp.war and upload it to $CATALINA_HOME/webapps, when I run sudo service tomcat8 restart, the log as below but http://myip:8080/myapp return 404 error!
Then I run it by java -jar myapp.war, I can view my page no any problems at http://myip:8080/!
I want to know why and solve it, does anyone explanation and help for me?

26-Dec-2015 13:54:57.984 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
26-Dec-2015 13:54:57.984 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
26-Dec-2015 13:54:57.987 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
26-Dec-2015 13:54:57.987 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
26-Dec-2015 13:54:58.059 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
26-Dec-2015 13:54:58.061 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
26-Dec-2015 13:54:58.061 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
26-Dec-2015 13:54:58.062 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]

26-Dec-2015 14:14:02.457 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.28
26-Dec-2015 14:14:02.460 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Nov 18 2015 23:50:41 UTC
26-Dec-2015 14:14:02.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.28.0
26-Dec-2015 14:14:02.461 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
26-Dec-2015 14:14:02.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.1.13-18.26.amzn1.x86_64
26-Dec-2015 14:14:02.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
26-Dec-2015 14:14:02.462 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/jre1.8.0_66
26-Dec-2015 14:14:02.463 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_66-b17
26-Dec-2015 14:14:02.463 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
26-Dec-2015 14:14:02.463 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/share/tomcat8
26-Dec-2015 14:14:02.464 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/share/tomcat8
26-Dec-2015 14:14:02.465 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/share/tomcat8
26-Dec-2015 14:14:02.465 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/share/tomcat8
26-Dec-2015 14:14:02.470 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=
26-Dec-2015 14:14:02.470 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/var/cache/tomcat8/temp
26-Dec-2015 14:14:02.470 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/share/tomcat8/conf/logging.properties
26-Dec-2015 14:14:02.471 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
26-Dec-2015 14:14:02.471 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
26-Dec-2015 14:14:02.765 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
26-Dec-2015 14:14:02.796 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
26-Dec-2015 14:14:02.803 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
26-Dec-2015 14:14:02.806 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
26-Dec-2015 14:14:02.811 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1208 ms
26-Dec-2015 14:14:02.864 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
26-Dec-2015 14:14:02.864 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.28
26-Dec-2015 14:14:02.911 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /var/lib/tomcat8/webapps/gs-uploading-files-0.1.0.war
26-Dec-2015 14:14:08.256 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.
26-Dec-2015 14:14:08.318 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /var/lib/tomcat8/webapps/gs-uploading-files-0.1.0.war has finished in 5,407 ms
26-Dec-2015 14:14:08.320 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/sample
26-Dec-2015 14:14:08.633 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.
26-Dec-2015 14:14:08.639 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/sample has finished in 320 ms
26-Dec-2015 14:14:08.640 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/ROOT
26-Dec-2015 14:14:08.930 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.
26-Dec-2015 14:14:08.932 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 292 ms
26-Dec-2015 14:14:08.936 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/examples
26-Dec-2015 14:14:08.946 WARNING [localhost-startStop-1] org.apache.catalina.startup.SetContextPropertiesRule.begin [SetContextPropertiesRule]{Context} Setting property 'allowLinking' to 'true' did not find a matching property.
26-Dec-2015 14:14:09.644 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.
26-Dec-2015 14:14:09.674 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/examples has finished in 738 ms
26-Dec-2015 14:14:09.674 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /var/lib/tomcat8/webapps/uploading
26-Dec-2015 14:14:13.811 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.
26-Dec-2015 14:14:13.825 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/uploading has finished in 4,151 ms
26-Dec-2015 14:14:13.830 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
26-Dec-2015 14:14:13.840 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
26-Dec-2015 14:14:13.847 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 11035 ms
 
Mike Zang
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Log as below when run java -jar my app.war

2015-12-26 14:43:30.925 INFO 29835 --- [ main] com.zangland.spring.aws.Application : Starting Application on ip-172-31-16-129 with PID 29835 (started by ec2-user in /var/lib/tomcat8/webapps)
2015-12-26 14:43:30.941 INFO 29835 --- [ main] com.zangland.spring.aws.Application : No active profile set, falling back to default profiles: default
2015-12-26 14:43:31.274 INFO 29835 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7b99726: startup date [Sat Dec 26 14:43:31 UTC 2015]; root of context hierarchy
2015-12-26 14:43:32.646 WARN 29835 --- [ main] .i.s.PathMatchingResourcePatternResolver : Skipping [/var/lib/tomcat8/webapps/gs-uploading-files-0.1.0.war] because it does not denote a directory
2015-12-26 14:43:34.302 INFO 29835 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2015-12-26 14:43:35.931 INFO 29835 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-12-26 14:43:35.966 INFO 29835 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-12-26 14:43:35.969 INFO 29835 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.30
2015-12-26 14:43:38.370 INFO 29835 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-12-26 14:43:38.370 INFO 29835 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7111 ms
2015-12-26 14:43:39.263 INFO 29835 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-12-26 14:43:39.270 INFO 29835 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-12-26 14:43:39.270 INFO 29835 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-12-26 14:43:39.271 INFO 29835 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2015-12-26 14:43:39.271 INFO 29835 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2015-12-26 14:43:40.877 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7b99726: startup date [Sat Dec 26 14:43:31 UTC 2015]; root of context hierarchy
2015-12-26 14:43:41.096 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/upload],methods=[GET]}" onto public java.lang.String com.zangland.spring.aws.controller.UploadController.provideUploadInfo()
2015-12-26 14:43:41.101 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/upload],methods=[POST]}" onto public java.lang.String com.zangland.spring.aws.controller.UploadController.handleFileUpload(java.lang.String,org.springframework.web.multipart.MultipartFile,java.lang.String)
2015-12-26 14:43:41.101 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/list],methods=[GET]}" onto public java.util.List<com.amazonaws.services.s3.model.S3ObjectSummary> com.zangland.spring.aws.controller.UploadController.handleList(java.lang.String) throws java.io.IOException
2015-12-26 14:43:41.108 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2015-12-26 14:43:41.108 INFO 29835 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-12-26 14:43:41.117 INFO 29835 --- [ main] o.s.w.s.c.a.WebMvcConfigurerAdapter : Adding welcome page: class path resource [static/index.html]
2015-12-26 14:43:41.171 INFO 29835 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2015-12-26 14:43:41.212 INFO 29835 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-12-26 14:43:41.212 INFO 29835 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-12-26 14:43:41.354 INFO 29835 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-12-26 14:43:41.673 INFO 29835 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2015-12-26 14:43:41.838 INFO 29835 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2015-12-26 14:43:41.848 INFO 29835 --- [ main] com.zangland.spring.aws.Application : Started Application in 12.446 seconds (JVM running for 13.825)
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your Tomcat server log indicates that is has deployed and started the following webapps (context paths):

gs-uploading-files-0.1.0
samples
ROOT (at "/")
examples
uploading

It does not indicate that it found and deployed any WAR named "myapp".

From that, I can only deduce that either you didn't copy myapp.war to /var/lib/tomcat8/webapps/ or if you did, you didn't set its file access rights appropriately for Tomcat to read it.
 
Mike Zang
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Your Tomcat server log indicates that is has deployed and started the following webapps (context paths):

gs-uploading-files-0.1.0
samples
ROOT (at "/")
examples
uploading

It does not indicate that it found and deployed any WAR named "myapp".

From that, I can only deduce that either you didn't copy myapp.war to /var/lib/tomcat8/webapps/ or if you did, you didn't set its file access rights appropriately for Tomcat to read it.


Sorry that I talked not clearly, myapp is gs-uploading-files-0.1.0, I just want to say in basically. I found gs-uploading-files-0.1.0 was deployed but I got 404 if I browse http://myip/gs-uploading-files-0.1.0
Do you know why?
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL you gave does not request port 8080, which is where your log says Tomcat is listening. Probably you have some other server such as Apache httpd listening on port 80, which is the default port for HTTP.

One easy way to tell is that the default "404" page for Tomcat is very distinctive. It's sort of blue-green and specifically mentions Tomcat. Other webservers have different 404 page formats.
 
Mike Zang
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:The URL you gave does not request port 8080, which is where your log says Tomcat is listening. Probably you have some other server such as Apache httpd listening on port 80, which is the default port for HTTP.

One easy way to tell is that the default "404" page for Tomcat is very distinctive. It's sort of blue-green and specifically mentions Tomcat. Other webservers have different 404 page formats.


Here is my error page, what does this mean?
Screen-Shot-2015-12-29-at-1.04.17.jpg
[Thumbnail for Screen-Shot-2015-12-29-at-1.04.17.jpg]
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat 7 and higher support multiple versions of webapps, so maybe it doesn't want the version number in the URL. Although I'd think that the webapp 's context name would have displayed in the log.

Since you have the full default distro running, try running the Tomcat manager webapp (http://myip/) to list the apps and their context paths. You may need to edit the TOMCAT_HOME/conf/tomcat-users.xml file to add/activate a Tomcat manager userid/password and assign management roles to that user as described in the Tomcat documentation.
 
reply
    Bookmark Topic Watch Topic
  • New Topic