Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sun JDK and JVisualVM debugging AXIS2/Tomcat7
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1557
Location: Adelaide/Australia

PostPosted: Tue Mar 13, 2012 12:54 am    Post subject: Sun JDK and JVisualVM debugging AXIS2/Tomcat7 Reply with quote

I have an AXIS2 web service which I am trying determine if it has a memory leak.

I use Sun JDK on my amd64 Gentoo system.

I have configured Tomcat7 to start with debugging enabled, by updating TOMCAT_START="jpda start" in /etc/conf.d/tomcat-7
I have Tomcat 7 running under user 'tomcat'
I run jvisualvm as root, it's easier than running as 'tomcat' and tomcat shows up in the list of local VM's
I can connect and see the heap, classes and threads, I cannot see the CPU, for some reason.
I am also unable to generate a Heap Dump (I was planning on doing a before and after).
Nor can I use memory profiling.

Any suggestions as to what is wrong?

My java config is as follows...
Code:

root@lyalls-pc /
# eselect java-vm list
Available Java Virtual Machines:
  [1]   icedtea-7
  [2]   sun-jdk-1.6  system-vm
  [3]   sun-jre-bin-1.6

root@lyalls-pc /
# java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
root@lyalls-pc /
#


The jvisualvm log entry that I think is appropriate is
Code:
attach settings -----------------------------------
target type =
server type =
remote =false
direct =false
dynamic JDK16 =true
pid =11544
host =
host os =Linux, 64bit JVM
transient port =-1

instrumentation filter ----------------------------
  Filter type: Inclusive
  Filter value: 

Profiler.attachToApp: ***************************************************
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.netbeans.modules.profiler.NetBeansProfiler$2.loadAgentIntTargetJVM(NetBeansProfiler.java:901)
   at org.netbeans.modules.profiler.NetBeansProfiler$2.doInBackground(NetBeansProfiler.java:851)
   at org.netbeans.lib.profiler.ui.SwingWorker$2.run(SwingWorker.java:116)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
   at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:82)
   at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:46)
   at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195)
   ... 9 more
INFO [com.sun.tools.visualvm.attach.AttachModelImpl]: takeHeapDump
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
   at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:82)
   at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:46)
   at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195)
   at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:124)
Caused: java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded
   at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:126)
   at com.sun.tools.visualvm.attach.AttachModelImpl.takeHeapDump(AttachModelImpl.java:65)
   at com.sun.tools.visualvm.jvm.JVMImpl.takeHeapDump(JVMImpl.java:360)
[catch] at com.sun.tools.visualvm.heapdump.impl.HeapDumpProvider$1.run(HeapDumpProvider.java:97)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
INFO [com.sun.tools.visualvm.attach.AttachModelImpl]: getSystemProperties
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
   at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:82)
   at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:46)
   at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195)
   at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:124)
Caused: java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded
   at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:126)
   at com.sun.tools.visualvm.attach.AttachModelImpl.getSystemProperties(AttachModelImpl.java:56)
   at com.sun.tools.visualvm.jvm.JVMImpl.getSystemProperties(JVMImpl.java:286)
   at com.sun.tools.visualvm.profiler.ProfilerSupport.checkJDKCalibration(ProfilerSupport.java:215)
   at com.sun.tools.visualvm.profiler.ApplicationProfilerView$MasterViewSupport.startProfiling(ApplicationProfilerView.java:325)
   at com.sun.tools.visualvm.profiler.ApplicationProfilerView$MasterViewSupport.access$900(ApplicationProfilerView.java:157)
[catch] at com.sun.tools.visualvm.profiler.ApplicationProfilerView$MasterViewSupport$5.run(ApplicationProfilerView.java:304)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)

_________________
...Lyall
Back to top
View user's profile Send private message
lostinspace2011
Apprentice
Apprentice


Joined: 09 Sep 2005
Posts: 230

PostPosted: Mon Jul 28, 2014 4:00 am    Post subject: Reply with quote

Having the same issue. Did you ever find a work-around ?
Back to top
View user's profile Send private message
lostinspace2011
Apprentice
Apprentice


Joined: 09 Sep 2005
Posts: 230

PostPosted: Mon Jul 28, 2014 4:19 am    Post subject: Reply with quote

I ended up changing the home directory in /etc/passwd for the tomcat user from /dev/null to an existing directory.

Running :

Code:
sudo -u tomcat jvisualvm


works now.
Back to top
View user's profile Send private message
Shamus397
Apprentice
Apprentice


Joined: 03 Apr 2005
Posts: 218
Location: Ur-th

PostPosted: Fri Sep 13, 2019 5:16 pm    Post subject: Reply with quote

This did not work for me. I had to run
Code:
xhost local:tomcat

as my user for it to run properly. Also, I had to set the home dir and shell in /etc/passwd for the tomcat user. Once that was done, I could start it with:
Code:
su - tomcat -c visualvm &

from a root login. This is with Tomcat 9 and IcedTea.

N.B.: Unless you run VisualVM as the tomcat user, you will not get any useful debugging information.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum