12 Replies Latest reply: Mar 1, 2012 9:13 AM by Wolf-Dieter Fink RSS

JBossAS-5.1.0 terminates automatically on Sun Solaris

Hushen Savani Newbie

Hi Community,

 

      I am running JBossAS-5.1.0.GA application server on Sun Solaris production system. Lately, the JBoss server terminates automatically. I have tried placing -Xrs JVM parameter as suggested in this wiki article, but this didn't help. The server terimates unexpectedly. The only log shown in jboss.log is as following:

 

Terminated

 

     Hence, I am not able to debug the root cause as well. Can anyone please suggest on the same on urgent basis.

    

     Thank you.

 

Best Regards,

Hushen Savani

  • 1. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    There are different reasons.

    One can be a 'kill -9' command

     

    Does it happen periodically? i.e. maybe a cron job try to kill something but use accidentaly a wrong PID!

    Please provide more information that we are able to guide you.

  • 2. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

     

         Thanks for response. I have checked all the cron jobs. There are no 'kill' jobs scheduled for any process. It seems to be that there is some other cause. When it shutdown unexpectedly, it shows following logs in jboss.log:

    [Unloading class sun.reflect.GeneratedMethodAccessor618]

    [Unloading class sun.reflect.GeneratedMethodAccessor696]

    [Unloading class sun.reflect.GeneratedMethodAccessor691]

    [Unloading class sun.reflect.GeneratedMethodAccessor688]

    [Unloading class sun.reflect.GeneratedMethodAccessor747]

    [Unloading class sun.reflect.GeneratedMethodAccessor604]

    [Unloading class sun.reflect.GeneratedMethodAccessor623]

    [Unloading class sun.reflect.GeneratedMethodAccessor617]

    [Unloading class sun.reflect.GeneratedMethodAccessor698]

    [Unloading class sun.reflect.GeneratedMethodAccessor594]

    [Unloading class sun.reflect.GeneratedMethodAccessor620]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor189]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor205]

    [Unloading class sun.reflect.GeneratedMethodAccessor580]

    [Unloading class sun.reflect.GeneratedMethodAccessor590]

    [Unloading class sun.reflect.GeneratedMethodAccessor406]

    [Unloading class sun.reflect.GeneratedMethodAccessor648]

    [Unloading class sun.reflect.GeneratedMethodAccessor649]

    [Unloading class sun.reflect.GeneratedMethodAccessor643]

    [Unloading class sun.reflect.GeneratedMethodAccessor603]

    [Unloading class sun.reflect.GeneratedMethodAccessor605]

    [Unloading class sun.reflect.GeneratedMethodAccessor667]

    [Unloading class sun.reflect.GeneratedMethodAccessor714]

    [Unloading class sun.reflect.GeneratedMethodAccessor700]

    [Unloading class sun.reflect.GeneratedMethodAccessor629]

    [Unloading class sun.reflect.GeneratedMethodAccessor608]

    [Unloading class sun.reflect.GeneratedMethodAccessor600]

    [Unloading class sun.reflect.GeneratedMethodAccessor659]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor191]

    [Unloading class sun.reflect.GeneratedMethodAccessor639]

    [Unloading class sun.reflect.GeneratedMethodAccessor716]

    [Unloading class sun.reflect.GeneratedMethodAccessor674]

    [Unloading class sun.reflect.GeneratedMethodAccessor626]

    [Unloading class sun.reflect.GeneratedMethodAccessor615]

    [Unloading class sun.reflect.GeneratedConstructorAccessor219]

    [Unloading class sun.reflect.GeneratedMethodAccessor720]

    [Unloading class sun.reflect.GeneratedMethodAccessor596]

    [Unloading class sun.reflect.GeneratedMethodAccessor705]

    [Unloading class sun.reflect.GeneratedMethodAccessor665]

    [Unloading class sun.reflect.GeneratedMethodAccessor599]

    [Unloading class sun.reflect.GeneratedMethodAccessor690]

    [Unloading class sun.reflect.GeneratedMethodAccessor587]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor206]

    [Unloading class sun.reflect.GeneratedMethodAccessor613]

    [Unloading class sun.reflect.GeneratedMethodAccessor365]

    [Unloading class sun.reflect.GeneratedMethodAccessor624]

    [Unloading class sun.reflect.GeneratedMethodAccessor711]

    [Unloading class sun.reflect.GeneratedMethodAccessor645]

    [Unloading class sun.reflect.GeneratedMethodAccessor731]

    [Unloading class sun.reflect.GeneratedMethodAccessor597]

    [Unloading class sun.reflect.GeneratedMethodAccessor593]

    [Unloading class sun.reflect.GeneratedMethodAccessor578]

    [Unloading class sun.reflect.GeneratedMethodAccessor607]

    [Unloading class sun.reflect.GeneratedMethodAccessor726]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor186]

    [Unloading class sun.reflect.GeneratedMethodAccessor632]

    [Unloading class sun.reflect.GeneratedMethodAccessor630]

    [Unloading class sun.reflect.GeneratedMethodAccessor652]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor192]

    [Unloading class sun.reflect.GeneratedMethodAccessor655]

    [Unloading class sun.reflect.GeneratedMethodAccessor717]

    [Unloading class sun.reflect.GeneratedMethodAccessor723]

    [Unloading class sun.reflect.GeneratedMethodAccessor588]

    [Unloading class sun.reflect.GeneratedMethodAccessor646]

    [Unloading class sun.reflect.GeneratedMethodAccessor709]

    [Unloading class sun.reflect.GeneratedMethodAccessor577]

    [Unloading class sun.reflect.GeneratedMethodAccessor490]

    [Unloading class sun.reflect.GeneratedMethodAccessor583]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor182]

    [Unloading class sun.reflect.GeneratedMethodAccessor609]

    [Unloading class sun.reflect.GeneratedMethodAccessor606]

    [Unloading class sun.reflect.GeneratedMethodAccessor591]

    [Unloading class sun.reflect.GeneratedMethodAccessor585]

    [Unloading class sun.reflect.GeneratedMethodAccessor684]

    [Unloading class sun.reflect.GeneratedMethodAccessor367]

    [Unloading class sun.reflect.GeneratedMethodAccessor622]

    [Unloading class sun.reflect.GeneratedConstructorAccessor217]

    [Unloading class sun.reflect.GeneratedMethodAccessor660]

    [Unloading class sun.reflect.GeneratedMethodAccessor656]

    [Unloading class sun.reflect.GeneratedMethodAccessor737]

    [Unloading class sun.reflect.GeneratedMethodAccessor638]

    [Unloading class sun.reflect.GeneratedMethodAccessor635]

    [Unloading class sun.reflect.GeneratedMethodAccessor692]

    [Unloading class sun.reflect.GeneratedMethodAccessor668]

    [Unloading class sun.reflect.GeneratedMethodAccessor739]

    [Unloading class sun.reflect.GeneratedConstructorAccessor220]

    [Unloading class sun.reflect.GeneratedMethodAccessor734]

    [Unloading class sun.reflect.GeneratedMethodAccessor562]

    [Unloading class sun.reflect.GeneratedMethodAccessor601]

    [Unloading class sun.reflect.GeneratedMethodAccessor640]

    [Unloading class sun.reflect.GeneratedMethodAccessor582]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor208]

    [Unloading class sun.reflect.GeneratedMethodAccessor681]

    [Unloading class sun.reflect.GeneratedMethodAccessor719]

    [Unloading class sun.reflect.GeneratedMethodAccessor612]

    [Unloading class sun.reflect.GeneratedMethodAccessor693]

    [Unloading class sun.reflect.GeneratedMethodAccessor685]

    [Unloading class sun.reflect.GeneratedMethodAccessor360]

    [Unloading class sun.reflect.GeneratedMethodAccessor662]

    [Unloading class sun.reflect.GeneratedMethodAccessor581]

    [Unloading class sun.reflect.GeneratedMethodAccessor401]

    [Unloading class sun.reflect.GeneratedMethodAccessor366]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor188]

    [Unloading class sun.reflect.GeneratedMethodAccessor744]

    [Unloading class sun.reflect.GeneratedMethodAccessor707]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor183]

    [Unloading class sun.reflect.GeneratedMethodAccessor397]

    [Unloading class sun.reflect.GeneratedMethodAccessor677]

    [Unloading class sun.reflect.GeneratedMethodAccessor403]

    [Unloading class sun.reflect.GeneratedMethodAccessor732]

    [Unloading class sun.reflect.GeneratedMethodAccessor740]

    [Unloading class sun.reflect.GeneratedMethodAccessor598]

    [Unloading class sun.reflect.GeneratedMethodAccessor595]

    [Unloading class sun.reflect.GeneratedMethodAccessor579]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor209]

    [Unloading class sun.reflect.GeneratedMethodAccessor361]

    [Unloading class sun.reflect.GeneratedMethodAccessor641]

    [Unloading class sun.reflect.GeneratedMethodAccessor703]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor207]

    [Unloading class sun.reflect.GeneratedMethodAccessor637]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor204]

    [Unloading class sun.reflect.GeneratedMethodAccessor592]

    [Unloading class sun.reflect.GeneratedMethodAccessor602]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor193]

    [Unloading class sun.reflect.GeneratedMethodAccessor666]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor185]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor187]

    [Unloading class sun.reflect.GeneratedMethodAccessor664]

    [Unloading class sun.reflect.GeneratedMethodAccessor742]

    [Unloading class sun.reflect.GeneratedMethodAccessor713]

    [Unloading class sun.reflect.GeneratedMethodAccessor694]

    [Unloading class sun.reflect.GeneratedMethodAccessor746]

    [Unloading class sun.reflect.GeneratedMethodAccessor661]

    [Unloading class sun.reflect.GeneratedMethodAccessor634]

    [Unloading class sun.reflect.GeneratedMethodAccessor627]

    [Unloading class sun.reflect.GeneratedMethodAccessor741]

    [Unloading class sun.reflect.GeneratedMethodAccessor722]

    [Unloading class sun.reflect.GeneratedMethodAccessor672]

    [Unloading class sun.reflect.GeneratedMethodAccessor670]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor190]

    [Unloading class sun.reflect.GeneratedMethodAccessor644]

    [Unloading class sun.reflect.GeneratedMethodAccessor589]

    [Unloading class sun.reflect.GeneratedMethodAccessor727]

    [Unloading class sun.reflect.GeneratedMethodAccessor724]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor184]

    [Unloading class sun.reflect.GeneratedMethodAccessor718]

    [Unloading class sun.reflect.GeneratedMethodAccessor500]

    [Unloading class sun.reflect.GeneratedMethodAccessor584]

    [Unloading class sun.reflect.GeneratedMethodAccessor675]

    [Unloading class sun.reflect.GeneratedMethodAccessor654]

    [Unloading class sun.reflect.GeneratedMethodAccessor735]

    [Unloading class sun.reflect.GeneratedMethodAccessor586]

    [Unloading class sun.reflect.GeneratedMethodAccessor669]

    [Unloading class sun.reflect.GeneratedMethodAccessor658]

    [Unloading class sun.reflect.GeneratedConstructorAccessor218]

    [Unloading class sun.reflect.GeneratedMethodAccessor633]

    [Unloading class sun.reflect.GeneratedMethodAccessor679]

    [Unloading class sun.reflect.GeneratedMethodAccessor701]

    [Unloading class sun.reflect.GeneratedSerializationConstructorAccessor175]

    [Unloading class sun.reflect.GeneratedMethodAccessor611]

    [Unloading class sun.reflect.GeneratedMethodAccessor729]

    Shutdown complete

    Halting VM

     

         Also, I have observed that server shuts down arbitarily regardless of any load on it. Last night there was zero-load on the server, yet it has gone down automatically. Can't figure out where can be the problem.

     

         Can there be JBoss which is shutting down(or trying to restart) the own server to perform some activities? Pls. suggest.

     

         Thanks.

     

    Best Regards,

    Hushen Savani

  • 3. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    Have a look to https://community.jboss.org/wiki/MysteriousShutdowns. There is a collection of reasons you can look for.

     

    I suppose it is a event from outside. Do you check whether it is periodical.

    Check the suggeestions of MysteriousShutdowns

    Also it can be that the JMX-console is used via http to shutdown, I would recommend to secure or remove the jmx- management-console applications to avoid this.

     

    I think it can be hard to find out, good luck!

  • 4. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

    Have a look to https://community.jboss.org/wiki/MysteriousShutdowns. There is a collection of reasons you can look for.

              Thanks. I had looked for the same, but given suggestions didn't help

     

    I suppose it is a event from outside. Do you check whether it is periodical.

              It is not periodical. Server shuts down arbitarily.

     

    Also it can be that the JMX-console is used via http to shutdown, I would recommend to secure or remove the jmx- management-console applications to avoid this.

              Well, JMX-Console remote port is not open on production, its secure. However, I will try removing jmx-management sar.

     

            By the way, can Quartz scheduler cause such issue? I am running quartz schedulers inside JBoss(i.e. a scheduler sar) to perform certain business process. 

        

            Pl. suggest. Thanks.

     

    Best Regards,

    Hushen Savani

  • 5. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    I think you've checked it but can you confirm that you do not see messages like 'shutdown hook called' or similar that indicate a programatic shutdown?

    The JMX-console is not the only one, admin-console and management  might be deployed depend on the version of JBoss.

     

    I did not think that the quartz scheduler itselve force a shutdown (otherwise this problem might raise earlier), but maybe wrong additional code might have such effect.

     

    .... just brainstorming

    - what if you start an empty jboss instance on that system (different ports AND/OR virtual ip) to see whether the shutdown happen here

    - restrict user system access

    - watch network traffic

    I know that sounds like a huge effort

  • 6. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

     

         As per you suggested, I have removed my application ears/sars from this JBoss and restarted the same. Again, JBoss terminated unexpectedly. This time I got the log as following in jboss.log:

    14:42:58,017 INFO  [TomcatDeployment] deploy, ctxPath=/admin-console

    14:42:58,089 INFO  [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/admin-console'

    14:42:59,822 INFO  [TomcatDeployment] deploy, ctxPath=/

    14:42:59,877 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console

    14:42:59,968 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8089

    14:42:59,995 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8099

    14:43:00,009 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 46s:679ms

    [Unloading class $Proxy240]

    [Unloading class $Proxy245]

    [Unloading class $Proxy239]

    [Unloading class $Proxy242]

    [Unloading class $Proxy246]

    [Unloading class $Proxy243]

    16:51:49,625 INFO  [ServerImpl] Runtime shutdown hook called, forceHalt: true

    16:51:49,634 INFO  [Http11Protocol] Pausing Coyote HTTP/1.1 on http-127.0.0.1-8089

    16:51:49,636 INFO  [Http11Protocol] Stopping Coyote HTTP/1.1 on http-127.0.0.1-8089

    16:51:49,642 INFO  [AjpProtocol] Pausing Coyote AJP/1.3 on ajp-127.0.0.1-8099

    16:51:49,643 INFO  [AjpProtocol] Stopping Coyote AJP/1.3 on ajp-127.0.0.1-8099

    16:51:49,672 INFO  [TomcatDeployment] undeploy, ctxPath=/web-console

    16:51:49,703 INFO  [SessionSpecContainer] Stopping jboss.j2ee:jar=profileservice-secured.jar,name=SecureProfileService,service=EJB3

    16:51:49,715 INFO  [EJBContainer] STOPPED EJB: org.jboss.profileservice.ejb.SecureProfileServiceBean ejbName: SecureProfileService

    16:51:49,756 INFO  [SessionSpecContainer] Stopping jboss.j2ee:jar=profileservice-secured.jar,name=SecureDeploymentManager,service=EJB3

    16:51:49,767 INFO  [EJBContainer] STOPPED EJB: org.jboss.profileservice.ejb.SecureDeploymentManager ejbName: SecureDeploymentManager

    16:51:49,808 INFO  [SessionSpecContainer] Stopping jboss.j2ee:jar=profileservice-secured.jar,name=SecureManagementView,service=EJB3

    16:51:49,817 INFO  [EJBContainer] STOPPED EJB: org.jboss.profileservice.ejb.SecureManagementView ejbName: SecureManagementView

    16:51:49,863 INFO  [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' from JNDI name 'java:JmsXA'

    16:51:49,874 INFO  [HornetQResourceAdapter] HornetQ resource adapter stopped

    16:51:50,004 INFO  [HornetQServerImpl] HornetQ Server version 2.2.5.Final (HQ_2_2_5_FINAL_AS7, 121) [0c7fc5b5-5235-11e1-83a4-83e65a70b530] stopped

    16:51:50,060 INFO  [TomcatDeployment] undeploy, ctxPath=/invoker

    16:51:50,085 INFO  [EntityLockMonitor] EntityLockMonitor stopped

    16:51:50,114 INFO  [TomcatDeployment] undeploy, ctxPath=/admin-console

    16:51:50,118 INFO  [TomcatDeployment] undeploy, ctxPath=/

    16:51:50,122 INFO  [TomcatDeployment] undeploy, ctxPath=/jmx-console

    16:51:50,128 INFO  [StandardService] Stopping service jboss.web

    16:51:50,186 INFO  [MailService] Mail service 'java:/Mail' removed from JNDI

    16:51:50,251 INFO  [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/JISPDS' from JNDI name 'java:jdbc/JISPDS'

    16:51:50,252 INFO  [ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' from JNDI name 'java:DefaultDS'

    16:51:50,298 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down.

    16:51:50,298 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused.

    16:51:50,302 INFO  [SimpleThreadPool] There are still 23 worker threads active. See javadoc runInThread(Runnable) for a possible explanation

    16:51:50,302 INFO  [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete.

    16:51:50,538 INFO  [TransactionManagerService] Stopping transaction recovery manager

    16:51:50,540 INFO  [TransactionManagerService] Destroying TransactionManagerService

    16:51:50,829 INFO  [HypersonicDatabase] Database standalone closed clean

    16:51:53,356 INFO  [ServerImpl] Shutdown complete

    Shutdown complete

    Halting VM

     

         I can't really make out what is making jboss killed. Is it jboss itself or some signals from OS?? Pl. suggest on the same.

     

         Thanks.

     

    Best Regards,

    Hushen Savani

     

    Attaching jboss.log file

  • 7. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    Here I see

    16:51:49,625 INFO  [ServerImpl] Runtime shutdown hook called, forceHalt: true

    If you look to [1] the reason can be 'Ctrl-C' or a signal TERM or INT.

    So I suppose that a process or user on that machine do this.

     

    What if you move the JBoss to another system or start a second one for test on the same (see brainstorming of my last comment)

     

    [1] https://community.jboss.org/wiki/ShutdownLogs

  • 8. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

        

    If you look to [1] the reason can be 'Ctrl-C' or a signal TERM or INT.

                   Yes, you are right. I tried replicating the same scenario in my local machine. Its TERM which is causing this issue. For prevention, I tried providing the '-Xrs' JVM Parameter. But it just supresses the messages in jboss.log. The process is getting killed anyway. (By the way, Ctrl+C is not the issue, I am running my jboss process in background using nohup).

     

    What if you move the JBoss to another system or start a second one for test on the same (see brainstorming of my last comment)

                   I already have been running two JBoss instances on production server. One of them(or both) gets killed randomly with or without my application ears.

     

         Now, since -Xrs is not working, can there be any way to prevent / ignore TERM signal anyway???

     

         Pl. suggest. Thanks.

     

    Best Regards,

    Hushen Savani

  • 9. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    Look to run.sh for the shell command 'trap', it is active if you set a environment variable for JBoss start.

    This command will catch the signals (not all) and you can handle it.

     

    Here a simple shell script to demonstrate:

    trap "echo SIGTERM" TERM

    while [ 0 -lt 128 ]; do

      sleep 2

    done

     

    You can stop the program with 'kill PID' only if you remove the trap-line otherwise you only see SIGTERM output.

    If you add this to run.sh it can be a workaround, you might send a mail or write into a log with the date and the signal for tracking.

     

    BUT you should find out who or what is the reason for such signals!

  • 10. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

     

         I tried putting the same in run.sh. But its not preventing the kill -TERM PID. Either I am placing the sample script (one you have given) at the wrong place, or it cannot act on TERM. However, the traps are handled in run.sh:

     

    #!/bin/sh

    ### ====================================================================== ###

    ##                                                                          ##

    ##  JBoss Bootstrap Script                                                  ##

    ##                                                                          ##

    ### ====================================================================== ###

     

     

    ### $Id: run.sh 88978 2009-05-16 18:18:45Z alex.loubyansky@jboss.com $ ###

     

     

    DIRNAME=`dirname $0`

    PROGNAME=`basename $0`

    GREP="grep"

     

     

    # Use the maximum available, or set MAX_FD != -1 to use that

    MAX_FD="maximum"

     

     

    #

    # Helper to complain.

    #

    warn() {

        echo "${PROGNAME}: $*"

    }

     

     

    #

    # Helper to puke.

    #

    die() {

        warn $*

        exit 1

    }

     

     

    # OS specific support (must be 'true' or 'false').

    cygwin=false;

    darwin=false;

    linux=false;

    case "`uname`" in

        CYGWIN*)

            cygwin=true

            ;;

     

     

        Darwin*)

            darwin=true

            ;;

           

        Linux)

            linux=true

            ;;

    esac

     

     

    # Read an optional running configuration file

    if [ "x$RUN_CONF" = "x" ]; then

        RUN_CONF="$DIRNAME/run.conf"

    fi

    if [ -r "$RUN_CONF" ]; then

        . "$RUN_CONF"

    fi

     

     

    # Force IPv4 on Linux systems since IPv6 doesn't work correctly with jdk5 and lower

    if [ "$linux" = "true" ]; then

       JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

    fi

     

     

    # For Cygwin, ensure paths are in UNIX format before anything is touched

    if $cygwin ; then

        [ -n "$JBOSS_HOME" ] &&

            JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`

        [ -n "$JAVA_HOME" ] &&

            JAVA_HOME=`cygpath --unix "$JAVA_HOME"`

        [ -n "$JAVAC_JAR" ] &&

            JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`

    fi

     

     

    # Setup JBOSS_HOME

    if [ "x$JBOSS_HOME" = "x" ]; then

        # get the full path (without any relative bits)

        JBOSS_HOME=`cd $DIRNAME/..; pwd`

    fi

    export JBOSS_HOME

     

     

    # Increase the maximum file descriptors if we can

    if [ "$cygwin" = "false" ]; then

        MAX_FD_LIMIT=`ulimit -H -n`

        if [ "$?" -eq 0 ]; then

            # Darwin does not allow RLIMIT_INFINITY on file soft limit

            if [ "$darwin" = "true" -a "$MAX_FD_LIMIT" = "unlimited" ]; then

                MAX_FD_LIMIT=`/usr/sbin/sysctl -n kern.maxfilesperproc`

            fi

     

     

      if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then

         # use the system max

         MAX_FD="$MAX_FD_LIMIT"

      fi

     

     

      ulimit -n $MAX_FD

      if [ "$?" -ne 0 ]; then

         warn "Could not set maximum file descriptor limit: $MAX_FD"

      fi

        else

      warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"

        fi

    fi

     

     

    # Setup the JVM

    if [ "x$JAVA" = "x" ]; then

        if [ "x$JAVA_HOME" != "x" ]; then

      JAVA="$JAVA_HOME/bin/java"

        else

      JAVA="java"

        fi

    fi

     

     

    # Setup the classpath

    runjar="$JBOSS_HOME/bin/run.jar"

    if [ ! -f "$runjar" ]; then

        die "Missing required file: $runjar"

    fi

    JBOSS_BOOT_CLASSPATH="$runjar"

     

     

    # Tomcat uses the JDT Compiler

    # Only include tools.jar if someone wants to use the JDK instead.

    # compatible distribution which JAVA_HOME points to

    if [ "x$JAVAC_JAR" = "x" ]; then

        JAVAC_JAR_FILE="$JAVA_HOME/lib/tools.jar"

    else

        JAVAC_JAR_FILE="$JAVAC_JAR"

    fi

    if [ ! -f "$JAVAC_JAR_FILE" ]; then

       # MacOSX does not have a seperate tools.jar

       if [ "$darwin" != "true" -a "x$JAVAC_JAR" != "x" ]; then

          warn "Missing file: JAVAC_JAR=$JAVAC_JAR"

          warn "Unexpected results may occur."

       fi

       JAVAC_JAR_FILE=

    fi

     

     

    if [ "x$JBOSS_CLASSPATH" = "x" ]; then

        JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH"

    else

        JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH"

    fi

    if [ "x$JAVAC_JAR_FILE" != "x" ]; then

        JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JAVAC_JAR_FILE"

    fi

     

     

    # If -server not set in JAVA_OPTS, set it, if supported

    SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`

    if [ "x$SERVER_SET" = "x" ]; then

     

     

        # Check for SUN(tm) JVM w/ HotSpot support

        if [ "x$HAS_HOTSPOT" = "x" ]; then

      HAS_HOTSPOT=`"$JAVA" -version 2>&1 | $GREP -i HotSpot`

        fi

     

     

        # Enable -server if we have Hotspot, unless we can't

        if [ "x$HAS_HOTSPOT" != "x" ]; then

      # MacOS does not support -server flag

      if [ "$darwin" != "true" ]; then

         JAVA_OPTS="-server $JAVA_OPTS"

      fi

        fi

    fi

     

     

    # Setup JBoss Native library path

    # Use the common JBoss Native convention

    # for packing platform binaries

    #

    JBOSS_NATIVE_CPU=`uname -m`

    case "$JBOSS_NATIVE_CPU" in

      sun4u*)

        JBOSS_NATIVE_CPU="sparcv9"

      ;;

      i86pc*)

        JBOSS_NATIVE_CPU="x86"

      ;;

      i[3-6]86*)

        JBOSS_NATIVE_CPU="x86"

      ;;

      x86_64*)

        JBOSS_NATIVE_CPU="x64"

      ;;

      ia64*)

        JBOSS_NATIVE_CPU="i64"

      ;;

      9000/800*)

        JBOSS_NATIVE_CPU="parisc2"

      ;;

      Power*)

        JBOSS_NATIVE_CPU="ppc"

      ;;

    esac

     

     

    JBOSS_NATIVE_SYS=`uname -s`

    case "$JBOSS_NATIVE_SYS" in

      Linux*)

        JBOSS_NATIVE_SYS="linux2"

      ;;

      SunOS*)

        JBOSS_NATIVE_SYS="solaris"

      ;;

      HP-UX*)

        JBOSS_NATIVE_SYS="hpux"

      ;;

      CYGWIN*)

        JBOSS_NATIVE_SYS="windows"

      ;;

    esac

     

     

    JBOSS_NATIVE_DIR="$JBOSS_HOME/bin/META-INF/lib/$JBOSS_NATIVE_SYS/$JBOSS_NATIVE_CPU"

    if [ -d "$JBOSS_NATIVE_DIR" ]; then

        if $cygwin ; then

            export PATH="$JBOSS_NATIVE_DIR:$PATH"

            JBOSS_NATIVE_DIR=`cygpath --path --windows "$JBOSS_NATIVE_DIR"`

        else

            if [ "x$LD_LIBRARY_PATH" = "x" ]; then

              LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR"

            else

              LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"

            fi

            export LD_LIBRARY_PATH

        fi

        if [ "x$JAVA_OPTS" = "x" ]; then

            JAVA_OPTS="-Djava.library.path=$JBOSS_NATIVE_DIR"

        else

            JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_NATIVE_DIR"

        fi

    fi

     

     

    # Setup JBoss specific properties

    JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"

     

     

    # Setup the java endorsed dirs

    JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"

     

     

    # For Cygwin, switch paths to Windows format before running java

    if $cygwin; then

        JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`

        JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`

        JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`

        JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`

    fi

     

     

    # Display our environment

    echo "========================================================================="

    echo ""

    echo "  JBoss Bootstrap Environment"

    echo ""

    echo "  JBOSS_HOME: $JBOSS_HOME"

    echo ""

    echo "  JAVA: $JAVA"

    echo ""

    echo "  JAVA_OPTS: $JAVA_OPTS"

    echo ""

    echo "  CLASSPATH: $JBOSS_CLASSPATH"

    echo ""

    echo "========================================================================="

    echo ""

     

     

    while true; do

       if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then

          # Execute the JVM in the foreground

          "$JAVA" $JAVA_OPTS \

             -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \

             -classpath "$JBOSS_CLASSPATH" \

             org.jboss.Main "$@"

          JBOSS_STATUS=$?

       else

     

     

          # Execute the JVM in the background

          "$JAVA" $JAVA_OPTS \

             -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \

             -classpath "$JBOSS_CLASSPATH" \

             org.jboss.Main "$@" &

          JBOSS_PID=$!

      # Trap common signals and relay them to the jboss process

          trap "kill -HUP  $JBOSS_PID" HUP

          trap "kill -TERM $JBOSS_PID" INT

          trap "kill -QUIT $JBOSS_PID" QUIT

          trap "kill -PIPE $JBOSS_PID" PIPE

          trap "kill -TERM $JBOSS_PID" TERM

          # Wait until the background process exits

          WAIT_STATUS=128

          while [ "$WAIT_STATUS" -ge 128 ]; do

             wait $JBOSS_PID 2>/dev/null

             WAIT_STATUS=$?

             if [ "${WAIT_STATUS}" -gt 128 ]; then

                SIGNAL=`expr ${WAIT_STATUS} - 128`

                SIGNAL_NAME=`kill -l ${SIGNAL}`

                echo "*** JBossAS process (${JBOSS_PID}) received ${SIGNAL_NAME} signal ***" >&2

             fi         

          done

          if [ "${WAIT_STATUS}" -lt 127 ]; then

             JBOSS_STATUS=$WAIT_STATUS

          else

             JBOSS_STATUS=0

          fi     

       fi

       # If restart doesn't work, check you are running JBossAS 4.0.4+

       #    http://jira.jboss.com/jira/browse/JBAS-2483

       # or the following if you're running Red Hat 7.0

       #    http://developer.java.sun.com/developer/bugParade/bugs/4465334.html  

       if [ "$JBOSS_STATUS" -eq 10 ]; then

          echo "Restarting JBoss..."

       else

          exit $JBOSS_STATUS

       fi

    done

     

         I do have my $JBOSS_HOME set. Can you please suggest where exactly place the sample script in this run.sh??

     

         Thanks.

     

    Best Regards,

    Hushen Savani

  • 11. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Hushen Savani Newbie

    Hi Fink,

     

         I'm up with one more observation. I installed a Fresh Copy of JBoss on the same server. If I let this fresh copy of JBoss be running along with my old JBosses, all three JBoss are up and running. But if I turn down the fresh copy of JBoss, then one of the old JBoss terminates unexpectedly at unexpected time. Isn't it mistrious??? 

     

    Best Regards,

    Hushen Savani

  • 12. Re: JBossAS-5.1.0 terminates automatically on Sun Solaris
    Wolf-Dieter Fink Master

    Very mystic.

    But I've seen so many fast written srcipts that are dangerous in error handling (nice example is 'rm -fr /$MYVAR' - the last message you will see at such system is 'rm rm not found!' )

    So it might be that the process is killed on some conditions (i.e. number of ps -ef|grep jave|wc).

     

    Maybe a warning message with the signal might help you to find the reason (use trap in the jboss.sh script before JB is started), also this will suppress the shutdown.

    the point where you can add the change is after this lines (suppose that you not set env LAUNCH_JBOSS_IN_BACKGROUND)

    while true; do

       if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then

          # Execute the JVM in the foreground