You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dominik Drzewiecki (JIRA)" <ji...@apache.org> on 2010/03/27 21:36:27 UTC

[jira] Commented: (DAEMON-100) Thread.currentThread().getContextClassLoader() == null when the program is runned by Prunsrv

    [ https://issues.apache.org/jira/browse/DAEMON-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12850575#action_12850575 ] 

Dominik Drzewiecki commented on DAEMON-100:
-------------------------------------------

I confirm.
This one is particularly annoying when one is trying to launch Jboss AS as a service
It is installed roughly by the following script:

SET JBOSS_SERVICE_NATIVE=tomcat6
SET JBOSS_HOME=c:\java\jboss-5.1.0.GA
SET JBOSS_NATIVE=%JBOSS_HOME%\bin\native
SET CONFIG=minimal
SET SVC_NAME=jbossas
SET SVC_DISP=JBoss Application Server 5.1
SET SVC_DESC=JBoss Application Server 5.1.0 GA/Platform: Windows x86
SET CP=%JBOSS_HOME%\bin\run.jar
SET JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
SET JBOSS_OPTS=-c;%CONFIG%
SET JVM_OPTS=-Xrs;-XX:MaxPermSize=256M;-Dsun.rmi.dgc.client.gcInterval=3600000;-Dsun.rmi.dgc.server.gcInterval=3600000;-Dorg.jboss.resolver.warning=true;-Djava.library.path=%JBOSS_NATIVE%;-Dprogram.name=run.bat
SET JVM_MS=256
SET JVM_MX=512

%JBOSS_SERVICE_NATIVE% //IS//%SVC_NAME%%CONFIG% --DisplayName="%SVC_DISP% - %CONFIG%" --Description="%SVC_DESC% - %CONFIG%" --Install="%JBOSS_HOME%\bin\%JBOSS_SERVICE_NATIVE%.exe" --Startup=manual --Classpath="%CP%" --StartClass=org.jboss.Main --StopClass=org.jboss.Shutdown --StartParams="%JBOSS_OPTS%" --StopParams="%JBOSS_OPTS%" --StartPath="%JBOSS_HOME%\bin" --StopPath="%JBOSS_HOME%\bin" --Jvm="%JVM%" --JvmOptions="%JVM_OPTS%" --JvmMs=%JVM_MS% --JvmMx=%JVM_Mx% --StartMode=jvm --StopMode=jvm --LogPath=%JBOSS_HOME%\server\%CONFIG%\log --LogPrefix=jboss_service_ --LogLevel=DEBUG

I had to change portions of org.jboss.Main in order to launch.

      ClassLoader parentCL = Thread.currentThread().getContextClassLoader();
      if ( parentCL == null ) {
    	  parentCL = Main.class.getClassLoader();
      }



> Thread.currentThread().getContextClassLoader() == null when the program is runned by Prunsrv
> --------------------------------------------------------------------------------------------
>
>                 Key: DAEMON-100
>                 URL: https://issues.apache.org/jira/browse/DAEMON-100
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: Procrun
>         Environment: Win XP, jre1.5.0_11, -Djava.security.policy=<path to a file with following content>:
> grant  {
>     permission java.security.AllPermission "", "";
>     permission com.sun.rmi.rmid.ExecPermission "<<ALL FILES>>";
>     permission com.sun.rmi.rmid.ExecOptionPermission "*";
> };
>            Reporter: Anton Vodonosov
>
> Thread.currentThread().getContextClassLoader() == null when the program is runned by Prunsrv, but when we run the same system using java.exe, Thread.currentThread().getContextClassLoader() is not null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.