Basically I am trying to create a simple Hello World program using Rational Software Architect. To create the server I use Tomcat and Jersey. I found that when I create the server without putting the jersey jar files into WEB-INF/lib but rather I create a custom user library with all the jar files, Tomcat will compile fine but the url will not load the "Hello World" text, just a 404 error. I simple do http://localhost:8080/project name/rest/class path name and nothing will come up. I think its because I don't have the jersey files in WEB-INF/lib but when I put the jersey jar files in that folder and try to run the tomcat server, i get a "Server Tomcat v7.0 Server at localhost failed to start." error.
Please help me out and thanks in advance.
Jun 10, 2015 12:56:28 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:RestHello' did not find a matching property.
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.62
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 7 2015 17:14:55 UTC
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.62.0
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1 build 7601 Service Pack 1
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\SDP80x\jdk\jre
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: jvmwi3260sr9-20110324_78506
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: IBM Corporation
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\EzraZWS\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\RESTWS\Tomcat 7.0
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xjcl:jclscar_24
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcom.ibm.oti.vm.bootstrap.library.path=C:\SDP80x\jdk\jre\bin
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dsun.boot.library.path=C:\SDP80x\jdk\jre\bin
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.library.path=C:\SDP80x\jdk\jre\bin;.;C:/SDP80x/jdk/jre/bin/j9vm;C:/SDP80x/jdk/jre/bin;C:/SDP80x/jdk/jre/lib/i386;c:\eip40\tibco\tibrv\8.4\bin;C:\eip40\tibco\tibrv\8.3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\RationalSDLC\ClearCase\bin;C:\RationalSDLC\common;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files\Dell\Dell Data Protection\Encryption\;C:\Program Files (x86)\nodejs\;C:\SDP80x\jdk\bin;;C:\SDP80x;
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.home=C:\SDP80x\jdk\jre
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.ext.dirs=C:\SDP80x\jdk\jre\lib\ext
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Duser.dir=C:\SDP80x
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: _j2se_j9=71168
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xdump
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.class.path=c:\eip40\tibco\tibrv\8.4\lib\tibrvnative.jar;C:\eip40\tibco\tibrv\8.3\lib\tibrvnative.jar;C:\SDP80x\jdk\bin;
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\EzraZWS\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\RESTWS\Tomcat 7.0
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\EzraZWS\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\RESTWS\Tomcat 7.0\endorsed
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.class.path=C:\RESTWS\Tomcat 7.0\bin\bootstrap.jar;C:\RESTWS\Tomcat 7.0\bin\tomcat-juli.jar;C:\SDP80x\jdk\lib\tools.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-client.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-common.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-container-servlet.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-container-servlet-core.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-media-jaxb.jar;C:\EzraZWS\RestHello\WebContent\WEB-INF\lib\jersey-server.jar
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dsun.java.command=org.apache.catalina.startup.Bootstrap start
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dsun.java.launcher=SUN_STANDARD
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: _port_library
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: _org.apache.harmony.vmi.portlib
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\SDP80x\jdk\jre\bin;.;C:/SDP80x/jdk/jre/bin/j9vm;C:/SDP80x/jdk/jre/bin;C:/SDP80x/jdk/jre/lib/i386;c:\eip40\tibco\tibrv\8.4\bin;C:\eip40\tibco\tibrv\8.3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\RationalSDLC\ClearCase\bin;C:\RationalSDLC\common;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Program Files\Dell\Dell Data Protection\Encryption\;C:\Program Files (x86)\nodejs\;C:\SDP80x\jdk\bin;;C:\SDP80x;
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 559 ms
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.62
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
Throwable occurred: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
at java.util.concurrent.FutureTask.get(FutureTask.java:94)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:736)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer, offset=6
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:540)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
at java.net.URLClassLoader.access$300(URLClassLoader.java:79)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1038)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at java.net.URLClassLoader.findClass(URLClassLoader.java:429)
at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:645)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:172)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1707)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:172)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:192)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:157)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1577)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1281)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
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:5416)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
Throwable occurred: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RestHello]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
at java.util.concurrent.FutureTask.get(FutureTask.java:94)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:736)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RestHello]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer, offset=6 (unable to load class org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2961)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1210)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1690)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:172)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:192)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:157)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1577)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1281)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
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:5416)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
Throwable occurred: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
at java.util.concurrent.FutureTask.get(FutureTask.java:94)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:736)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Jun 10, 2015 12:56:28 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
Throwable occurred: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2015 12:56:28 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jun 10, 2015 12:56:28 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
My code:
package RestHello;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path ("/hello")
public class Hello {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayHello() {
return "Hello";
}
}
and my web.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>RestHello</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<!-- Register resources and providers under com.vogella.jersey.first package. -->
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>RestHello</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>