9 Replies Latest reply on Dec 6, 2007 7:26 PM by Scott Stark

    Embedded - EJB deployment problems

    Pete Muir Master

      I'm seeing two problems currently (apart from hibernate being able to scan for Entities). Both of these were working in my checkout from Friday

      1)

      [testng] ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Parse: name=vfsfile:/Users/pmuir/workspace/jboss-seam/examples/booking/test-build/ state=Not Installed mode=Manual requiredState=Parse
       [testng] org.jboss.deployers.spi.DeploymentException
       [testng] at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
       [testng] at org.jboss.deployment.JBossEjbParsingDeployer.getStandardMetaData(JBossEjbParsingDeployer.java:180)
       [testng] at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:89)
       [testng] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:162)
       [testng] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
       [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
       [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
       [testng] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
       [testng] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
       [testng] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
       [testng] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
       [testng] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
       [testng] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
       [testng] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
       [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
       [testng] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
       [testng] at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
       [testng] at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
       [testng] at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:16)
       [testng] at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1006)
       [testng] at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:930)
       [testng] at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       [testng] at java.lang.reflect.Method.invoke(Method.java:585)
       [testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
       [testng] at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
       [testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
       [testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
       [testng] at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
       [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
       [testng] at org.testng.TestRunner.runWorkers(TestRunner.java:678)
       [testng] at org.testng.TestRunner.privateRun(TestRunner.java:624)
       [testng] at org.testng.TestRunner.run(TestRunner.java:495)
       [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
       [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
       [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
       [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:190)
       [testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
       [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
       [testng] at org.testng.TestNG.run(TestNG.java:699)
       [testng] at org.testng.TestNG.privateMain(TestNG.java:824)
       [testng] at org.testng.TestNG.main(TestNG.java:802)
       [testng] Caused by: java.net.MalformedURLException
       [testng] at java.net.URL.<init>(URL.java:601)
       [testng] at java.net.URL.<init>(URL.java:464)
       [testng] at java.net.URL.<init>(URL.java:413)
       [testng] at org.jboss.deployment.JBossEjbParsingDeployer.getStandardMetaData(JBossEjbParsingDeployer.java:170)
       [testng] ... 42 more


      This is caused by getStandardMetaData assuming that the SERVER_CONFIG_URL system property is set (Embedded doesn't set this). I have worked around this in Embedded bootstrap by setting the property (and adding standardjboss.xml to the bootstrap/conf directory), but I don't know if this is the correct solution.

      2) Having done this, I find that no EJBs from WEB-INF/lib/jboss-seam.jar are being deployed so transaction synchronization fails. This may of course be due to my fix to (1).

        • 1. Re: Embedded - EJB deployment problems
          Pete Muir Master

          (2) is caused by not having an ejb-jar.xml (or I guess jboss.xml) in jboss-seam.jar. I'm not sure if this is intentional, but it is certainly a change from AS 4.2 and other EE servers like Glassfish and OC4J. I will post this in the EJB3 forum.

          • 2. Re: Embedded - EJB deployment problems
            Scott Stark Master

             

            "pete.muir@jboss.org" wrote:

            This is caused by getStandardMetaData assuming that the SERVER_CONFIG_URL system property is set (Embedded doesn't set this). I have worked around this in Embedded bootstrap by setting the property (and adding standardjboss.xml to the bootstrap/conf directory), but I don't know if this is the correct solution.

            The standardjboss.xml should be a property on the JBossEjbParsingDeployer. I have added a standardJBossXmlPath for the standardjboss.xml URL, along with an ignoreMissingStandardJBossXml that can be set to false to allow for use of the JBossEjbParsingDeployer without a standardjboss.xml. A pure ejb3 setup would not need it.

            "pete.muir@jboss.org" wrote:

            2) Having done this, I find that no EJBs from WEB-INF/lib/jboss-seam.jar are being deployed so transaction synchronization fails. This may of course be due to my fix to (1).

            It would not be due to changes for 1. Most like due to an interaction with the new AnnotationMetaDataDeployer and the Ejb3Deployer. I don't think its processing war libs for ejb deployments.



            • 3. Re: Embedded - EJB deployment problems
              Scott Stark Master

               

              "scott.stark@jboss.org" wrote:
              ... along with an ignoreMissingStandardJBossXml that can be set to false to allow for use of the JBossEjbParsingDeployer without a standardjboss.xml.

              Correction, ignoreMissingStandardJBossXml would need to be set to true to allow for a setup without a standardjboss.xml.


              • 4. Re: Embedded - EJB deployment problems
                Pete Muir Master

                 

                "scott.stark@jboss.org" wrote:
                The standardjboss.xml should be a property on the JBossEjbParsingDeployer. I have added a standardJBossXmlPath for the standardjboss.xml URL, along with an ignoreMissingStandardJBossXml that can be set to false to allow for use of the JBossEjbParsingDeployer without a standardjboss.xml. A pure ejb3 setup would not need it


                Ok, but I still get the exception. It originates on line 199

                URL configUrl = new URL(configPath);


                and caught and rethrown

                catch (Exception ex)
                 {
                 DeploymentException.rethrowAsDeploymentException(ex.getMessage(), ex);
                 }


                This is without my alteration to embedded bootstrap to set the SERVER_CONFIG_URL and with this xml

                <bean name="JBossEjb2ParsingDeployer" class="org.jboss.deployment.JBossEjbParsingDeployer">
                 <property name="type">ejb2x</property>
                 <property name="relativeOrder">3001</property>
                 <property name="useSchemaValidation">false</property>
                 <property name="ignoreMissingStandardJBossXml">true</property>
                 </bean>


                • 5. Re: Embedded - EJB deployment problems
                  Pete Muir Master

                  Even if I just hack the method not to throw any exception if it can't find standardjboss.xml I get this

                  [testng] ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Parse: name=vfsfile:/Users/pmuir/workspace/jboss-seam/examples/booking/test-build/ state=Not Installed mode=Manual requiredState=Parse
                   [testng] org.jboss.deployers.spi.DeploymentException: Error during deploy: vfsfile:/Users/pmuir/workspace/jboss-seam/examples/booking/test-build/
                   [testng] at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                   [testng] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:175)
                   [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
                   [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
                   [testng] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
                   [testng] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
                   [testng] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
                   [testng] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
                   [testng] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
                   [testng] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
                   [testng] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
                   [testng] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
                   [testng] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
                   [testng] at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
                   [testng] at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
                   [testng] at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:16)
                   [testng] at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1006)
                   [testng] at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:930)
                   [testng] at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
                   [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   [testng] at java.lang.reflect.Method.invoke(Method.java:585)
                   [testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
                   [testng] at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
                   [testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
                   [testng] at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
                   [testng] at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
                   [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
                   [testng] at org.testng.TestRunner.runWorkers(TestRunner.java:678)
                   [testng] at org.testng.TestRunner.privateRun(TestRunner.java:624)
                   [testng] at org.testng.TestRunner.run(TestRunner.java:495)
                   [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
                   [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
                   [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
                   [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:190)
                   [testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
                   [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
                   [testng] at org.testng.TestNG.run(TestNG.java:699)
                   [testng] at org.testng.TestNG.privateMain(TestNG.java:824)
                   [testng] at org.testng.TestNG.main(TestNG.java:802)
                   [testng] Caused by: java.lang.IllegalArgumentException: Null attachment
                   [testng] at org.jboss.deployers.plugins.attachments.AttachmentsImpl.addAttachment(AttachmentsImpl.java:72)
                   [testng] at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.addAttachment(AbstractDeploymentUnit.java:294)
                   [testng] at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:115)
                   [testng] at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:162)
                   [testng] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
                  


                  • 7. Re: Embedded - EJB deployment problems
                    Pete Muir Master

                    Thanks Scott, that did it :)

                    • 8. Re: Embedded - EJB deployment problems
                      Pete Muir Master

                       

                      "scott.stark@jboss.org" wrote:
                      "pete.muir@jboss.org" wrote:

                      2) Having done this, I find that no EJBs from WEB-INF/lib/jboss-seam.jar are being deployed so transaction synchronization fails. This may of course be due to my fix to (1).

                      It would not be due to changes for 1. Most like due to an interaction with the new AnnotationMetaDataDeployer and the Ejb3Deployer. I don't think its processing war libs for ejb deployments.


                      My apologies, I was getting confused between the test structure and the deployed structure. The correct layout is:

                      jboss-seam.jar has no META-INF/ejb-jar.xml or jboss.xml but does have EJBs in it (in an app deployed to AS we make it an ejb module in application.xml). It is placed on the classpath which is used to boot embedded jboss however its EJBs aren't being picked up. This works in AS 4.2.

                      • 9. Re: Embedded - EJB deployment problems
                        Scott Stark Master

                         

                        "pete.muir@jboss.org" wrote:

                        My apologies, I was getting confused between the test structure and the deployed structure. The correct layout is:

                        jboss-seam.jar has no META-INF/ejb-jar.xml or jboss.xml but does have EJBs in it (in an app deployed to AS we make it an ejb module in application.xml). It is placed on the classpath which is used to boot embedded jboss however its EJBs aren't being picked up. This works in AS 4.2.

                        The AnnotationMetaDataDeployer is not scanning a deployment unless it has a descriptor generated metadata attachment by default. For a pure annotation based deployment you need to set the metaDataCompleteIsDefault property to false in the metadata-beans.xml descriptor:

                         <bean name="AnnotationMetaDataDeployer"
                         class="org.jboss.deployment.AnnotationMetaDataDeployer">
                         <property name="metaDataCompleteIsDefault">false</property>
                         </bean>
                        


                        The deployer will then scan any deployments that have no descriptors.