aspose file tools*
The moose likes Servlets and the fly likes HTTP Status 404 - /ch1/Serv1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 - /ch1/Serv1" Watch "HTTP Status 404 - /ch1/Serv1" New topic
Author

HTTP Status 404 - /ch1/Serv1

Richard Hayward
Ranch Hand

Joined: Feb 15, 2012
Posts: 69
    
    1
Could anyone help me with what's wrong here?

I'm trying to deploy the first example from HF Servlets & JSP to a Tomcat server.

The example is from p30-31 Ch1Servlet.class with accompanying web.xml.

On my machine I have
javac 1.7.0_01
and Tomcat 7.0

If I put Ch1Servlet.class & web.xml on my local Tomcat server, & go to

http://localhost:8080/ch1/Serv1

it works as expected.

However, I'm also testing deployment to another remote Tomcat 7.0 server.
The remote server has
java version 1.7.0_02

Putting the files on that server & restarting Tomcat results in

HTTP Status 404 - /ch1/Serv1
type Status report
message /ch1/Serv1
description The requested resource (/ch1/Serv1) is not available.

even if I run a browser on that remote machine and try to access the page via localhost.

Looking at tomcat7-stderr.2012-02-15.log
I see errors as listed below, amongst which is the line

Caused by: java.lang.UnsupportedClassVersionError: Ch1Servlet : Unsupported major.minor version 51.0 (unable to load class Ch1Servlet)

I thought that's an error caused by trying to run a java program with a version of java older than the one it was compiled in.
I don't think that's the case here.

Any advice appreciated.

Regards
Richard

///////////////////////////

Feb 15, 2012 11:57:20 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ch1]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1055)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:978)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1329)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:334)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.lang.UnsupportedClassVersionError: Ch1Servlet : Unsupported major.minor version 51.0 (unable to load class Ch1Servlet)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2824)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:358)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:899)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:322)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
... 29 more
Feb 15, 2012 11:57:20 AM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory ch1
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ch1]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:816)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1055)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:978)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1329)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:334)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)


Bharat Kasodariya
Ranch Hand

Joined: Aug 19, 2011
Posts: 36
Yes, it can be because of the compiled code version might be higher then server version.
Joseph Mokenela
Ranch Hand

Joined: Jan 18, 2011
Posts: 61

What happens if you compile it again with the java version on the remote server?
Richard Hayward
Ranch Hand

Joined: Feb 15, 2012
Posts: 69
    
    1
Thanks for your replies.

I've fixed the problem.

When I looked at the Tomcat Server Status page, the JVM version Tomcat was using wasn't the version I got reported at the command line via

C:\>java -version

Seems I can set the location of the jvm via the Tomcat app appearing in the Windows System Tray.


Regards

Richard
Bharat Kasodariya
Ranch Hand

Joined: Aug 19, 2011
Posts: 36
You can set it either by setting JAVA_HOME variable or updating catalina.bat with JAVA_HOME value.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 404 - /ch1/Serv1