|
From: Andreas W. <And...@ag...> - 2006-08-08 09:55:59
|
Hi tweety123,
first of all, the second argument of the start method is meant to pass =
the command line arguments from the main method. If you do not need =
them, the
array may be null or empty.
Your problem arises from the fact that you use an object that has not =
been initialized in the following line (38 as mentioned in the stack =
trace):=20
socket_pgm.createSocket();
I do not see any code that creates the object (e.g. socket_pgm =3D new =
SocketPgm()).
-Andreas
-----Original Message-----
From: wra...@li... =
[mailto:wra...@li...] On Behalf Of =
tweety123
Sent: Dienstag, 8. August 2006 11:17
To: wra...@li...
Subject: [Wrapper-user] Error in WrapperListener.start callback.
Hi,
I don't understand what the second argument means in =
"WrapperManager.start(WrapperListener listener, java.lang.String[] =
args)".
Also, I wrote a sample code. Am getting the following error when =
trying to execute it:
"Wrapper (Version 3.2.1) http://wrapper.tanukisoftware.org
Error in WrapperListener.start callback.=20
java.lang.NullPointerExceptionjava.lang.NullPointerException
at Test.JSWrapper.start(JSWrapper.java:38)
at
org.tanukisoftware.wrapper.WrapperManager.startInner(WrapperManager.java:=
3125)
at
org.tanukisoftware.wrapper.WrapperManager.privilegedStart(WrapperManager.=
java
:2109)
at
org.tanukisoftware.wrapper.WrapperManager.access$2400(WrapperManager.java=
:416)
at
org.tanukisoftware.wrapper.WrapperManager$5.run(WrapperManager.java:2044)=
at java.security.AccessController.doPrivileged (Native Method)
at
org.tanukisoftware.wrapper.WrapperManager.start(WrapperManager.java:2041)=
at Test.JSWrapper.main(JSWrapper.java:73)"
Can someone please throw light on this?
This is the implementation of WrapperListener that I have:
package Test;
import org.tanukisoftware.wrapper.WrapperListener;
import org.tanukisoftware.wrapper.WrapperManager;
public class JSWrapper implements WrapperListener {
SocketPgm socket_pgm;
private boolean status =3D false;=20
=20
public JSWrapper()
{
=20
}
=20
public void displayHi()
{
System.out.println("Hi");
}
=20
public Integer start(String args[])
{
status =3D true;
System.out.println("Status =3D "+status);
socket_pgm.createSocket();
return null;
=20
}
=20
=20
public int stop(int exitCode)
{
status =3D false;
System.out.println("Status =3D "+status);
return exitCode;
}
=20
=20
public void controlEvent(int event)
{
if (WrapperManager.isControlledByNativeWrapper()) {
// The Wrapper will take care of this event
} else {
// We are not being controlled by the Wrapper, so
// handle the event ourselves.
if ((event =3D=3D WrapperManager.WRAPPER_CTRL_C_EVENT) =
||
(event =3D=3D =
WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) ||
(event =3D=3D =
WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT )){
WrapperManager.stop(0);
}
}
}
=20
=20
public static void main(String[] args)
{
String[] arg =3D new String[2];
arg[0] =3D "Hi";
arg[1] =3D "hello";
WrapperManager.start(new JSWrapper(), arg);
}
}
where SocketPgm is a program that creates a server socket & waits on =
a port for connections.
Please throw some light on how to resolve this error.
Thanks.
--
View this message in context: =
http://www.nabble.com/Error-in-WrapperListener.start-callback.-tf2071532.=
html#a5702990
Sent from the Java Service Wrapper forum at Nabble.com.
-------------------------------------------------------------------------=
Using Tomcat but need to do more? Need to support web services, =
security?
Get stuff done quickly with pre-integrated technology to make your job =
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642
_______________________________________________
Wrapper-user mailing list
Wra...@li...
https://lists.sourceforge.net/lists/listinfo/wrapper-user
|