Skip to main content

Jetty and Solaris 10

Posted by claudio on July 16, 2008 at 10:31 AM PDT

This is a contribution to Jetty Web Server, to allow SMF on Solaris 10 machines to manage Jetty servers, see the benefits

  • Allow non-root users to bind to privileged port
  • Watchdog service (can restart server if process is down for unknown reason)
  • Standard use of SMF service

So what is SMF ? It stands for Service Management Facility. See more information at OpenSolaris website. And a small excerpt from their website

"Self-healing services are delivered and managed on Solaris with the Service Management Facility (smf(5)). smf(5) augments the existing init.d(4) and inetd(1M) startup mechanisms, promoting the service to a first-class operating system object."

I want to let you know there is other contribution from Trygve Laugstol, where he made available a Jetty package on blastwave repository (it is outdated).

If you want to use SMF to manage Jetty, get the software (it points to the Jetty patch 639)

Rant

There is a bug on Serviceability on JDK, that can lead to problems running jmap on java process started by non-root users that can bind to privileged ports  (in fact if the process have called setuid on solaris).

This bug happens, if jmap -heap PID is called, like this example

# /opt/jdk1.6.0_07/bin/jmap -heap 21862
Attaching to process ID 21862, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 10.0-b23
......
concurrent mark-sweep generation:
   capacity = 125829120 (120.0MB)
Free chunk in CMS heap, size=65536
Free chunk in CMS heap, size=1048
Free chunk in CMS heap, size=1048
Free chunk in CMS heap, size=256
Free chunk in CMS heap, size=256

a lot of free chunk messages, until ctrl+c

Exception in thread "main" 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 sun.tools.jmap.JMap.runTool(JMap.java:178)
        at sun.tools.jmap.JMap.main(JMap.java:110)
Caused by: java.lang.RuntimeException: VM.initialize() was not yet called
        at sun.jvm.hotspot.runtime.VM.getVM(VM.java:359)
        at sun.jvm.hotspot.oops.ObjectHeap.newOop(ObjectHeap.java:342)
        at sun.jvm.hotspot.memory.CompactibleFreeListSpace.getLiveRegions(CompactibleFreeListSpace.java:138)
        at sun.jvm.hotspot.memory.CompactibleFreeListSpace.used(CompactibleFreeListSpace.java:68)
        at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.used(ConcurrentMarkSweepGeneration.java:61)
        at sun.jvm.hotspot.tools.HeapSummary.printGen(HeapSummary.java:182)
        at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:94)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:221)
        at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:39)

Please vote for this bug, if you want to use jmap in such conditions.

Related Topics >>