How do I Start JBoss automatically when boot my linux machine.

I have created a script file named 'start-jboss'
-------------------------------------------------

#!/bin/sh

# For starting Jboss

JAVA_HOME=/home/argole/jdk/jdk1.6.0_10
export JAVA_HOME
cd /home/argole/server/jboss-4.2.0.GA/bin
echo "Starting JBOSS server"
nohup ./run.sh -c projectfolder > JBoss.log 2>&1 &

sleep 180
exit

----------------------------------------------------
and place it in /etc/rc.d/init.d

Create a link using cmd

ln -s /etc/rc.d/init.d/start-jboss /etc/rc3.d/S84startjboss

*Note: my system's run level is 3.

Using given steps my jboss is not working, plz anyone guide me that whats wrong with this and what i can do to run jboss.

any error in server.log?
what happended while start your script?
8080 is listening?

Nothing on server log.
I think the script file is not executing. But when i checked jboss process from grep, it showing that the file have been run 'S84startjboss' but nothing happens.

----------------------------------------------------------

[root@cat12 ~]# ps auxx|grep jboss
root   1948  0.0  0.0   4800  1156 ?    S  12:26  0:00 /bin/sh /etc/rc3.d/S84startjboss start
root   2043  0.0  0.0   4120  684 pts/0  S+   12:29   0:00 grep jboss

---------- Post updated at 04:25 AM ---------- Previous update was at 03:45 AM ----------

=====================================================
  JBoss Bootstrap Environment

  JBOSS_HOME: /home/argole/server/jboss-4.2.0.GA

  JAVA: /home/argole/jdk/jdk1.6.0_10//bin/java

  JAVA_OPTS: -Dprogram.name=run.sh -server -Xms1024m -Xmx2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=384m -XX:MaxPermSize=512m -XX:-UseGCOverheadLimit -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true

  CLASSPATH: /home/argole/server/jboss-4.2.0.GA/bin/run.jar:/home/argole/jdk/jdk1.6.0_10//lib/tools.jar

=========================================================

13:10:05,389 INFO  [Server] Starting JBoss (MX MicroKernel)...
13:10:05,422 INFO  [Server] Release ID: JBoss [Trinity] 4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)
13:10:05,423 INFO  [Server] Home Dir: /home/argole/server/jboss-4.2.0.GA
13:10:05,423 INFO  [Server] Home URL: file:/home/argole/server/jboss-4.2.0.GA/
13:10:05,424 INFO  [Server] Patch URL: null
13:10:05,424 INFO  [Server] Server Name: projectfolder
13:10:05,425 INFO  [Server] Server Home Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder
13:10:05,425 INFO  [Server] Server Home URL: file:/home/argole/server/jboss-4.2.0.GA/server/projectfolder/
13:10:05,425 INFO  [Server] Server Log Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder/log
13:10:05,425 INFO  [Server] Server Temp Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder/tmp
13:10:05,426 INFO  [Server] Root Deployment Filename: jboss-service.xml
13:10:06,766 INFO  [ServerInfo] Java version: 1.6.0_10-rc,Sun Microsystems Inc.
13:10:06,766 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 11.0-b15,Sun Microsystems Inc.
13:10:06,767 INFO  [ServerInfo] OS-System: Linux 2.6.25-14.fc9.i686,i386
13:10:07,393 INFO  [Server] Core system initialized
Failed to boot JBoss:
org.jboss.deployment.DeploymentException: url file:/home/argole/server/jboss-4.2.0.GA/server/projectfolder/conf/jboss-service.xml could not be opened, does it exist?
	at org.jboss.deployment.DeploymentInfo.<init>(DeploymentInfo.java:214)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:781)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy5.deploy(Unknown Source)
	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
	at org.jboss.Main.boot(Main.java:200)
	at org.jboss.Main$1.run(Main.java:508)
	at java.lang.Thread.run(Thread.java:619)
13:10:07,436 INFO  [Server] Runtime shutdown hook called, forceHalt: true
13:10:07,436 INFO  [Server] JBoss SHUTDOWN: Undeploying all packages
13:10:07,443 INFO  [Server] Shutdown complete
Shutdown complete
Halting VM

-----------------------
I didn't have conf/jboss-service.xml file as there is no conf directory. So can i find this file.

But jboss-service.xml file is must be for which type deployers used in jboss
so jboss-service.xml contains core services configurations

maybe its in different dir?

My path of this file is as
/home/argole/server/jboss-4.2.0.GA/server/minimal/conf/jboss-service.xml
instead of this
/home/argole/server/jboss-4.2.0.GA/server/projectfolder/conf/jboss-service.xml

so what i need to do, plz

do you see that when you are trying to run the jboss startup scrip, the necessary prerequisites are fulfilled like mount points are available and other dependencies are met

let be try this instead of /run.sh portion

./run.sh -server -classpath /home/argole/server/jboss-4.2.0.GA/bin/run.jar:/usr/lib/jvm/java/lib/tools.jar org.jboss.Main -c projectfolder -b 0.0.0.0
# grep JBOSSCONF run.sh | head -n 1

What output this comma?

run.sh: invalid option -- s

ok remove server option try again :slight_smile:

./run.sh  -Dprogram.name=run.sh -classpath /home/argole/server/jboss-4.2.0.GA/bin/run.jar:/usr/lib/jvm/java/lib/tools.jar org.jboss.Main -c projectfolder -b 0.0.0.0

nothing to display :slight_smile: no error no log

To start:
nohup ./run.sh -b 0.0.0.0 -c default

You need specify some environment variables:

#JDK PATH
export PATH=/u01/app/jboss/jdk/bin:$PATH

#JRE PATH
export JAVA_HOME=/u01/app/jboss/jre1.5.0_16

#JBOSS HOME PATH
export JBOSS_HOME=/u01/app/jboss/

=-)

Your deploy directory is empty ?

@ raphaelbertozzi
This the output:
run.sh: Missing required file: /home/argole/server/jboss-4.2.2.GA/bin/run.jar

@ ygemici
Not and my jboss is working fine when run manually instead of this script.

You want to running default application in your command?
Need to work projectfolder

What kind of work i need to do for projectfolder?

try this " . ./run.sh " instead of ./run.sh

@ygemici
Did nothing with this cmnd:
nohup . ./run.sh -b 0.0.0.0 -c default

Replace the "default" by the name which contains your app's.
And specify the JBOSS HOME PATH.

Paste here your JBOSS HOME DIRECTORY, JDK and JRE PATH's.

nothing is not :slight_smile:

please take output

 
netstat -talpn| grep 80

and

if your apllication runs on oracle connection add below lines in your script

export ORACLE_BASE=where_your_oracle_dir
export ORACLE_HOME=$ORACLE_BASE/oracle_client11g
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:where_your_jboss_home_dir

Go to the bin directory of your JBoss, so do it:

./run.sh -b 0.0.0.0 -c projectfolder &

And paste the output