9 Replies Latest reply on Oct 26, 2012 2:35 PM by munir_salim

    Error: The server is already running!

    munir_salim

      Hello!

       

      I am using jbossas-managed-5.1 .

       

      Two days ago I run the tests (with TestNG) for the first time and all works. I haven't modified nothing in pom.xml.

       

      Today when I try to run the tests again I got the follow error:

       

      org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start remote container

          at org.jboss.arquillian.container.jbossas.managed_5_1.JBossASLocalContainer.start(JBossASLocalContainer.java:115)

          at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:198)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221)

          at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

          at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)

          at org.jboss.arquillian.testng.Arquillian.arquillianBeforeSuite(Arquillian.java:65)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

          at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:551)

          at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)

          at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)

          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)

          at org.testng.SuiteRunner.run(SuiteRunner.java:240)

          at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)

          at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)

          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)

          at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)

          at org.testng.TestNG.run(TestNG.java:1022)

          at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)

          at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)

          at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

      Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: The server is already running! Managed containers does not support connecting to running server instances due to the possible harmfull effect of connecting to the wrong server. Please stop server before running or change to another type of container.

          at org.jboss.arquillian.container.jbossas.managed_5_1.JBossASLocalContainer.start(JBossASLocalContainer.java:103)

          ... 73 more

       

      Someone had this error with Jbossas 5 Managed?

       

      Thx!

        • 1. Re: Error: The server is already running!
          grossetieg

          The "Caused by" tell you why and how to fix it :

          The server is already running! Managed containers does not support connecting to running server instances due to the possible harmfull effect of connecting to the wrong server. Please stop server before running or change to another type of container.

           

          Guillaume.

          • 2. Re: Error: The server is already running!
            munir_salim

            Guillaume... thx for you help...

             

            But this discussion is exactly cause I don't know how fix what 'caused by' is saying rsrsrs

             

            you know how fix it?

             

            Thx.

            • 3. Re: Error: The server is already running!
              bmajsak

              Run jps and see if there is some other jboss instance running (and using the same ports), or try to change the ports for your managed container.

              • 4. Re: Error: The server is already running!
                munir_salim

                jps show this:

                 

                C:\>jps -l

                6088 sun.tools.jps.Jps

                5092 C:\eclipse\\plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.

                jar

                 

                Who can I change the ports of managed container?

                • 5. Re: Error: The server is already running!
                  bmajsak

                  Which versions of ARQ stuff are you using?

                   

                  container reference doc can be found here

                  https://docs.jboss.org/author/display/ARQ/JBoss+AS+5.1+-+Managed

                  • 6. Re: Error: The server is already running!
                    munir_salim

                    <profile>

                                <id>jbossas-managed-5.1</id>

                                <dependencies>

                                    <dependency>

                                        <groupId>org.jboss.arquillian.container</groupId>

                                        <artifactId>arquillian-jbossas-managed-5.1</artifactId>

                                        <version>1.0.0.CR3</version>

                                    </dependency>

                                    <dependency>

                                        <groupId>org.jboss.arquillian.testng</groupId>

                                        <artifactId>arquillian-testng-container</artifactId>

                                        <version>1.0.0.Final</version>

                                    </dependency>

                                    <dependency>

                                        <groupId>org.jboss.jbossas</groupId>

                                        <artifactId>jboss-server-manager</artifactId>

                                        <version>1.0.3.GA</version>

                                    </dependency>

                                    <dependency>

                                        <groupId>org.jboss.jbossas</groupId>

                                        <artifactId>jboss-as-client</artifactId>

                                        <version>5.1.0.GA</version>

                                        <type>pom</type>

                                    </dependency>

                                </dependencies>

                    </profile>

                     

                    <repositories>

                            <repository>

                                <id>JBoss</id>

                                <name>JBoss Repository</name>

                                <url>https://repository.jboss.org/nexus/content/groups/public/</url>

                            </repository>

                    </repositories>

                     

                    <dependencies>

                          ...

                         <dependency>

                                <groupId>org.testng</groupId>

                                <artifactId>testng</artifactId>

                                <version>6.4</version>

                                <scope>test</scope>

                            </dependency>

                    </dependencies>

                    • 7. Re: Error: The server is already running!
                      munir_salim

                      And the HelloTest class:

                       

                      import java.util.Hashtable;

                       

                      import javax.naming.Context;

                      import javax.naming.InitialContext;

                      import javax.naming.NamingException;

                       

                      import org.jboss.arquillian.container.test.api.Deployment;

                      import org.jboss.arquillian.testng.Arquillian;

                      import org.jboss.shrinkwrap.api.ShrinkWrap;

                      import org.jboss.shrinkwrap.api.spec.JavaArchive;

                      import org.testng.annotations.BeforeMethod;

                      import org.testng.annotations.Test;

                       

                      import static org.testng.Assert.assertEquals;

                       

                       

                      public class HelloTest extends Arquillian {

                         

                         

                          private HelloInterface helloEJB;

                         

                          Hashtable<String,String> config = new Hashtable<String, String>();

                         

                          @BeforeMethod()

                          public void init() throws NamingException{

                             

                              Hashtable<String,String> config = new Hashtable<String, String>();

                       

                              config.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

                              config.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

                              config.put(Context.PROVIDER_URL,"jnp://localhost:1099");

                             

                              InitialContext cx = null;

                             

                              try {

                                  cx = new InitialContext(config);

                              } catch (NamingException e) {

                                  e.printStackTrace();

                              }

                             

                              String name = "test/Hello/remote";

                              helloEJB = (HelloInterface)cx.lookup(name);

                       

                          }

                         

                       

                          @Deployment

                          public static JavaArchive createTestArchive() {

                              return ShrinkWrap.create(JavaArchive.class, "helloEJB.jar")

                                      .addClasses(Hello.class,HelloInterface.class);

                          }

                       

                          @Test

                          public void testHelloEJB() {

                             

                              String result = helloEJB.sayHelloEJB("Munir");

                              assertEquals(result,"Hello Munir");

                             

                          }

                       

                      }

                      • 8. Re: Error: The server is already running!
                        grossetieg

                        I only saw this error when the server is actually running. Nothing is running on the default port ?

                         

                        Guillaume.

                        1 of 1 people found this helpful
                        • 9. Re: Error: The server is already running!
                          munir_salim

                          With the command netstat –noa I could see that port 8080 is being used by Oracle 10g

                           

                          I closed it and now is working!


                          thank you very much! =D