Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CDEA610726 for ; Tue, 19 Nov 2013 18:41:38 +0000 (UTC) Received: (qmail 5299 invoked by uid 500); 19 Nov 2013 18:41:24 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 5217 invoked by uid 500); 19 Nov 2013 18:41:24 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 5069 invoked by uid 99); 19 Nov 2013 18:41:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Nov 2013 18:41:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of thomas.neidhart@gmail.com designates 74.125.83.52 as permitted sender) Received: from [74.125.83.52] (HELO mail-ee0-f52.google.com) (74.125.83.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Nov 2013 18:41:20 +0000 Received: by mail-ee0-f52.google.com with SMTP id l10so3407735eei.25 for ; Tue, 19 Nov 2013 10:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=SqYCfvcmA0CKl+m+W+24n/65DxAuSMuapGUEVyhTvIk=; b=XMN8npQ965ENFHbgCwIoIp77IesbRpGsCpPFp7gSDbklhUt6EwmBLdHvFiq7ZyIkoq 8ZY+4Yhse44xQhCkRYx7YigTdbubV18vrGLIenA/HaEXUQrVMwmdMLgQq0GoDCRXefz+ K1GrKR+N2uKnXG63r0i1/fHI5GqFBh3hMxW6/eIe3OxZTCxThJ37uPWzN7IxkgDiML/H Wpql1P673zNFY7z3gRjaSBHT6/6bxxl3ctY4uKn3A0bAql6qqMjBaBghh9YoHU2nE2NY 3cFnie0W1MAfDXIqetKeocVMkkHtd3E+Xlzu0tP/MEpVS0tWJFEC5MYntGv+RZ9ZYSku rFVg== X-Received: by 10.15.26.131 with SMTP id n3mr2802511eeu.21.1384886458879; Tue, 19 Nov 2013 10:40:58 -0800 (PST) Received: from [192.168.1.2] (ip-81-11-241-36.dsl.scarlet.be. [81.11.241.36]) by mx.google.com with ESMTPSA id 44sm51460410eek.5.2013.11.19.10.40.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 10:40:58 -0800 (PST) Message-ID: <528BB0B8.7050402@gmail.com> Date: Tue, 19 Nov 2013 19:40:56 +0100 From: Thomas Neidhart User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Commons Users List Subject: Re: [daemon] ClassNotFoundException though class in path References: <528BA581.8020407@gmail.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 > hookfor > 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 > > thad@Thads-Mac-mini.local:~/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.(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.(JmxMBeanServer.java:225) > at com.sun.jmx.mbeanserver.JmxMBeanServer.(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.(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 > 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 >>> >>> thad@Thads-Mac-mini.local:~/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: user-unsubscribe@commons.apache.org >> For additional commands, e-mail: user-help@commons.apache.org >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org