1 Reply Latest reply on Jan 19, 2006 7:44 AM by tzman

    MC archives vs. directories

    tzman

      I am trying to set up a test environment for development with EJB3 and JBoss 4.0.3+.

      During the development cycle I want to give developers the ability to run small test applications which may/will become test cases in junit or testng. However, it appears that the examples have development code deployed to the mc in an archive and I would like to use a path to a directory.

      Looking at the source code I thought I might be able to pass a URL for a local build directory to the foollowing method.

      URL url = new File( "pathToMyBuildOutputDir" ).toURL();
      EJB3StandaloneDeployer deployer.getDeployDirs().add( url );
      

      The code comments seem to imply that this is possible: "The deployer will search through all archives and directories for annotated classes".

      Trying this results in a NPE, I am not sure if this is a bug or my misunderstanding of what the mc can do.

      Any comments/help would be greatly appreciated.


      Thanks


        • 1. Re: MC archives vs. directories
          tzman

          In an attempt to make this simpler I think I made it more confusing. The code I am using is from various examples/tutorials.

          URL url = new File( "pathToMyBuildOutputDir" ).toURL();
          EJB3StandaloneBootstrap.boot(null);
          EJB3StandaloneBootstrap.deployXmlResource( "coeds-beans.xml" );
          deployer = new EJB3StandaloneDeployer();
          
          //
          // Is this possible/correct??
          deployer.getDeployDirs().add( url );
          
          deployer.getArchivesByResource().add( "META-INF/persistence.xml" );
          deployer.create();
          deployer.start();
          initialContext = new InitialContext();
          


          Here is the error I recieve. The error is initiated from deployer.create();
          Fron debug, I can see that the file does exist, it is a directory and it does create a valid local URL. Withouth the added line in question, everything works correctly.
          Caused by: java.lang.NullPointerException
           at javax.naming.InitialContext.getURLScheme(Unknown Source)
           at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
           at javax.naming.InitialContext.lookup(Unknown Source)
           at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:507)
           at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:264)
           at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:381)
           at edu.uno.coeds.test.Ejb3Container.startup(Ejb3Container.java:84)
          


          Thanks again for the help/clarification.