|
From: Leif M. <le...@ta...> - 2003-10-31 17:13:05
|
Giovanni,
Ok. So you are running your application within the Wrapper as a
service. In that
case it is easy. There are 3 basic ways of doing this.
1) Use JMX. This requires that your application has JMX support.
http://wrapper.tanukisoftware.org/doc/english/jmx.html
2) Call the WrapperManager.requestThreadDump() method directly from
within your
code. You can then use any number of methods to trigger this event,
such as through
a servlet etc.
3) Add a block of code to your application to make use of the
WrapperActionServer.
This looks like what you were trying to do originally. It should be as
easy as throwing
the following code into your application. You can then telnet in at
port 9999 and hit
shift-D. Note the actions that are needed are commented out.
try
{
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 );
//server.enableAppearHungAction( true );
server.start();
}
catch ( java.io.IOException e )
{
System.out.println( "Unable to open the action server
socket: " + e.getMessage() );
}
Note that methods 2 and 3 both require that the current class uses the same
ClassLoader as the WrapperManager was originally loaded. As I write this
I thought that that might be the cause of the problem you are seeing.
Any JVM
is only able to load a JNI library once. The WrapperManager will be loaded
by the root class loader when the JVM is first launched. If you then
reference
the WrapperManager class from within a different ClassLoader, you have to
make sure that a new copy of that class is not being loaded. If this
happens
then the second copy of the WrapperManager will not be able to load its
native library.
I'll play around with this and see if there is something I can do to
detect when
this happens and display a useful error message.
Cheers,
Leif
Giovanni Regola wrote:
> dear Leif,
>
> I think I wasn't able to clearly explain my problem that I described
> in my previous post (error loading Wrapper.dll)
>
> the problem (and the question) is the following:
>
> how can I get a thread dump of my java application if it has been
> installed as NT Service and has been started from Control Panel -
> Administration tools - Services ?
>
> thanks for your help
>
> best regards
>
> Giovanni
|