6 Replies Latest reply on Mar 26, 2012 6:54 AM by Roman Boris

    ejb-jar.xml for ejb3.1

    Roman Boris Newbie

      Hello!

      I'm using arquillian version 1.0.0.CR7 and have a next problem:

       

      for using EJB3.1 create deployment with ejb-jar.xml in jar like next:

      .addAsManifestResource("META-INF/ejb-jar.xml", ArchivePaths.create("ejb-jar.xml"))

       

      if don't have real ejb-jar.xml file arqullian generates it but! for ejb version 2.1.

      Question: how to force arqullian to use ejb v 3.1?

       

      Tried to use specific protocol

      @OverProtocol("EJB 3.1")

       

      but got exception: "DeploymentScenario contains protocols not maching any defined Protocol in the registry. EJB 3.1"

       

      With ejb-jar.xml for v3.1 I've failed to deploy

       

      Thanks for help

        • 1. Re: ejb-jar.xml for ejb3.1
          Aslak Knutsen Master

          What do you mean Arquillian generates a 2.1 ejb-jar xml ?

          • 2. Re: ejb-jar.xml for ejb3.1
            Roman Boris Newbie

            for my jar I'm adding ejb-jar.xml next way:

             

            .addAsManifestResource("META-INF/ejb-jar.xml", ArchivePaths.create("ejb-jar.xml"))

             

            but there is no real ejb-jar.xml file in META-INF of my project

            After deployment (it was successful) in _DEFAULT___DEFAULT__AppTest.ear in my jar's META-INF folder I have ejb-jar.xml:

             

            <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">

              <display-name>MEJB JAR</display-name>

              <enterprise-beans>

                <session>

                  <display-name>MEJBBean</display-name>

                  <ejb-name>MEJBBean</ejb-name>

                  <home>javax.management.j2ee.ManagementHome</home>

                  <remote>javax.management.j2ee.Management</remote>

                  <ejb-class>org.glassfish.admin.mejb.MEJBBean</ejb-class>

            ......

             

            </ejb-jar>

            • 3. Re: ejb-jar.xml for ejb3.1
              Roman Boris Newbie

              Added (attachment) test application to find out problem faster.

              Just

              mvn clean install

              and ejb-jar.xml in App-ejb.jar will appear

               

              My root problem: successfully deploy arquillian with ejb-jar.xml for EJB3.1 or to generate it on the fly. If I add blank ejb-jar.xml fro EJB3.1 (only <display-name>) - deploy is failed.

               

              p.s.: sorry if my explanations were not clear

              • 4. Re: ejb-jar.xml for ejb3.1
                Aslak Knutsen Master

                Aa, I see..

                 

                when you do addAsManifestResource("META-INF/ejb-jar.xml", ....) ShrinkWrap will look for a META-INF/ejb-jar.xml on ClassPath. You don't have one in your project, but org.glassfish.extras:glassfish-embedded-all has one, which is the one you see in your deployment.

                 

                For EJB 3.1 you don't need a ejb-jar.xml, so simply don't add it. If you do have a ejb-jar.xml for your ejb that you want to use, you should be able to workaround this by not adding it as a Classpath Resource, but as a File resource, or as a String (if you create it)

                 

                addAsManifestResource(new File("src/main/resources/my-ejb.jar.xml"), "ejb-jar.xml")

                or

                addAsManifestResource(new StringAsset("<xml .............>"), "ejb-jar.xml")

                1 of 1 people found this helpful
                • 5. Re: ejb-jar.xml for ejb3.1
                  Roman Boris Newbie

                  Thank for reply!

                  But my root problem is not fixed:

                  gets exception when I'm tring to deploy with next ejb-jar.xml file:

                   

                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
                           version="3.1">
                  
                      <display-name>TestApp-ejb</display-name>
                  
                  </ejb-jar>
                  

                   

                  exception:

                  SEVERE: Exception while loading the app : WELD-001408 Unsatisfied dependencies for type ...

                   

                  * Maybe problem is with alternative stateless beans? It is successfully deployed with "generated" (from glassfish-embedded-all.jar) ejb-jar.xml and failed to deploy with my ejb-jar for ejb3.1

                  * Without ejb-jar.xml I can't deploy either.

                  * Tried to deploy with ejb-jar for v3.1 with GlassFish AS: success

                   

                  Any ideas? Thanks for help!

                  • 6. Re: ejb-jar.xml for ejb3.1
                    Roman Boris Newbie

                    Nobody can help with this problem? Or maybe someone has working example for: cdi alternatives + ejb3.1 + arquillian.