Check programmatically if glassfish is running in debug mode - glassfish

To provide special debug information I want to know if the glassfish server is running in debug mode. Is it possible to check the running mode programmatically?

GlassFish Server offers a REST API for management and monitoring. You can connect to the DAS and parse the jvm options:
http://localhost:4848/management/domain/list-jvm-options.html
or:
http://localhost:4848/management/domain/list-jvm-options.json
or:
http://localhost:4848/management/domain/list-jvm-options.xml
Hope this helps!

Related

Worklight 5.0.6 - How to enable Java remote debugging?

I would like to debug the server part of my Worklight application (java). AFAIK Worklight 5.0.6 uses an embedded Jetty HTTP server. I wonder how it's possible to enable remote debugging for this process so I can set breakpoints, watch scope variables and so on?
Thank you in advance,
spyro
In Worklight 5.0.6, where the Jetty application server is used, Java debugging is not possible.
A possible solution, in case you are an IBM Worklight customer is to deploy Worklight on WAS Liberty, where you should be able to do this.

JBoss AS7 remote debugging and deploying

I install JBoss AS on VPS. I forward ports and I can access to server form my local machine. It is any possibility to add this server to Eclipse IDE?
I expect the same effect debugging and deploying to remote instance of jboss.
Best regards
Do you try eclipse jboss tools plugin?
http://marketplace.eclipse.org/node/121986#.ULYXteMSXk4
OK.
Look at this tutorial from point 5.
http://www.glxn.net/seam-maven-refimpl/doc/tutorial/02-eclipse.html

Server port 9081 is in use, starting Websphere Application Server in RAD

very quick question regarding an issue I never seen before. I've being using RAD 6 for java development, with Websphere portal server 5.0 installed. When I trying to start the server, I get the following error in a popup:
Which none of what's described is the true in my case...and still the case even though I rebooted the PC, as well as checking for any redundant javaw.exe processes.
Thanks for you help
I asked a colleague, they suggested that you have a server set up which is defined to run as a service. Since the service will start automatically with Windows, rebooting won't help.
Check your services.msc and see if there's a service for WebSphere, then try stopping it and starting your server from within RAD.
Do one thing, if it's possible. Just go to running programs and check for any java.exe and stop/delete all of them. And try restarting your server. And check if it makes any sense.
Hope it helps.
//HP
Start command prompt (if you're on Windows Vista and up, ensure you start it in admin mode).
Type:
netstat -a -b
This will show you all ports being listened. Look for 9081, and then you'll be able to see the process that is capturing that port.
Which process was it?
An easiest way to do so is kill the jawa/javaw process from the taskmanager.
And then start the server.

What is the use of configuring management.properties in profiling remote JVM

It is required to configure management.properties in 'jre_home\lib\management' to enable remote monitoring. But even after configuring the required properties below
com.sun.management.jmxremote.port=<portNum>
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false
I was not able to connect to remote JVM with the : given using JConsole or JVisualVM. So in addition to this configuration do I need to make any code changes to enable remote JVM profiling (like creating a JMX server)?
Since i'm configuring management.properties, that will affect all java application using that JRE. So in that context how can profile each application?
So in summary, is it possible to profile a remote JVM by configuring some properties and not making any code changes?
What version of JDK do you use? In pre JDK 1.6 version you should specify -Dcom.sun.management.jmxremote or -Dcom.sun.management.jmxremote.port in the application you want to monitor with JConsole.
In JDK 1.6 it should work unless you specify -XX:-DisableAttachMechanism.

jvisualvm doesn't list certain Java processes

I want to get a heap dump (suspected memory leak) of a certain Java process. However, when I start the jvisualvm tool, I cannot see any of the running Java processes.
I have Google'd around about this and have already found a couple of articles saying that you have to run the Java processes using the same JDK that you start the jvisualvm tool with in order for it to be able to see them. However, as far as I can see, this is already the case. I'm doing everything locally (I have remote access to the machine).
A couple of things to consider:
The processes are running on a firewalled Windows 2008 server
The processes are running using renamed versions of the JDK java.exe executable
As far as I can see the processes are running using the 1.6.0_18 JDK
One of the running processes starts an RMI registry
I'm waiting on a virtualized copy of the server so I can mess around with it (this is a production server). But in the meanwhile; any ideas as to why I cannot see any of the processes in jvisualvm (or jconsole for that matter)?
Well after I did a little research, it would appear that Peter's comment was correct. Because the JVM processes were launched by another user (the NETWORK SERVICE account because they were being started by a Windows service) they didn't show up in jvisualvm.
Workaround
Since I have access to the application configuration, I have found the following workaround, which involves explicitly enabling unsecured JMX for the target JVM:
Add the following JVM parameters:
-Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Add the remote process to jvisualvm using JMX by click File -> Add JMX Connection. You can connect to the process using port 3333. Obviously you can change the port if you want.
Link to article explaining this in a little more detail: http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/jmx_connections.html
Notes
It's probably not a good idea to keep the JVM settings permanently, as they would allow anyone to connect to the JVM via JMX.
You can also add authentication to the JMX JVM parameters if you want to.
The simplest way is to execute jvisualvm as administrator (win: "run as administrator"). Which is not ideal but works. All java processes are visible then.