|
From: Leif M. <le...@ta...> - 2003-10-31 11:35:52
|
Giovanni,
There are a couple of problems here.
The first problem is that it is not possible to modify the library
path once the JVM has
been launched. You are changing the value in memory which the Wrapper
then uses to
try to figure out why it could not load the wrapper.dll library. The
Wrapper thinks that
the library was on the path but could not be loaded. It then shows the
message that you
are seeing. The problem is that the actual library path that the JVM
uses to load the
libraries is empty.
To fix this, you want to add the following to the command line you
are using to launch
the Wrapper.
java -Djava.library.path=D:\j2sdk1.4.2\tools\wrapper_win32_3.0.5\lib
-classpath path classname
This will get you a little farther but things will still not work
for you. The problem is
that the WrapperActionServer, or more accurately, the WrapperManager
class was not
designed to work the way you are trying to use it.
I tried out your program and discovered a problem that makes it
impossible to kill the
JVM using CTRL-C if a WrapperListener is never registered with the
WrapperManager.
This will be fixed in the net release.
I also noticed that the WrapperManager.requestThreadDump() does not work
correctly when the JVM is not being controlled by the JVM (On
Windows). I am
looking into why that is.
Have you read over the Integration manual yet? It will give you an
idea of how the
Wrapper and its classes were intended to be used.
http://wrapper.tanukisoftware.org/doc/english/integrate.html
If there is a reason why you want to use the Action class without
using the full
Wrapper could you explain it to me? It might be an area worth supporting.
Cheers,
Leif
Giovanni Regola wrote:
> dear experts,
>
> I would like to get a thread dump of my app via telnet.
>
> This is the code:
>
> *package* it.soltec.test;
>
> *import* java.io.IOException;
> *import* java.util.Date;
> *import* java.util.Timer;
> *import* java.util.TimerTask;
> *import* org.tanukisoftware.wrapper.WrapperActionServer;
>
> *public* *class* TestWrapper {
>
> * private* Timer timer = *new* Timer();
> * private* MyTimer myTimer = *new* MyTimer();
> * private* String library = "java.library.path";
> * private* String wrapperDllPath =
> "D:\\j2sdk1.4.2\\tools\\wrapper_win32_3.0.5\\lib";
>
> * public* TestWrapper() {
> * int* port =9999;
> WrapperActionServer server = *new* WrapperActionServer( port );
> server.enableShutdownAction( *true* );
> server.enableHaltExpectedAction( *true* );
> server.enableRestartAction( *true* );
> server.enableThreadDumpAction( *true* );
> server.enableHaltUnexpectedAction( *true* );
> server.enableAccessViolationAction( *true* );
> String property = System.getProperty(library)+";"+wrapperDllPath;
> System.setProperty(library,property);
> System.out.println(System.getProperty(library));
> * try* {
> server.start();
> System.out.println("Server running on port "+port);
> } *catch* (IOException e) {
> e.printStackTrace();
> }
> timer.schedule(myTimer, 0, 5000);
> }
>
> * private* *class* MyTimer *extends* TimerTask {
> * public* *void* run() {
> System.out.println("time: "+*new* Date());
> }
> }
>
> * public* *static* *void* main(String[] args) {
> * new* TestWrapper();
> }
> }
>
> When I try to connect via telnet I get the following error:
>
> D:\j2sdk1.4.2\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Programmi\Microsoft
> SQL Server\80\Tools\Binn\;C:\PROGRA~1\ULTRAE~1;D:\Programmi\Sun
> Microsystems\Message Queue
> 3.0\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Programmi\Microsoft
> SQL Server\80\Tools\Binn\;C:\PROGRA~1\ULTRAE~1;D:\Programmi\Sun
> Microsystems\Message Queue
> 3.0\bin;D:\jakarta-ant-1.5\bin;D:\j2sdk1.4.2\bin;D:\TowerJ\bin\x86-w32;D:\Programmi\Microsoft
> Visual Studio .NET\Vc7\bin;;D:\j2sdk1.4.2\tools\wrapper_win32_3.0.5\lib
> Server running on port 9999
> time: Fri Oct 31 10:39:05 CET 2003
> time: Fri Oct 31 10:39:10 CET 2003
> time: Fri Oct 31 10:39:15 CET 2003
> time: Fri Oct 31 10:39:20 CET 2003
> WARNING - Unable to load native library 'Wrapper.DLL'. The file
> is located on the path at the following location but could
> not be loaded:
> D:\j2sdk1.4.2\tools\wrapper_win32_3.0.5\lib\Wrapper.DLL
> Please verify that the file is readable by the current user
> and that the file has not been corrupted in any way.
> System signals will not be handled correctly.
> wrapper library not loaded.
>
> Do you know how to solve this problem?
>
> thanks in advance
>
> Giovanni Regola
|