[TYRUS-77] The org.glassfish.tyrus.spi.grizzlyprovider.GrizzlyEngine throws a NullPointerException when it starts. Created: 30/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

Status: Resolved
Project: tyrus
Component/s: None
Affects Version/s: 1.0-b11
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: Mohamed Taman Assignee: Pavel Bucek
Resolution: Invalid Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 SP1
Java SE 7_u11

Maven Jars(dependencies)

    
 <dependency>
        <groupId>org.glassfish.tyrus</groupId>
        <artifactId>websocket-impl</artifactId>
        <version>1.0-b06</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.tyrus</groupId>
        <artifactId>websocket-provider-grizzly</artifactId>
        <version>1.0-b06</version>
    </dependency>
     <dependency>
        <groupId>javax.websocket</groupId>
        <artifactId>javax.websocket-api</artifactId>
        <version>1.0-b11</version>
 </dependency>

Tags: adoptajsr

 Description   

In my project pom.xml, I have upgraded my dependencies of the following artifacts

websocket-impl From: 1.0-b04 To: 1.0-b06
websocket-provider-grizzly From: 1.0-b04 To: 1.0-b06
javax.net.websocket-api From: 1.0-b04 To: javax.websocket-api 1.0-b11

Code:

HelloWebSocketEndpoint.java (Endpoint)
/**
 * @author Mohamed Taman
 * @version 1.0b
 * @since JSR356 - WS-API b11
 *
 */
@WebSocketEndpoint(value = "/hello",configuration=DefaultServerConfiguration.class)
public class HelloWebSocketEndpoint {

   @WebSocketOpen
   public void onConnectionEstablished() {
      
      System.out.println("Session is opened ");

   }

   @WebSocketMessage
   public void echo(String message, Session session) {
      try {
         // Echo the message back to sender.
         session.getRemote().sendString(message + " From Endpoint");
      } catch (IOException ex) {
         Logger.getLogger(HelloWebSocketEndpoint.class.getName()).log(Level.SEVERE, null, ex);
      }

   }

   @WebSocketClose
   public void onConnectionClosed(Session session) throws IOException {
      System.out.println("Session will be closed");
      session.close();
   }
}
Main.java (Deployer)
* @author Mohamed Taman
 */
public class Main {
   
   public static void main(String[] args) {
      
         Server server = new Server("localhost",8025,"/example",HelloWebSocketEndpoint.class);
      try {   
        server.start();
         System.out.println("Press any key to exit");
         System.in.read();
      } catch (IOException ex) {
         Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
      }finally{
         server.stop();
         System.out.println("Server stopped.");
      }
      
   }
}
Throws The following error

Jan 30, 2013 4:57:36 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [0.0.0.0:8025]
Jan 30, 2013 4:57:36 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Jan 30, 2013 4:57:36 PM org.glassfish.tyrus.platform.BeanServer setEngine
INFO: Provider class instance: org.glassfish.tyrus.spi.grizzlyprovider.GrizzlyEngine@ce124a7 of class class org.glassfish.tyrus.spi.grizzlyprovider.GrizzlyEngine assigned in the BeanServer
Jan 30, 2013 4:57:36 PM org.glassfish.tyrus.platform.BeanServer <init>
INFO: Provider class loaded: org.glassfish.tyrus.spi.grizzlyprovider.GrizzlyEngine
java.lang.NullPointerException
Press any key to exit
at org.glassfish.tyrus.platform.BeanServer.getMethodToPathMap(BeanServer.java:166)
at org.glassfish.tyrus.platform.BeanServer.initWebSocketServer(BeanServer.java:137)
at org.glassfish.tyrus.platform.main.Server.start(Server.java:136)
at eg.com.tm.ws1_0.example.hw.Main.main(Main.java:22)
Jan 30, 2013 4:57:36 PM org.glassfish.tyrus.platform.main.Server start
INFO: WebSocket Registered apps: URLs all start with ws://localhost:8025
Jan 30, 2013 4:57:36 PM org.glassfish.tyrus.platform.main.Server start
INFO: WebSocket server started.



 Comments   
Comment by Pavel Bucek [ 30/Jan/13 ]

1.0-b06 does not implement javax.websocket-api:1.0-b11.

please try tyrus version 1.0-b10:

        <dependency>
            <groupId>org.glassfish.tyrus</groupId>
            <artifactId>tyrus-container-grizzly</artifactId>
            <version>1.0-b10</version>
        </dependency>

(all other dependencies are redundant)

Comment by Pavel Bucek [ 30/Jan/13 ]

feel free to reopen/post questions to users@tyrus.java.net

Generated at Thu Mar 05 07:45:07 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.