2 Replies Latest reply on May 26, 2006 4:09 AM by Marco

    Problems in deploying EJBs on embeddable-alpha 5

    Marco Novice

      hi all,
      i post my question here even if it does not concern 100% EJB3.

      i refer to this post in the jboss-seam forum

      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=83706


      i have downloaded from cvs latest jboss seam, and i am writing unit tests
      using embeddable-alpha6 classes that comes with seam.
      whenever i run my tests, i get following exception (here' sstakctrace)

      2006-05-25 16:59:27,250 DEBUG org.jboss.ejb3.EJBContainer [main] - Initialisin
      g interceptors for EControlSessionBean...
      2006-05-25 16:59:27,250 DEBUG org.jboss.ejb3.EJBContainer [main] - Default int
      erceptors: null
      2006-05-25 16:59:27,250 DEBUG org.jboss.ejb3.EJBContainer [main] - Class inter
      ceptors: []
      2006-05-25 16:59:27,250 DEBUG org.jboss.ejb3.EJBContainer [main] - All applica
      ble interceptor classes: []
      2006-05-25 16:59:27,281 INFO org.jboss.ejb3.MCKernelAbstraction [main] - inst
      alling bean: jboss.j2ee:jar=classes,name=EControlSessionBean,service=EJB3 with d
      ependencies:
      2006-05-25 16:59:27,281 INFO org.jboss.ejb3.MCKernelAbstraction [main] -
      AbstractDependencyMetaData@23d275{dependency=persistence.units:jar=classes.jar,u
      nitName=cal}
      2006-05-25 16:59:27,796 DEBUG org.jboss.ejb3.tx.UserTransactionImpl [main] - n
      ew UserTx: org.jboss.ejb3.tx.UserTransactionImpl@3da850
      2006-05-25 16:59:28,140 DEBUG org.jboss.ejb3.security.JaccHelper [main] - ECon
      trolSessionBean has no @SecurityDomain - skipping JACC configuration
      2006-05-25 16:59:28,140 INFO org.jboss.ejb3.EJBContainer [main] - STARTED EJB
      : com.myapp.econtrol.session.EControlSessionBean ejbName: EControlSessionBean
      2006-05-25 16:59:28,156 DEBUG org.jboss.ejb3.Ejb3Deployment [main] - Bound ejb
      3 container jboss.j2ee:service=EJB3,jar=classes,name=EControlSessionBean
      ...... embedded-jboss-beans deployed....
      ...... deploying MM ejb3.....
      ...... ejb3 deployed....
      ...... deployer created....
      java.lang.NullPointerException
       at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.loadMbeanServer(EJB3St
      andaloneDeployer.java:474)
       at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDe
      ployer.java:451)
       at example1.EJB3ContainerTestNG.startup(EJB3ContainerTestNG.java:54)
       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.MethodHelper.invokeMethod(MethodHelper.java:552)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:31
      8)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:152)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:216)
       at org.testng.SuiteRunner.run(SuiteRunner.java:146)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:676)
       at org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGE
      xecutor.java:64)
       at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXml
      TestSuite.java:75)
       at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
       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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
      refireBooter.java:220)
       at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
      ava:733)
      java.lang.NullPointerException
       at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.loadMbeanServer(EJB3St
      andaloneDeployer.java:474)
       at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDe
      ployer.java:451)
       at example1.EJB3ContainerTestNG.startup(EJB3ContainerTestNG.java:54)
       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.MethodHelper.invokeMethod(MethodHelper.java:552)
       at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:31
      8)
       at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:152)
       at org.testng.SuiteRunner.privateRun(SuiteRunner.java:216)
       at org.testng.SuiteRunner.run(SuiteRunner.java:146)
       at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713)
       at org.testng.TestNG.runSuitesLocally(TestNG.java:676)
       at org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGE
      


      could anyone help me out inf iguring out what i am missing?
      i am usign exactly the same files that are included in jboss-seam\embeddable-ejb\conf..

      here's code in my class
      package example1;
      
      
      
      
      import org.jboss.ejb3.embedded.*;
      import org.testng.annotations.Configuration;
      import org.testng.annotations.ExpectedExceptions;
      import org.testng.annotations.Test;
      import junit.framework.*;
      import junit.extensions.*;
      
      
      import javax.naming.*;
      
      /**
       * Boots the JBoss Microcontainer with an EJB3 configuration.
       * <p>
       * You can also use this class to lookup managed beans from JNDI.
       *
       * @author christian.bauer@jboss.com
       */
      public class EJB3ContainerTestNG extends TestCase{
      
       private static InitialContext initialContext;
       private EJB3StandaloneDeployer deployer;
      
      
       @Configuration(groups = "integration.ejb3", beforeTest = true)
       public void startup() {
       try {
      
       System.err.println("---- bootstrapping EJB3 container....");
      
       // Boot the JBoss Microcontainer with EJB3 settings, loads ejb3-interceptors-aop.xml
       EJB3StandaloneBootstrap.boot(null);
       System.err.println("...... deploying embedded-jboss-beans....");
       // Deploy CaveatEmptor beans (datasource, mostly)
       //EJB3StandaloneBootstrap.deployXmlResource("embedded-jboss-beans.xml");
       //EJB3StandaloneBootstrap.deployXmlResource("ejb3-interceptors-aop..xml");
       //EJB3StandaloneBootstrap.deployXmlResource("embedded-jboss-beans.xml");
       EJB3StandaloneBootstrap.scanClasspath();
      
       System.err.println("...... embedded-jboss-beans deployed....");
       // Add all EJBs found in the archive that has this file
       deployer = new EJB3StandaloneDeployer();
      
       System.err.println("...... deploying MM ejb3.....");
       System.err.println("...... ejb3 deployed....");
       // Deploy everything we got
       deployer.create();
       System.err.println("...... deployer created....");
      
       deployer.start();
       System.err.println("...... deployer started....");
      
       // Create InitialContext from jndi.properties
       initialContext = new InitialContext();
      
      
       System.err.println("---- end of bootstrapping EJB3 container....InitialContext is:");
      
       } catch (Exception ex) {
       ex.printStackTrace();
       throw new RuntimeException(ex);
       }
       }
      
      
      
      
       @Configuration(groups = "integration.ejb3", afterTest = true)
       public void shutdown() {
       try {
       System.err.println("---- Invoking EJB3.shutdown..");
       deployer.stop();
       deployer.destroy();
       EJB3StandaloneBootstrap.shutdown();
       } catch (Exception ex) {
       throw new RuntimeException(ex);
       }
       }
      
      
       public void testMethod1() {
       System.err.println("EJB3CONTAINER..... TESTING1");
       }
      
      
      
      
      
       public static Object lookup(String beanName) {
       try {
      
       return initialContext.lookup(beanName);
       } catch (NamingException ex) {
       throw new RuntimeException("Couldn't lookup: " + beanName, ex);
       }
       }
      
      
      
      }
      


      thanks and regards
      marco