jWebSocket Forum

[Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
NullPointer Exception when trying to implement a sample token server.  XML
Forum Index » Installation and Configuration
Author Message
stephezapo

jWebSocket Forum User

Joined: 22/04/2012 14:31:52
Messages: 2
Offline

Hello,

I am new to jWebSocket and trying to use it now with my own applications.

I downloaded the server and client package, extracted it into a folder and set the JWEBSOCKET_HOME accordingly.
The server bat script works fine, I can use the demos provided in the client package.

No I am trying to implement my own server in netbeans.

I added the libraries jWebSocket-Common, ...-Server and -ServerAPI to my project and wrote the following:



In a main class I instantiate a new class object and call init(), but the JWebSocketFactory.start() returns a nullPoint Exception

java.lang.NullPointerException
at org.jwebsocket.factory.JWebSocketFactory.start(JWebSocketFactory.java:119)
at org.jwebsocket.factory.JWebSocketFactory.start(JWebSocketFactory.java:83)
at webserver.WebSocketServer.init(WebSocketServer.java:2
at webserver.WebServer.main(WebServer.java:19)


What is wrong here?
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 372
Location: Germany, Herzogenrath
Offline

Hi stephezapo,

these are the first two lines which are mandatory to start up the server:Please insert these lines and the server should start up, don't hesitate to contact us again in case of further questions.

Best Regards
Alex
[WWW]
stephezapo

jWebSocket Forum User

Joined: 22/04/2012 14:31:52
Messages: 2
Offline

That worked, thank you very much! initForConsoleApp() was missing in my code.

sanjay

jWebSocket Forum User

Joined: 17/05/2012 11:38:54
Messages: 2
Offline

jwebsocket config.init for console(aArgs);
hello sir,
i am not able to understand, that what should i pass here in jwebsocket config.init for console(____what to pass______);

sanjay

jWebSocket Forum User

Joined: 17/05/2012 11:38:54
Messages: 2
Offline

Error initializing engine based on given configuration
i m also facing above error
JayJay

jWebSocket Forum User

Joined: 21/02/2012 12:42:55
Messages: 21
Offline

Do i still need this in the newest Version?

i don't have this method in my org.jwebsocket.config.JWebSocketConfig Class??

initForConsoleApp(aArgs);

What exactly is it doing?


Btw it seems like in the newest version there is no standard Tokenserver starting automatically? When i use the getServers method at the WebSocketFactory i get null as answer. is that correct?

This message was edited 1 time. Last update was at 24/05/2012 15:29:45

simpligility

jWebSocket Forum User

Joined: 21/06/2012 23:36:38
Messages: 1
Offline

I just fixed this problem in my test and I had to do this:

public void contextInitialized(ServletContextEvent aSCE) {
// http://enapso.org/jwsForum219/posts/list/15619.page
// the following line must not be removed due to GNU LGPL 3.0 license!
JWebSocketFactory.printCopyrightToConsole();

// check if home, config or bootstrap path are passed by command line
JWebSocketConfig.initForWebApp(aSCE.getServletContext());

// start the jWebSocket server sub system
JWebSocketFactory.start();

Is that the correct approach?
[Email] [WWW]
 
Forum Index » Installation and Configuration
Go to:   
Powered by JForum 2.1.9 © JForum Team