1 Reply Latest reply on Jun 7, 2006 11:08 PM by Daniel Young

    Seam application testing width Embeddable Alpha 7 and JUnit

    Jens Weintraut Apprentice

      Hi,

      I want to test my Seam application with the EJB Embeddable Alpha7 container. I've added the \conf and all the .jar files in \lib to the classpath of the Eclipse JUnit running. Then I want ot run my test class. But the container ends with this error:

      java.lang.RuntimeException: java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:344)
       at com.idsscheer.ares.test.LoginActionTest.startupEmbeddedEJB3(LoginActionTest.java:79)
       at com.idsscheer.ares.test.LoginActionTest.initClass(LoginActionTest.java:28)
       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:585)
       at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
       at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
       at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
       at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
       at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.RuntimeException: Unable to create a KernelInitializer based on the specified KernelConfig
       at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:156)
       at org.jboss.kernel.KernelFactory.assembleNewKernel(KernelFactory.java:99)
       at org.jboss.kernel.KernelFactory.newInstance(KernelFactory.java:67)
       at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.bootstrap(AbstractBootstrap.java:120)
       at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89)
       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.createKernel(EJB3StandaloneBootstrap.java:370)
       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:328)
       ... 14 more
      Caused by: java.lang.NullPointerException
       at org.jboss.config.plugins.AbstractConfiguration.createDefaultClassAdapterFactory(AbstractConfiguration.java:227)
       at org.jboss.config.plugins.AbstractConfiguration.getClassAdapterFactory(AbstractConfiguration.java:199)
       at org.jboss.config.plugins.AbstractConfiguration.getBeanInfo(AbstractConfiguration.java:77)
       at org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(AbstractKernelConfig.java:55)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.getImplementation(PropertyKernelConfig.java:147)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKernelConfig.java:117)
       at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:150)
       ... 20 more


      I don't find any hint that would lead me to a solution of my problem. My test class looks like:

      public class LoginActionTest {
       private static EntityManagerFactory emf;
       private EntityManager em;
       private EntityTransaction transaction;
      
       @BeforeClass
       public static void initClass() {
       startupEmbeddedEJB3();
       emf = Persistence.createEntityManagerFactory("database");
       }
      
       @Before
       public void init() {
       em = emf.createEntityManager();
       transaction = em.getTransaction();
       transaction.begin();
       }
      
       @After
       public void destroy() {
       transaction.commit();
       em.close();
       }
      
       @AfterClass
       public static void destroyClass() {
       emf.close();
       shutdownEmbeddedEJB3();
       }
      
       @Test
       public void login() {
       User u = new User();
       u.setID("userID");
      
       LoginAction loginAction = new LoginAction();
       loginAction.setAresDatabase(em);
       loginAction.setUser(u);
      
       assert "main".equals(loginAction.login());
      
       }
      
       public static junit.framework.Test suite() {
       return new JUnit4TestAdapter(LoginActionTest.class);
       }
      
       protected static void startupEmbeddedEJB3() {
       EJB3StandaloneBootstrap.boot(null);
       EJB3StandaloneBootstrap.scanClasspath();
       }
      
       protected static void shutdownEmbeddedEJB3() {
       EJB3StandaloneBootstrap.shutdown();
       }
      }