tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marek Jagielski <marek.jagiel...@gmail.com>
Subject tomcat7-websocket - tomcat7-maven-plugin java.lang.ClassNotFoundException: javax.servlet.http.HttpUpgradeHandler
Date Thu, 07 Nov 2013 14:45:49 GMT
Hello,
I am migrating my websocket application to the new API with version 7.0.47.
How can correctly make a configuration of tomcat7-maven-plugin to use
tomcat7-websocket on localhost.
Here what I have in my pom:
...
<dependencies>
  ...

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-catalina</artifactId></dependency>

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-coyote</artifactId></dependency>

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat7-websocket</artifactId></dependency>
</dependencies>
     ...
</plugins>
  <plugin>

<groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId>
                    <configuration>
                        <url></url>
                        <server></server>
                        <path>/</path>
                        <port>7443</port>
                        <httpsPort>0</httpsPort>
                        <keystorePass>catmot</keystorePass>

<tomcatUsers>src/main/tomcatconf/tomcat-users.xml</tomcatUsers>
                </configuration>
            </plugin>
  </plugins>
  </build>
</project>


and my parent pom:
...
<dependencyManagement>
...
  <dependencies>

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-catalina</artifactId><version>7.0.47</version><scope>provided</scope></dependency>

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-coyote</artifactId><version>7.0.47</version><scope>provided</scope></dependency>

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat7-websocket</artifactId><version>7.0.47</version><scope>provided</scope></dependency>
<dependency><groupId>javax</groupId><artifactId>javaee-web-api</artifactId><version>6.0</version><scope>provided</scope></dependency>
  </dependencies>
</dependencyManagement>
...

  <pluginManagement>
  <plugins>
<plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.1</version>
<dependencies>
<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-catalina</artifactId><version>7.0.47</version><scope>runtime</scope></dependency>
<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-coyote</artifactId><version>7.0.47</version><scope>runtime</scope></dependency>
<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat7-websocket</artifactId><version>7.0.47</version><scope>runtime</scope></dependency>
</dependencies> </plugin>
  </plugins>
        </pluginManagement>
  </build>
</project>


When using simple server end point

@ServerEndpoint(value="/connector")
public class MachineWsConnector {
    @OnOpen
    public void onOpen(Session session) { }

  @OnClose
  public void onClose(Session session, CloseReason closeReason) { }
}

and trying to connect with client with:

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
container.connectToServer(Client.class, new
URI("ws://localhost:7443/connector"));

I get error on client side:
Exception in thread "main" javax.websocket.DeploymentException: The HTTP
response from the server [HTTP/1.1 500 Internal Server Error
] did not permit the HTTP upgrade to WebSocket
at
org.apache.tomcat.websocket.WsWebSocketContainer.parseStatus(WsWebSocketContainer.java:601)
at
org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:585)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:317)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:183)
at
org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:204)
at com.systemincloud.api.machine.java.Client.main(Client.java:49)

and on server side:

java.lang.ClassNotFoundException: javax.servlet.http.HttpUpgradeHandler
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:788)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2918)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at
org.apache.tomcat.websocket.server.UpgradeUtil.doUpgrade(UpgradeUtil.java:174)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
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:724)

Thanks in advance,

Marek

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message