9 Replies Latest reply on Jul 21, 2008 11:09 AM by peterj

    Error in shutdown using jboss_init_redhat.sh

    thalupula

      Hi,

      I'm getting below error when i run shutdown command to shutdown my remote server(redhat). Starting of server is working fine. I want restart my server because i found a oom error in log ( 2008-07-17 23:38:18,134 ERROR [STDERR] java.lang.OutOfMemoryError: PermGen space).

      /opt/jboss-4.2.2.GA/bin/jboss_init_redhat.sh stop


      Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to retrieve stub from server localhost:1099 [Root exception is java.io.EOFException]]
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.Shutdown.main(Shutdown.java:214)
      Caused by: javax.naming.CommunicationException: Failed to retrieve stub from server localhost:1099 [Root exception is java.io.EOFException]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:268)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
      ... 4 more
      Caused by: java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2498)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1273)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:256)
      ... 5 more

      Any help greatly appreciated.

      Regards,
      Ravi Thalupula

        • 1. Re: Error in shutdown using jboss_init_redhat.sh
          dimitris

          If the server has run out of memory, it wont respond to shutdown request either. You need to send a termination signal to the JVM process that runs jboss.

          • 2. Re: Error in shutdown using jboss_init_redhat.sh
            thalupula

            Help me by providing information regarding terminate command.

            I'm new to linux environment.

            Thanks a lot for quick response.

            -Ravi Thalupula

            • 3. Re: Error in shutdown using jboss_init_redhat.sh
              peterj

              Use the shutdown script to stop a remote app server:

              ./shutdown.sh -S -s hostname:1099

              where hostname is either the name or IP address and 1099 is the JNDI port.

              • 4. Re: Error in shutdown using jboss_init_redhat.sh
                thalupula

                Hi Peter,

                I tried it but same error. One thing i want add here is i'm using putty as ssh client to connect as su user.

                My remote server is redhat - version 3.00.15(1)-release (x86_64-redhat-linux-gnu).

                Any help greatly appreciated.

                Regards,
                Ravi Thalupula

                • 5. Re: Error in shutdown using jboss_init_redhat.sh
                  peterj

                  OK, so you want to shut down a local app server not a remote app server. "local" and "remote" does not refer to your physical location, but rather where the command line is being executed. Since you connected to the server using putty, any commands entered in are local. In that case you can use either the command you posted or the command I posted (use localhost for hostname) to shut down the app server.

                  This assumes that the app server is using port 1099 for JNDI.

                  Or are you still trying to shut down the hung app server that got an out-of-memory error? As Dimitri pointed out, if the app server ran out of memory, you will not be able to shut down the app server this way. You will have to kill it. To kill it, you will first have to find its process id:

                  ps -ef | grep java

                  Scan through the results of that command, looking for a java process that uses org.jboss.Main as its class. Use the kill command to end it:

                  kill -9 xxx

                  where xxx is the process id of the java process.

                  • 6. Re: Error in shutdown using jboss_init_redhat.sh
                    thalupula

                    Hi,

                    Please find my jboss_init_redhat.sh file. Correct me if i'm wrong.


                    Regards,
                    Ravi Thalupula


                    #!/bin/sh
                    #
                    # $Id: jboss_init_redhat.sh 60992 2007-02-28 11:33:27Z dimitris@jboss.org $
                    #
                    # JBoss Control Script
                    #
                    # To use this script run it as root - it will switch to the specified user
                    #
                    # Here is a little (and extremely primitive) startup/shutdown script
                    # for RedHat systems. It assumes that JBoss lives in /usr/local/jboss,
                    # it's run by user 'jboss' and JDK binaries are in /usr/local/jdk/bin.
                    # All this can be changed in the script itself.
                    #
                    # Either modify this script for your requirements or just ensure that
                    # the following variables are set correctly before calling the script.

                    #define where jboss is - this is the directory containing directories log, bin, conf etc
                    JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss-4.2.2.GA"}

                    #define the user under which jboss will run, or use 'RUNASIS' to run as the current user
                    JBOSS_USER=${JBOSS_USER:-"jboss"}

                    #make sure java is in your path
                    JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.5.0_16"}

                    #configuration to use, usually one of 'minimal', 'default', 'all'
                    JBOSS_CONF=${JBOSS_CONF:-"default"}

                    #define JBOSS_HOST
                    JBOSS_HOST=${JBOSS_HOST:-"0.0.0.0"}

                    #if JBOSS_HOST specified, use -b to bind jboss services to that address
                    JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}

                    #define the classpath for the shutdown class
                    JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}

                    #define the script to use to start jboss
                    JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}

                    if [ "$JBOSS_USER" = "RUNASIS" ]; then
                    SUBIT=""
                    else
                    SUBIT="su - $JBOSS_USER -c "
                    fi

                    if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
                    # ensure the file exists
                    touch $JBOSS_CONSOLE
                    if [ ! -z "$SUBIT" ]; then
                    chown $JBOSS_USER $JBOSS_CONSOLE
                    fi
                    fi

                    if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
                    echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"
                    echo "WARNING: ignoring it and using /dev/null"
                    JBOSS_CONSOLE="/dev/null"
                    fi

                    #define what will be done with the console log
                    JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}

                    JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
                    JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"}

                    if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
                    export PATH=$PATH:$JAVAPTH
                    fi

                    if [ ! -d "$JBOSS_HOME" ]; then
                    echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
                    exit 1
                    fi

                    echo JBOSS_CMD_START = $JBOSS_CMD_START

                    case "$1" in
                    start)
                    cd $JBOSS_HOME/bin
                    if [ -z "$SUBIT" ]; then
                    eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &
                    else
                    $SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &"
                    fi
                    ;;
                    stop)
                    if [ -z "$SUBIT" ]; then
                    $JBOSS_CMD_STOP
                    else
                    $SUBIT "$JBOSS_CMD_STOP"
                    fi
                    ;;
                    restart)
                    $0 stop
                    $0 start
                    ;;
                    *)
                    echo "usage: $0 (start|stop|restart|help)"
                    esac

                    • 7. Re: Error in shutdown using jboss_init_redhat.sh
                      peterj

                      Based on the posting timestamps, I'll assume you wrote your post before you saw my last post.

                      Are you still trying to stop the out-of-memory app server, or are you asking about how to stop the app server in general?

                      • 8. Re: Error in shutdown using jboss_init_redhat.sh
                        thalupula

                        Hi Peter,

                        I done with shutdown by following your instructions, Now i'm focusing on the exception. How can i resolve below error. Any configurations required at run.sh file?

                        04:03:34,829 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message), causedBy:
                        javax.ejb.EJBException: Unexpected Error
                        java.lang.OutOfMemoryError: PermGen space

                        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:237)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
                        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
                        at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
                        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
                        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
                        at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
                        at org.jboss.ejb.Container.invoke(Container.java:960)
                        at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        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.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
                        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
                        at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
                        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
                        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
                        at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.delivery(MessageEndpointInterceptor.java:263)
                        at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.invoke(MessageEndpointInterceptor.java:140)
                        at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
                        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
                        at $Proxy85.onMessage(Unknown Source)
                        at com.ibm.mq.connector.inbound.MessageEndpointWrapper.onMessage(MessageEndpointWrapper.java:124)
                        at com.ibm.mq.jms.MQSession.run(MQSession.java:1592)
                        at com.ibm.mq.connector.inbound.WorkImpl.run(WorkImpl.java:142)
                        at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
                        at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
                        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
                        at java.lang.Thread.run(Thread.java:595)

                        Regards,
                        Ravi Thalupula

                        • 9. Re: Error in shutdown using jboss_init_redhat.sh
                          peterj