1 Reply Latest reply on May 8, 2009 10:49 AM by Nick Mpallas

    Junit environment in Eclipse IDE for EJB testing in Embedded

    Pierre-Jacques DAUVERT Newbie

      Hi,

      I have troubles setting up environnement for unit testing with Junit in Eclipse IDE.

      I have prepared a couple of tests in a BaseTestCase as shown in Bill Burke's page : http://www.jboss.org/community/docs/DOC-9684?decorator=print

      So far, in eclipse ide, I have set the "Bootstrap Entries" of JUnit runtime environnement through "Run dialog"

      I have added "libs" "optionnal-libs" "bootstrap" folder and my build path in those entries.

      In "Environnement" Tab, I have set a variable "shutdown.embedded.jboss=true"

      When I launch unit test I get the following error :

      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.embedded.Bootstrap.createKernel(Bootstrap.java:123)
       at org.jboss.embedded.Bootstrap.getInstance(Bootstrap.java:70)
       at org.jboss.embedded.junit.BaseTestCase.bootstrap(BaseTestCase.java:95)
       at org.jboss.embedded.junit.BaseTestCase.access$000(BaseTestCase.java:47)
       at org.jboss.embedded.junit.BaseTestCase$1.setUp(BaseTestCase.java:126)
       at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.extensions.TestSetup.run(TestSetup.java:25)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.NullPointerException
       at org.jboss.config.plugins.property.PropertyConfiguration.loadFromProperties(PropertyConfiguration.java:126)
       at org.jboss.config.plugins.property.PropertyConfiguration.createDefaultClassAdapterFactory(PropertyConfiguration.java:86)
       at org.jboss.config.plugins.AbstractConfiguration.getClassAdapterFactory(AbstractConfiguration.java:215)
       at org.jboss.config.plugins.AbstractConfiguration.getBeanInfo(AbstractConfiguration.java:70)
       at org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(AbstractKernelConfig.java:55)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.getImplementation(PropertyKernelConfig.java:157)
       at org.jboss.kernel.plugins.config.property.PropertyKernelConfig.createKernelInitializer(PropertyKernelConfig.java:118)
       at org.jboss.kernel.KernelFactory.createKernelInitializer(KernelFactory.java:150)
       ... 18 more
      
      


      I'm pretty sure that it's a matter of Classpath, but I can't find out a way to solve the problem.
      Has anyone an idea to help?
      Many thanks.
      PJ.

        • 1. Re: Junit environment in Eclipse IDE for EJB testing in Embe
          Nick Mpallas Newbie

          From what i have figure out it's not a simple classpath issue.The microcontainer in classpath needs the jar files in specific order.So on top u must have the bootstrap/resources file where the bootstrap dir for Embedded JBoss.The u add the embedded jars afterwards the src code of your project and then the thirdparty.jar(this one
          NEEDS TO BE LAST in classpath).Also pay some notice in embedded jboss bean xml file to use the 2.0_xsd schema.It's the first time that i see the ordering of dependencies having
          such impact in the way an application operates.

          hope i helped..

          \n\m