We cover this topic in detail in chapter 15 of JBoss in Action, section 15.6.3. And if you get the source code for the book, target 04 in project ch15 sets it up.
One of the things I found helpful in debugging the start script is to run it manually first. The first time through, comment out the 'su' lines (22-26) so that only your account is used. Then make sure the script brings up the app server. The reintroduce the 'su' lines and run it again (while logged in as root). Oh, and add echo statements to let you know how far the script got before it gave up.
I started with the jboss_init_redhat.sh. And yes the sample code builds two services, but if you need only one, register only one. The whole point of doing two services is because people always ask "how can I pass the -b or -c option when I start as a service", so doing two services forces one to provide the answer to such questions. You can always just grab one of generated scripts and use it (after making appropriate changes for the -b and -c options).
I did not see anything in particular about your script that was incorrect - that is why I gave you suggested mechanism to debug the script - those are the same things I went through to get my scripts running.
James Dekker
Ranch Hand
Joined: Dec 09, 2006
Posts: 215
posted
0
I finally am able to run jboss through my jboss script in /etc/init.d/
jboss (located in /etc/init.d/):
Set up all the permissions and run levels like this:
When I try to start up like this:
$ /etc/init.d/./jboss start
It works! :
Please take note of the JAVA and CLASSPATH variables values...
Breaks when I do:
$ service jboss start
This code block here (line 261 in $JBOSS_HOME/bin/run.sh):
Please note the differences in the JAVA and CLASSPATH variables compared to when I ran it manually using ./jboss start under /etc/init.d/.
I got my script working underneath /etc/init.d/jboss
but not under "service jboss start"
Would extremely be grateful if someone could help me...
I think you need some echo statements to find out when $JAVA_HOME was changed from "/usr/java/jdk/" to empty. First, make sure that line 4 really does set it, and check it again before and after lines 103-110 in run.sh. Also, echo out $JAVA at the same time.
When you run:
/etc/init.d/./jboss start
the scripts use your current environment. When you use:
service jboss start
the scripts use a different environment. A good debug tool is to dump out all of the environment variables at the start of the script.
James Dekker
Ranch Hand
Joined: Dec 09, 2006
Posts: 215
posted
0
Hi Peter,
I bought your book! Yes, I tried following what you said by doing this (notice the run levels in the header):
And when I issue this:
service jboss start
This is what echoes out:
Notice how the tools.jar isn't even included on the CLASSPATH when JBoss start...
This system was installed as the root user with no jboss created on Fedora 8 (32 bit)...
In addition, I am unable to do this:
chkconfig --add jboss
"service jboss does not support chkconfig"
When I run it like this:
/etc/init.d/./jboss
It runs perfectly and does this:
I even created a .bash_profile under /root:
Why are the environments different when you type in service jboss start opposed to running the shell script manually?