4 Replies Latest reply on Jul 27, 2013 5:23 AM by Dirk Gerrit Oort

    ContainerProvider.getWebSocketContainer() throws Could not find an implementation class

    Dirk Gerrit Oort Newbie

      Hello

       

      I'm trying to create a clientEndpoint to connect to my ServerEndpoint, in order to create an server - sever connection via websockets.

       

      There for i've create the method  :

       

      @Singleton

      @LocalBean

      public class SenderBean {

       

          private static final String WS_URI= .....

       

      public void start(){

              WebSocketContainer container = ContainerProvider.getWebSocketContainer();

              System.out.println("Connection to " + WS_URI);

             

              try {

                  session = container.connectToServer(HelloClient.class, URI.create( WS_URI));

                 

              } catch (DeploymentException | IOException e) {

                  // TODO Auto-generated catch block

                  e.printStackTrace();

              }

          }

       

          public void sendMessage(String text){

              if(session == null){

                  start();

              }

             

              if(text != null && session != null){

                 

                  try {

                      session.getBasicRemote().sendText(text);

                  } catch (IOException e) {

                      // TODO Auto-generated catch block

                      e.printStackTrace();

                  }

                 

              }

          }

      }

      The call to get an instance of the webSocketContiner (ContainerProvider.getWebSocketContainer())  fails with

       

      Caused by: java.lang.RuntimeException: Could not find an implementation class.

          at javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:73) [jboss-websocket-api_1.0_spec-1.0.0.Beta1.jar:1.0.0.Beta1]

          at server.SenderBean.start(SenderBean.java:27) [classes:]

          at server.SenderBean.sendMessage(SenderBean.java:41) [classes:]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_17]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_17]

          at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_17]

          at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

          at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:130) [wildfly-weld-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:138) [wildfly-weld-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

          at org.jboss.as.ejb3.concurrency.ContainerManagedConcurrencyInterceptor.processInvocation(ContainerManagedConcurrencyInterceptor.java:104) [wildfly-ejb3-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:406)

          at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46) [weld-core-impl-2.0.2.Final.jar:2013-06-27 10:15]

          at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84) [wildfly-weld-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

          at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:52) [wildfly-ejb3-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:273) [wildfly-ejb3-8.0.0.Alpha3.jar:8.0.0.Alpha3]

          ... 106 more

       

      What do i wrong?