14 Replies Latest reply on Oct 12, 2010 12:22 AM by Denis Golovin

    Starting/Stoping Jboss 5.1 using web profile

    Rodrigo Uchoa Novice

      Hey guys,

       

      I've noticed there's a problem when using JBoss 5.1 with the web profile . Starting and Stoping the server does not work as it should.

       

      When starting, eclipse doesn't seem to know when the server is already up, so it keeps constantly saying "Starting server..", as if it never ended. When stoping I get a "javax.naming.CommunicationException: failed to connect to server".

       

      I've done some research and it seems it has something to do with the jmx poller not being installed in the web profile. Some people have suggested switching the startup/shutdown pollers to "timeout", but even though this works, it's kinda annoying.

       

      So, does anyone know how to turn the jmx poller back on in the web profile? Or is there any other workaround instead of using a "timeout poller"?

       

      My environment:

      JBoss AS 5.1 GA

      Eclipse Helios cocoa 32bits for Mac

      JBoss Tools 3.2 M2

       

       

       

      Regards!

        • 1. Re: Starting/Stoping Jboss 5.1 using web profile
          Denis Golovin Master

          I remember there were two archives available jboss-5.1.0.GA.zip and jboss-5.1.0.GA-jdk6.zip. Are you using JBoss AS 5.1. for Java 1.5 or 1.6?

          • 2. Re: Starting/Stoping Jboss 5.1 using web profile
            Rodrigo Uchoa Novice

            I downloaded the jboss-5.1.0.GA.zip archive, running on jdk 1.5

            • 3. Re: Starting/Stoping Jboss 5.1 using web profile
              Rob Stryker Master

              My understanding of the issue is that the "Web profile" is a strict jee profile for web which includes only what is required for the specification. JMX is not a requirement for this profile and so it is not included. I'm not sure how you'd go about adding JMX to the profile as that gets into the guts of the app server and not the toolset.

               

              Already committed to jbosstools trunk is a web poller, which checks host:8080 for a result to see when the server is up or down.

              • 4. Re: Starting/Stoping Jboss 5.1 using web profile
                Rodrigo Uchoa Novice

                Rob,

                 

                Sounds like a reasonable explanation. This commit you mentioned was not made before the 3.2.0.M2 release, was it? Or do I have to get the nightly build?

                 

                Thanks.

                • 5. Re: Starting/Stoping Jboss 5.1 using web profile
                  Denis Golovin Master

                  You can make it work by changing server/web/conf/jboss-service.xml until Robs changes get into nightly build:

                  • find "-1" in server/web/conf/jboss-service.xml
                  • check if it is in node <mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
                  • replace -1 with 1099
                  • copy server/default/deploy/jmx-invoker-service.xml to server/web/deploy (if you didn't make any changes in this file in web profile just owerride existing one)
                  • copy server/default/deploy/legacy-invokers-service.xml to server/web/deploy

                  jmx pooler should work after taht, but I guess it should be called JNDI pooler instead because it uses InitialContext to get to server status form jboss.system.Server trough "jmx/invoker/RMIAdaptor" object.

                  1 of 1 people found this helpful
                  • 6. Re: Starting/Stoping Jboss 5.1 using web profile
                    Rodrigo Uchoa Novice

                    Denis,

                     

                    I tried and it didn't work. In fact, jboss stopped working at all. It keeps throwing a NullPointerException when starting and it stops right afterwards. I'm not sure if it's a jboss as issue, or a jboss tools issue, since the exception shows up in a little popup panel.

                     

                    Well, thanks anyway.

                     

                    Cheers!

                    • 7. Re: Starting/Stoping Jboss 5.1 using web profile
                      Denis Golovin Master

                      What I forgot to mention is you need to copy two more files from server/default/deploy to server/web/deploy:

                      • jmx-invoker-service.xml (if you didn't make any changes in this file in web profile just owerride existing one)
                      • legacy-invokers-service.xml
                      1 of 1 people found this helpful
                      • 8. Re: Starting/Stoping Jboss 5.1 using web profile
                        Rodrigo Uchoa Novice

                        Dennis,

                         

                        Starting worked great. But if go to "Server View", right click the server and choose "stop", this is what I get:

                         

                        Exception in thread "main" javax.naming.NameNotFoundException: RMIAdaptor not bound
                            at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
                            at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
                            at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
                            at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
                            at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
                            at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
                            at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                            at java.lang.reflect.Method.invoke(Method.java:585)
                            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
                            at sun.rmi.transport.Transport$1.run(Transport.java:153)
                            at java.security.AccessController.doPrivileged(Native Method)
                            at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
                            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
                            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
                            at java.lang.Thread.run(Thread.java:613)
                            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                            at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
                            at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
                            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
                            at javax.naming.InitialContext.lookup(InitialContext.java:351)
                            at org.jboss.Shutdown.main(Shutdown.java:219)

                        • 9. Re: Starting/Stoping Jboss 5.1 using web profile
                          Rob Stryker Master

                          Hi Rodrigo...

                           

                            What happens if you load up a terminal and use the shutdown.sh script? I believe you will get the same error. The shutdown classes depend on JMX being enabled.

                           

                          As I mentioned before, the JBossTools 3.2 will have a new Web Poller in addition to the JMX poller. This should make using the web profile much more convenient and less error-prone.

                          • 10. Re: Starting/Stoping Jboss 5.1 using web profile
                            Rob Stryker Master

                            Actually now that I think about it, shutdown may still fail in the web profile if it has no JMX. If this is the case, the only thing to do is to forcefully terminate the process. This will require looking into.

                             

                            We currently don't do anything to assist the minimal configuration from terminating... and I'm not sure what we can do to properly shut down the web configuration.          

                            • 11. Re: Starting/Stoping Jboss 5.1 using web profile
                              Denis Golovin Master

                              Rodrigo,

                              that's what is working for me. I have clean JBoss AS 5.1.0 installation with adjustments I explained above.

                              Are you still using 3.2.0.M2 or nightly version of JBossTools?

                              Do you get this exception in server console or eclipse log?

                               

                              Check server/web/jmx-invoker-service.xml file if JNDI Name are defined in first node like

                               

                              <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
                                    name="jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory">
                                    <!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
                                    <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
                                    <!-- The target MBean is the InvokerAdaptorService configured below -->
                                    <depends optional-attribute-name="TargetName">jboss.jmx:type=adaptor,name=Invoker</depends>
                                    <!-- Where to bind the RMIAdaptor proxy -->
                                    <attribute name="JndiName">jmx/invoker/RMIAdaptor</attribute>
                              ...
                                    </attribute>
                                    <depends>jboss:service=Naming</depends>
                                 </mbean>

                              • 12. Re: Starting/Stoping Jboss 5.1 using web profile
                                Rodrigo Uchoa Novice

                                Dennis,

                                 

                                My jmx-invoker-service.xml seems to be exactly like yours. I'm using a nightly build of jboss tools. One thing I noticed though, is that the exception I get in server console have changed. Whenever I hit "stop" in server view, this is what I get (to avoid this problem I'm always killing the process instead, and the shutdown hook does its job):

                                 

                                08:54:23,282 ERROR [NamingContext] Caught exception flushing server cache and re-establish naming after exception no such object in table

                                javax.naming.CommunicationException: Could not obtain connection to any of these urls: 0.0.0.0:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server /0.0.0.0:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /0.0.0.0:1099 [Root exception is java.net.ConnectException: Connection refused]]]

                                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763)

                                at org.jnp.interfaces.NamingContext.handleStaleNamingStub(NamingContext.java:1901)

                                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:731)

                                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

                                at javax.naming.InitialContext.lookup(InitialContext.java:351)

                                at org.jboss.Shutdown.main(Shutdown.java:219)

                                Caused by: javax.naming.CommunicationException: Failed to connect to server /0.0.0.0:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /0.0.0.0:1099 [Root exception is java.net.ConnectException: Connection refused]]

                                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:335)

                                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1734)

                                ... 5 more

                                Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server /0.0.0.0:1099 [Root exception is java.net.ConnectException: Connection refused]

                                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:305)

                                ... 6 more

                                Caused by: java.net.ConnectException: Connection refused

                                at java.net.PlainSocketImpl.socketConnect(Native Method)

                                at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

                                at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:193)

                                at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

                                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)

                                at java.net.Socket.connect(Socket.java:520)

                                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)

                                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)

                                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301)

                                ... 6 more

                                Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]

                                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:839)

                                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

                                at javax.naming.InitialContext.lookup(InitialContext.java:351)

                                at org.jboss.Shutdown.main(Shutdown.java:219)

                                Caused by: java.rmi.NoSuchObjectException: no such object in table

                                at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)

                                at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)

                                at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)

                                at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

                                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)

                                ... 3 more

                                • 13. Re: Starting/Stoping Jboss 5.1 using web profile
                                  Rodrigo Uchoa Novice

                                  Guys,

                                   

                                  In an amazing turning of events, I switched the 'Shutdown Poller' config from 'JMX Poller' to 'Process Terminated Poller', and it worked like a charm.

                                  Now I can normally stop the server from the Server View.

                                   

                                  This thread might also be helpful: http://community.jboss.org/thread/156046

                                  • 14. Re: Starting/Stoping Jboss 5.1 using web profile
                                    Denis Golovin Master

                                    Yay!

                                    That's what I have in my server configuration and that's the reason why it works for me. I guess it has this compibation by default: JMX Poller for startup and Process Terminated Poller for shutdown.