Uisng Twiddle in the cron job
youareapkman Oct 3, 2008 2:58 AMHi all,
I don’t know if the questions of Twiddle should be posted in this forum. Please kindly inform me if I posted in the incorrect forum.
My problem is about using twiddle in the cron job. When testing the following command in the command line, it runs successfully.
[root@host]$ /u01/app/jboss/bin/twiddle.sh --server=jnp://server.name:1199 get "jboss.system:service=ThreadPool" "QueueSize" QueueSize=0
But when I run the same command in the cron job, it gives me the following error:
12:34:02,355 ERROR [Twiddle] Exec failed org.jboss.util.NestedRuntimeException: Can't find property: java.naming.factory.initial; - nested throwable: (javax.naming.NoInitialContextException: Can't find property: java.naming.factory.initial) at org.jboss.console.twiddle.Twiddle$1.getServer() (Unknown Source) at org.jboss.console.twiddle.command.MBeanServerCommand.getMBeanServer() (Unknown Source) at org.jboss.console.twiddle.command.GetCommand.execute(java.lang.String[]) (Unknown Source) at org.jboss.console.twiddle.Twiddle.main(java.lang.String[]) (Unknown Source) Caused by: javax.naming.NoInitialContextException: Can't find property: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable) (/usr/lib64/libgcj.so.5.0.0) at javax.naming.InitialContext.getDefaultInitCtx() (/usr/lib64/libgcj.so.5.0.0) at javax.naming.InitialContext.getURLOrDefaultInitCtx(java.lang.String) (/usr/lib64/libgcj.so.5.0.0) at javax.naming.InitialContext.lookup(java.lang.String) (/usr/lib64/libgcj.so.5.0.0) at org.jboss.console.twiddle.Twiddle.createMBeanServerConnection() (Unknown Source) at org.jboss.console.twiddle.Twiddle.connect() (Unknown Source) at org.jboss.console.twiddle.Twiddle.access$300(org.jboss.console.twiddle.Twiddle) (Unknown Source) at org.jboss.console.twiddle.Twiddle$1.getServer() (Unknown Source) ...3 more
I know that the cron job will run in a totally different environment than the environment the user logged into the shell, so is this issue due to the environmental variables of the Java and JBoss? I have already correctly set the JAVA_HOME, PATH environmental variables inside the script. What other environmental variables that I need to set when using the twiddle in the cron job environment.
Regards