tiger154 / jwebsocket

Automatically exported from code.google.com/p/jwebsocket
1 stars 0 forks source link

jwebsocket will not run on tomcat without JWEBSOCKET_HOME defined (fix suggested) #135

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download the r1820 source tree, compile, and run on tomcat via dropping the 
compiled jars into the lib folder.
2. Don't define a JWEBSOCKET_HOME environment variable
3. jwebsocket crashes on startup.

Sorry, I don't have a stack trace handy since I already fixed the bug on my 
checkout. Here's a simulated stack trace instead. It should have all the info 
you need.

NullPointerException
org.jwebsocket.factory.JWebSocketFactory.setProperties()
...
org.jwebsocket.factory.JWebSocketFactory.start()
...

What is the expected output? What do you see instead?
Start the server on tomcat without crashing

What version of the product are you using? On what operating system?
r1820 on Ubuntu Linux with java:
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

Please provide any additional information below.

Here's a fix that worked for me:

public static void setProperties() {
        String val = System.getenv(JWebSocketServerConstants.JWEBSOCKET_HOME);
        if( val != null )
        {
            System.setProperty(JWebSocketServerConstants.JWEBSOCKET_HOME, val);
        }
    }

Basically, the properties class won't accept null values. I chose to just not 
set the property, but you could put in some other default value if that's 
better.

Original issue reported on code.google.com by cuc...@gmail.com on 2 Oct 2011 at 7:45

GoogleCodeExporter commented 9 years ago
this issue relates to issue #149 "JWEBSOCKET_HOME override/ignore"

Original comment by eliasbal...@gmail.com on 8 Jan 2012 at 3:37