Ha! I can still be lazy thanks to the -outfile param. Thanks again for all the help.
On Tue, Nov 19, 2013 at 2:13 PM, Thad Humphries <[email protected]>wrote: > Thanks. That seems to have done it. And adding "-pidfile /var/run/jsvc.pid > -stop" stops it. > > However now I don't see the System.out.println() that I was (lazily) using > to track MultiThread and its three SubTreads. I guess I've got to swap > those for a logger if I want to see anything, huh? > > > On Tue, Nov 19, 2013 at 1:40 PM, Thomas Neidhart < > [email protected]> wrote: > >> On 11/19/2013 07:35 PM, Thad Humphries wrote: >> > Different error this time (see list below). >> > >> > The failure is "2013-11-19 13:10:48.376 jsvc[18273:203] Apple AWT Java >> VM >> > was loaded on first thread -- can't start AWT. >> > java.lang.InternalError: Can't start the AWT because Java was started on >> > the first thread. Make sure StartOnFirstThread is not specified in your >> > application's Info.plist or on the command line" >> >> well, I do not know what you are trying to do, but you may want to try >> out the headless mode: >> >> http://www.oracle.com/technetwork/articles/javase/headless-136834.html >> >> Thomas >> >> > However I find no "StartOnFirstThread" in the Info.plist. >> > >> > Question: MultiThread spawns 3 threads of SubThread. Could that be the >> > problem? A thread that spawns threads? MultiThread grabs AWT so >> SubThread's >> > can't (though neither user AWT classes). >> > >> > I had been using a JVM shutdown >> > hook<http://javapapers.com/core-java/jvm-shutdown-hook/>for >> > MultiThread and assigning a shutdown hook to each of the SubThread >> > instances. In my target app, I want to give the user one process to >> start >> > via a shell script with the subthreads (variable in number) configured >> in >> > an XML file. I just today started looking at Daemon thinking it might >> be a >> > better way to go, especially as I'd also like this eventually to run as >> a >> > Windows service (beat writing a *.BAT file). >> > >> > Debug follows: >> > >> > $ sudo ~/bin/jsvc -jvm server -debug -cp >> > >> /Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar >> > com.mindwrap.sample.thread.MultiThread once >> > +-- DUMPING PARSED COMMAND LINE ARGUMENTS -------------- >> > | Detach: True >> > | Show Version: No >> > | Show Help: No >> > | Check Only: Disabled >> > | Stop: False >> > | Wait: 0 >> > | Run as service: No >> > | Install service: No >> > | Remove service: No >> > | JVM Name: "server" >> > | Java Home: "null" >> > | PID File: "/var/run/jsvc.pid" >> > | User Name: "null" >> > | Extra Options: 1 >> > | >> > >> "-Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar" >> > | Class Invoked: "com.mindwrap.sample.thread.MultiThread" >> > | Class Arguments: 1 >> > | "once" >> > +------------------------------------------------------- >> > Home not specified on command line, using environment >> > Home not on command line or in environment, searching >> > Attempting to locate Java Home in >> > /System/Library/Frameworks/JavaVM.framework/Home >> > Attempting to locate VM configuration file >> > /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg >> > Attempting to locate VM configuration file >> > /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg >> > Found VM configuration file at >> > /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg >> > Found VM client definition in configuration >> > Checking library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib >> > Found VM jvm definition in configuration >> > Checking library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib >> > Found VM hotspot definition in configuration >> > Checking library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib >> > Found VM server definition in configuration >> > Checking library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> > Found VM classic definition in configuration >> > Checking library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib >> > Cannot locate library for VM classic (skipping) >> > Java Home located in /System/Library/Frameworks/JavaVM.framework/Home >> > +-- DUMPING JAVA HOME STRUCTURE ------------------------ >> > | Java Home: "/System/Library/Frameworks/JavaVM.framework/Home" >> > | Java VM Config.: >> > "/System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg" >> > | Found JVMs: 4 >> > | JVM Name: "client" >> > | >> > >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib" >> > | JVM Name: "jvm" >> > | >> > >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib" >> > | JVM Name: "hotspot" >> > | >> > >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib" >> > | JVM Name: "server" >> > | >> > >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib" >> > +------------------------------------------------------- >> > redirecting stdout to /dev/null and stderr to /dev/null >> > Switching umask back to 022 from 077 >> > >> > [email protected]:~/jdevel/MultiThreadTest >> > 630 $ Using specific JVM in >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> > Attemtping to load library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> > JVM library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> > loaded >> > Attemtping to load library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib >> > Shell library >> > >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib >> > loaded >> > JVM library entry point found (0x07433762) >> > +-- DUMPING JAVA VM CREATION ARGUMENTS ----------------- >> > | Version: 0x010004 >> > | Ignore Unrecognized Arguments: False >> > | Extra options: 1 >> > | >> > >> "-Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar" >> > (0x00000000) >> > +------------------------------------------------------- >> > | Internal options: 4 >> > | "-Dcommons.daemon.process.id=18273" (0x00000000) >> > | "-Dcommons.daemon.process.parent=18272" (0x00000000) >> > | "-Dcommons.daemon.version=1.0.15-dev" (0x00000000) >> > | "abort" (0x06ca5f50) >> > +------------------------------------------------------- >> > Java VM created successfully >> > Class org/apache/commons/daemon/support/DaemonLoader found >> > Native methods registered >> > java_init done >> > Daemon loading... >> > 2013-11-19 13:10:48.376 jsvc[18273:203] Apple AWT Java VM was loaded on >> > first thread -- can't start AWT. >> > java.lang.InternalError: Can't start the AWT because Java was started on >> > the first thread. Make sure StartOnFirstThread is not specified in your >> > application's Info.plist or on the command line >> > at java.lang.ClassLoader$NativeLibrary.load(Native Method) >> > at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1833) >> > at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1730) >> > at java.lang.Runtime.loadLibrary0(Runtime.java:823) >> > at java.lang.System.loadLibrary(System.java:1044) >> > at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50) >> > at java.security.AccessController.doPrivileged(Native Method) >> > at java.awt.Toolkit.loadLibraries(Toolkit.java:1605) >> > at java.awt.Toolkit.<clinit>(Toolkit.java:1627) >> > at sun.awt.AppContext$2.run(AppContext.java:240) >> > at sun.awt.AppContext$2.run(AppContext.java:226) >> > at java.security.AccessController.doPrivileged(Native Method) >> > at sun.awt.AppContext.initMainAppContext(AppContext.java:226) >> > at sun.awt.AppContext.access$200(AppContext.java:112) >> > at sun.awt.AppContext$3.run(AppContext.java:306) >> > at java.security.AccessController.doPrivileged(Native Method) >> > at sun.awt.AppContext.getAppContext(AppContext.java:287) >> > at com.sun.jmx.trace.Trace.out(Trace.java:180) >> > at com.sun.jmx.trace.Trace.isSelected(Trace.java:88) >> > at >> > >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isTraceOn(DefaultMBeanServerInterceptor.java:1830) >> > at >> > >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:929) >> > at >> > >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:916) >> > at >> > >> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312) >> > at >> com.sun.jmx.mbeanserver.JmxMBeanServer$2.run(JmxMBeanServer.java:1195) >> > at java.security.AccessController.doPrivileged(Native Method) >> > at >> > >> com.sun.jmx.mbeanserver.JmxMBeanServer.initialize(JmxMBeanServer.java:1193) >> > at >> com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:225) >> > at >> com.sun.jmx.mbeanserver.JmxMBeanServer.<init>(JmxMBeanServer.java:170) >> > at >> > >> com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1401) >> > at >> > >> javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:93) >> > at >> > >> javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:311) >> > at >> > >> javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:214) >> > at >> > >> javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:175) >> > at >> > >> sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302) >> > at >> > >> java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504) >> > at com.mindwrap.sample.thread.MultiThread.<init>(MultiThread.java:26) >> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) >> > at >> > >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) >> > at >> > >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) >> > at java.lang.reflect.Constructor.newInstance(Constructor.java:513) >> > at java.lang.Class.newInstance0(Class.java:357) >> > at java.lang.Class.newInstance(Class.java:310) >> > at >> > >> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190) >> > Cannot load daemon >> > java_load failed >> > Service exit with a return value of 3 >> > >> > >> > On Tue, Nov 19, 2013 at 12:53 PM, Thomas Neidhart < >> [email protected] >> >> wrote: >> > >> >> On 11/19/2013 06:11 PM, Thad Humphries wrote: >> >>> I've written a class called MultiThread which implements Daemon. >> However >> >>> when I try to run it with jsvc, it fails although the class is clearly >> >>> present in my classpath. What am I not seeing? The call and debug are >> >> below: >> >>> >> >>> $ sudo ~/bin/jsvc -jvm server -debug -cp >> >>> >> >> >> ~/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar >> >>> com.mindwrap.sample.thread.MultiThread once >> >> >> >> try using an absolute path to the MultiThread jar file. >> >> >> >> Thomas >> >> >> >>> Password: >> >>> +-- DUMPING PARSED COMMAND LINE ARGUMENTS -------------- >> >>> | Detach: True >> >>> | Show Version: No >> >>> | Show Help: No >> >>> | Check Only: Disabled >> >>> | Stop: False >> >>> | Wait: 0 >> >>> | Run as service: No >> >>> | Install service: No >> >>> | Remove service: No >> >>> | JVM Name: "server" >> >>> | Java Home: "null" >> >>> | PID File: "/var/run/jsvc.pid" >> >>> | User Name: "null" >> >>> | Extra Options: 1 >> >>> | >> >>> >> >> >> "-Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar" >> >>> | Class Invoked: "com.mindwrap.sample.thread.MultiThread" >> >>> | Class Arguments: 1 >> >>> | "once" >> >>> +------------------------------------------------------- >> >>> Home not specified on command line, using environment >> >>> Home not on command line or in environment, searching >> >>> Attempting to locate Java Home in >> >>> /System/Library/Frameworks/JavaVM.framework/Home >> >>> Attempting to locate VM configuration file >> >>> /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg >> >>> Attempting to locate VM configuration file >> >>> /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg >> >>> Found VM configuration file at >> >>> /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg >> >>> Found VM client definition in configuration >> >>> Checking library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib >> >>> Found VM jvm definition in configuration >> >>> Checking library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib >> >>> Found VM hotspot definition in configuration >> >>> Checking library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib >> >>> Found VM server definition in configuration >> >>> Checking library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> >>> Found VM classic definition in configuration >> >>> Checking library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib >> >>> Cannot locate library for VM classic (skipping) >> >>> Java Home located in /System/Library/Frameworks/JavaVM.framework/Home >> >>> +-- DUMPING JAVA HOME STRUCTURE ------------------------ >> >>> | Java Home: "/System/Library/Frameworks/JavaVM.framework/Home" >> >>> | Java VM Config.: >> >>> "/System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg" >> >>> | Found JVMs: 4 >> >>> | JVM Name: "client" >> >>> | >> >>> >> >> >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib" >> >>> | JVM Name: "jvm" >> >>> | >> >>> >> >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib" >> >>> | JVM Name: "hotspot" >> >>> | >> >>> >> >> >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib" >> >>> | JVM Name: "server" >> >>> | >> >>> >> >> >> >> "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib" >> >>> +------------------------------------------------------- >> >>> redirecting stdout to /dev/null and stderr to /dev/null >> >>> Switching umask back to 022 from 077 >> >>> Using specific JVM in >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> >>> Attemtping to load library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> >>> >> >>> [email protected]:~/jdevel/MultiThreadTest >> >>> 621 $ JVM library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib >> >>> loaded >> >>> Attemtping to load library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib >> >>> Shell library >> >>> >> >> >> /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib >> >>> loaded >> >>> JVM library entry point found (0x09E34762) >> >>> +-- DUMPING JAVA VM CREATION ARGUMENTS ----------------- >> >>> | Version: 0x010004 >> >>> | Ignore Unrecognized Arguments: False >> >>> | Extra options: 1 >> >>> | >> >>> >> >> >> "-Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar" >> >>> (0x00000000) >> >>> +------------------------------------------------------- >> >>> | Internal options: 4 >> >>> | "-Dcommons.daemon.process.id=17848" (0x00000000) >> >>> | "-Dcommons.daemon.process.parent=17847" (0x00000000) >> >>> | "-Dcommons.daemon.version=1.0.15-dev" (0x00000000) >> >>> | "abort" (0x096a6f50) >> >>> +------------------------------------------------------- >> >>> Java VM created successfully >> >>> Class org/apache/commons/daemon/support/DaemonLoader found >> >>> Native methods registered >> >>> java_init done >> >>> Daemon loading... >> >>> java.lang.ClassNotFoundException: >> com.mindwrap.sample.thread.MultiThread >> >>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202) >> >>> at java.security.AccessController.doPrivileged(Native Method) >> >>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190) >> >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306) >> >>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) >> >>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247) >> >>> at >> >>> >> >> >> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:151) >> >>> Cannot load daemon >> >>> java_load failed >> >>> Service exit with a return value of 3 >> >>> >> >>> >> >>> As you can see, the class is in the jar: >> >>> >> >>> $ jar tvf target/MultiThread-1.0-SNAPSHOT.jar >> >>> 0 Tue Nov 19 12:08:06 EST 2013 META-INF/ >> >>> 168 Tue Nov 19 12:08:04 EST 2013 META-INF/MANIFEST.MF >> >>> 0 Tue Nov 19 12:08:04 EST 2013 com/ >> >>> 0 Tue Nov 19 12:08:04 EST 2013 com/mindwrap/ >> >>> 0 Tue Nov 19 12:08:04 EST 2013 com/mindwrap/sample/ >> >>> 0 Tue Nov 19 12:08:04 EST 2013 com/mindwrap/sample/thread/ >> >>> 2255 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/MultiThread$ShutdownHook.class >> >>> 4659 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/MultiThread.class >> >>> 253 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/ShutdownHookTest$1.class >> >>> 951 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/ShutdownHookTest$JVMShutdownHook.class >> >>> 1191 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/ShutdownHookTest.class >> >>> 2053 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/SubThread.class >> >>> 282 Tue Nov 19 12:08:04 EST 2013 >> >>> com/mindwrap/sample/thread/SubThreadMBean.class >> >>> 0 Tue Nov 19 12:08:06 EST 2013 META-INF/maven/ >> >>> 0 Tue Nov 19 12:08:06 EST 2013 >> >>> META-INF/maven/com.mindwrap.sample.thread/ >> >>> 0 Tue Nov 19 12:08:06 EST 2013 >> >>> META-INF/maven/com.mindwrap.sample.thread/MultiThread/ >> >>> 1679 Tue Nov 19 12:07:52 EST 2013 >> >>> META-INF/maven/com.mindwrap.sample.thread/MultiThread/pom.xml >> >>> 129 Tue Nov 19 12:08:06 EST 2013 >> >>> META-INF/maven/com.mindwrap.sample.thread/MultiThread/pom.properties >> >>> >> >>> >> >>> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [email protected] >> >> For additional commands, e-mail: [email protected] >> >> >> >> >> > >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > "Hell hath no limits, nor is circumscrib'd In one self-place; but where we > are is hell, And where hell is, there must we ever be" --Christopher > Marlowe, *Doctor Faustus* (v, 121-24) > -- "Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
