3 Replies Latest reply on Feb 20, 2010 9:23 AM by coenos

    Errors starting up Embedded AS from maven test

    coenos

      Hi,

       

      I followed and double checked the instructions on http://www.jboss.org/community/docs/DOC-13843, I am using the full maven classpath configuration.

       

      When running "mvn test" from the EJB project, I get the following errors:

       

      20:35:11,921 INFO  [CorbaNamingService] CORBA Naming Started
      20:35:12,281 ERROR [AbstractKernelController] Error installing to Configured: name=OptimisticSharedCache state=Instantiated
      java.lang.RuntimeException: Error configuring property: useLockStriping for OptimisticSharedCache
              at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
              at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
              at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)

       

      This happens for each bean entry in the jboss-cache-manager-jboss-beans.xml file.

       

      Next error I get is

       

      20:35:17,218 INFO  [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector
      20:35:17,390 INFO  [MailService] Mail Service bound to java:/Mail
      20:35:18,078 ERROR [AbstractKernelController] Error installing to Start: name=jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor state=Create mode=Manual requir
      edState=Installed
      java.net.BindException: Address already in use: Cannot bind

       

      But this port is not in use when I start the mvn test. I checked this, is it allocated twice ?

       


      The third error I get is.

       

      20:35:36,859 ERROR [ScopedProfileServiceController] Error installing to Create: name=ProfileKey@992725[domain=default, server=default, name=farm] state=Configur
      ed mode=On Demand requiredState=Installed
      java.lang.reflect.InvocationTargetException
              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.system.server.profileservice.repository.AbstractProfileLifeCycleAction.invoke(AbstractProfileLifeCycleAction.java:97)
              at org.jboss.system.server.profileservice.repository.AbstractProfileLifeCycleAction.invoke(AbstractProfileLifeCycleAction.java:77)
              at org.jboss.system.server.profileservice.repository.AbstractProfileLifeCycleAction.install(AbstractProfileLifeCycleAction.java:49)
              at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
              at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
              at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:258)
              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:97)
              at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:860)
              at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:441)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalStateException: Must register RepositoryClusteringHandler before calling create()

       

      I cannot find any documentation on this third error.

       

       

      This is my test class:

       

      package com.coenos.seamdemo.ejb.test;

       

      import java.util.logging.Logger;

       

      import javax.naming.Context;
      import javax.naming.InitialContext;

       

      import org.jboss.bootstrap.api.lifecycle.LifecycleState;
      import org.jboss.embedded.api.DeploymentException;
      import org.jboss.embedded.api.server.JBossASEmbeddedServer;
      import org.jboss.embedded.api.server.JBossASEmbeddedServerFactory;
      import org.jboss.shrinkwrap.api.Archives;
      import org.jboss.shrinkwrap.api.spec.JavaArchive;
      import org.junit.AfterClass;
      import org.junit.BeforeClass;
      import org.junit.Test;

       

      import com.coenos.seamdemo.ejb.entity.Customer;
      import com.coenos.seamdemo.ejb.entity.Orders;

       

      public class BaseEjbTest{

       

           /**
              * Logger
              */
             private static final Logger log = Logger.getLogger(BaseEjbTest.class.getName());

       

             /**
              * The server instance
              */
             private static JBossASEmbeddedServer server;
            
             /**
              * The JNDI Context
              */
             private static Context NAMING_CONTEXT;
            
             /**
              * Name of the server configuration to use
              */
             private static final String NAME_SERVER_CONFIG = "all";
            
           /**
              * Starts up the Application Server.  Relies upon either Environment
              * Variable "JBOSS_HOME" or System Property "jboss.home" being set, with
              * precedence to the system property
              */
             @BeforeClass
             public static void startEmbedddedASAndSetNamingContext() throws Exception
             {
                // Make Server (will pull JBOSS_HOME from env var or sys prop)
                server = JBossASEmbeddedServerFactory.createServer();
                log.info("Created: " + server);

       

                // Start
                log.info("Starting Server: " + server);
                server.getConfiguration().serverName(NAME_SERVER_CONFIG);
                server.start();
                log.info("...started.");

       

                // Set Naming Context
                NAMING_CONTEXT = new InitialContext();
             }
            
             /**
              * Shuts down the Application Server after the suite ends
              */
             @AfterClass
             public static void stopEmbeddedAS() throws Exception
             {
                // If exists and started
                if (server != null && server.getState().equals(LifecycleState.STARTED))
                {
                   // Shutdown
                   log.info("Shutting down server: " + server);
                   server.shutdown();
                }

       

             }
            
             @Test
             public void testThis() throws InterruptedException, IllegalArgumentException, DeploymentException{
                
                 final String name = "this.jar";
                
                 final JavaArchive archive = Archives.create(name, JavaArchive.class).addClasses(Customer.class,
                          Orders.class);
                    log.info(archive.toString(true));
                    // Deploy
                    server.deploy(archive);
             }
            
            
      }

       

      Hope someone can help me out,

      Coenos