https://bz.apache.org/bugzilla/show_bug.cgi?id=58658

            Bug ID: 58658
           Summary: 7.0.66 running with Java 6 fails unless unneeded
                    "tomcat7-websocket.jar" is removed from lib/
           Product: Tomcat 7
           Version: trunk
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: knst.koli...@gmail.com

Running 7.0.66 release candidate (smoke-testing) I see an issue that I think is
caused by r1715984 change in build.xml:

-           source="${compile.source}"
-           target="${compile.target}"
+           source="1.7"
+           target="1.7"

To reproduce:
1. Unpack apache-tomcat-7.0.66.zip
2. Set JAVA_HOME = Java 6
3. Start Tomcat
4. Deployment of every web application fails, including the ROOT one.


INFO: Deploying web application directory
REDACTED\apache-tomcat-7.0.66\webapps\ROOT
26.11.2015 18:54:53 org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
    at
org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1975)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedClassVersionError:
org/apache/tomcat/websocket/server/WsSci : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:249)
    at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1842)
    at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:249)
    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:5460)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
]]]

Solution
---------
The workaround is to remove the following two files from lib directory:
tomcat7-websocket.jar
websocket-api.jar

I guess that removing tomcat7-websocket.jar alone is enough, but I only tested
with removing both of them.

It is known that websocket API (JSR356) requires Java 7, so there is no use for
those jar files when running with Java 6.

Good news:
1. The examples web app runs successfully without those files. (I feared that
it won't start).
2. JSR356 examples successfully show their HTML pages. Attempting to open a
websocket connection fails immediately, as expected.

Thoughts
---------
1. Starting Tomcat 7.0.65 with Java 6 logs a nice warning:

26.11.2015 19:12:19 org.apache.tomcat.websocket.server.WsSci onStartup
INFO: JSR 356 WebSocket (Java WebSocket 1.1) support is not available
when running on Java 6. To suppress this message, run Tomcat on Java 7,
remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs
to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in
$CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7
WebSocket API will be available. 

The above warning message is no longer written by 7.0.66. Tomcat 7.0.66 just
fails.

2. An update to installation instructions (RUNNING.txt) is needed.

Currently it says to unpack the binary archive, but with Java 6 that is no
longer enough.

3. An update to Windows installer is needed.

If I remember correctly, there is no option to omit those jar files when
installing Tomcat.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to