title: Websocket with Tyrus in Openshift
body: <p>I deployed an Wildfly 8.1 java application using Tyrus to manage a websocket server, nothing too complicated, it just receives the message and respond the message reversed, well, it should work, everything is according to OpenShift tutorial, but on deploy, I get this message on the rhc tail:</p>
  
  <pre><code>2015-01-02 21:16:19,314 ERROR [io.undertow.websockets.jsr] (MSC service thread 1
  -2) UT026002: Unable to instantiate server configuration class org.glassfish.tyr
  us.server.TyrusServerConfiguration: java.lang.InstantiationException: org.glassf
  ish.tyrus.server.TyrusServerConfiguration
          at java.lang.Class.newInstance(Class.java:418) [rt.jar:1.8.0_05]
          at org.wildfly.extension.undertow.deployment.UndertowJSRWebSocketDeploym
  entProcessor.doDeployment(UndertowJSRWebSocketDeploymentProcessor.java:213)
          at org.wildfly.extension.undertow.deployment.UndertowJSRWebSocketDeploym
  entProcessor.deploy(UndertowJSRWebSocketDeploymentProcessor.java:165)
          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(Deplo
  ymentUnitPhaseService.java:159)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
  rviceControllerImpl.java:1948)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
  rollerImpl.java:1881)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
  java:1142) [rt.jar:1.8.0_05]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
  .java:617) [rt.jar:1.8.0_05]
          at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05]
  Caused by: java.lang.NoSuchMethodException: org.glassfish.tyrus.server.TyrusServ
  erConfiguration.&lt;init&gt;()
          at java.lang.Class.getConstructor0(Class.java:2971) [rt.jar:1.8.0_05]
          at java.lang.Class.newInstance(Class.java:403) [rt.jar:1.8.0_05]
          ... 8 more
  </code></pre>
  
  <p>And when I try to connect to the socket, I can connect, but it work as a previous version of it(that didnt reverse).</p>
  
  <p>Here is the Websocket server source:</p>
  
  <pre><code>@ServerEndpoint(value = "/socket")
  public class WebSocket {
  
      private Logger logger = Logger.getLogger(this.getClass().getName());
      private Reconhecedor reconhecedor = new Reconhecedor();
  
      @OnOpen
      public void onOpen(Session session) {
          logger.info("Connected Recognizer ... " + session.getId());
      }
  
      @OnMessage
      public String onMessage(String message, Session session) {
          logger.info("String message arrived");
  
          return new StringBuilder(message).reverse().toString();
      }
  
      @OnMessage
      public String onMessage(ByteBuffer message, Session session) {
          logger.info("byte message arrived");
          String result = "";
          ByteArrayInputStream baiut = new ByteArrayInputStream(message.array());
          AudioInputStream ais;
          try {
              ais = AudioSystem.getAudioInputStream(baiut);
              result = reconhecedor.Recognize(ais);
              logger.info("returning: " + result);
              //session.close(new CloseReason(CloseCodes.NORMAL_CLOSURE, "Game ended"));
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          return result;
      }
  
      @OnClose
      public void onClose(Session session, CloseReason closeReason) {
          logger.info(String.format("Session %s closed because of %s", session.getId(), closeReason));
      }
  }
  </code></pre>
  
  <p>And also, my server source:</p>
  
  <pre><code>public class Programa {
  
      public static void main(String[] args) {
          runServer();
      }
  
      public static void runServer() {
  
          String ip = System.getenv("OPENSHIFT_WILDFLY_IP");
          int port = 8000; 
  
          Server server = new Server(ip, port, "", WebSocket.class);
  
          try {
              server.start();
              System.out.print("Please press a key to stop the server.");
              System.in.read();
          } catch (Exception e) {
              throw new RuntimeException(e);
          } finally {
              server.stop();
          }
      }
  }
  </code></pre>
  
  <p>I'm kinda lost, dont know what else to do, seems like javascript websocket is so much simple and works well, but I need it java because I'm going to use that socket for Sphinx CMU.</p>
  
  <p>Any help is appreciated, thanks in advance!</p>