6 Replies Latest reply on Dec 30, 2005 9:29 PM by Emmanuel Bernard

    EJB3: Is it possible to use both annotations AND descriptors

    Bobby Kennedy Newbie

      Hello all,

      Is it possible to use both annotations AND delpoyment descriptors to describe an EJB3? I am looking at MDBs in particular.

      There are plenty of examples of beans that solely use annotations to describe themselves (http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/mdb/index.html).

      There are also examples of EJB3 beans that solely use deployment descriptors (http://docs.jboss.org/ejb3/app-server/tutorial/mdb_deployment_descriptor/mdb.html)

      But I have yet to see an example of a bean that uses both. For example, an MDB that use annotations to specify its destination, but uses a deployment descriptor to specify its user and password. Is this possible? If so, how would this be packaged? In a .ejb3 with an ejb-jar.xml and a jboss.xml?

      Any help would be greatly appreciated, thanks.



        • 1. Re: EJB3: Is it possible to use both annotations AND descrip
          Kabir Khan Master

           

          "bwkennedy" wrote:

          Hello all,

          Is it possible to use both annotations AND delpoyment descriptors to describe an EJB3? I am looking at MDBs in particular.


          Yes, this is possible

          "bwkennedy" wrote:


          But I have yet to see an example of a bean that uses both. For example, an MDB that use annotations to specify its destination, but uses a deployment descriptor to specify its user and password. Is this possible?



          Take a look at the testsuite in cvs. if you check out jboss-head, you can find some examples in under jboss-head/ejb3/src/test/dd. Descriptors are in jboss-head/ejb3/src/resources/test/dd.

          ejb-jar.xml for ejb 3 is similar to ejb 2, but more or less everything is optional. Typically, if you specify something in annotations and something else in xml you will get these combined. If you specify something in both xml and annotations, the xml values will override the annoted ones.

          "bwkennedy" wrote:

          If so, how would this be packaged? In a .ejb3 with an ejb-jar.xml and a jboss.xml?


          yes, .ejb3 with META-INF/ejb-jar.xml and META-INF/jboss.xml



          • 2. Re: EJB3: Is it possible to use both annotations AND descrip
            William DeCoste Apprentice

            Yes, you can use either annotations and deployment descriptors to describe EJB3s or some combination of each. The values in the ejb-jar.xml and jboss.xml deployment descriptors augment and/or override the annotations. The deployment descriptors can be "sparse" as compared to 2.1 deployment descriptors. There is a chapter on these sparse deployment descriptors in the EJB3 docbook in docs/reference. There are also several examples in the ejb3 testsuite, which is available in the full CVS source download.

            • 3. Re: EJB3: Is it possible to use both annotations AND descrip
              Kabir Khan Master

              This was a bug. I have fixed this and it will be in the next release

              • 4. Re: EJB3: Is it possible to use both annotations AND descrip
                joselitol Newbie

                Hi people,

                I´m really sad about the support the is made by the JBoss team.
                They don´t care about the bugs that we report to them, they just say:
                "Yeah, this works fine, look at the examples!"
                or
                "Hey did you look the documentation?"
                These are stupid questions!!! If we are asking how to do it, it's because we have already looked at documentation and the examples.
                In fact the JBoss team want to makes a lot of money on selling information and support about JBoss
                By the way,
                Did anyone try the example from chap8 about "Using SSL with JBoss using JSSE" . I made everything correct but it doesn´t work!!!!
                The JBoss 4.03.RC2 EJB3.0 doesn´t support annotations and deployment descriptors together...The JBoss simply ignores the jboss.xml !!!!
                And the JBoss team says the it works!!!
                I´m getting crazy with JBoss 4.0.3 !!!!
                I just want to make an EJB works with ssl using a swing base application client!!!!
                Someone please help me:
                joselitol@hotmail.com







                • 5. Re: EJB3: Is it possible to use both annotations AND descrip
                  Bill Burke Master

                  On SSL:

                  We haven't documented it yet. If you need an example, checkout from CVS, go to the ejb3/ module. src/test/org/jboss/ejb3/test/ssl and ssladvanced give examples.

                  The chapter 8 documentation you refer to is about our old EJB 2.1 container.

                  We do not ignore deplyment descriptors. What is probably happening is that EJB 3.0 does not support all the jboss.xml switches that are available in 2.1.

                  ALso, I seriously considered ignoring this post with your insulting "JBoss team want to makes a lot of money..." BS. Have you ever looked at jira.jboss.com? Also, quotes like "blah blah blah doesn't work" just don't help us debug your problem. This is a beta product. It is going to be missing features and it is going to have bugs. Not only do we have to deal with that, but we also have to deal with a moving EJB3 specification.

                  • 6. Re: EJB3: Is it possible to use both annotations AND descrip
                    Emmanuel Bernard Master

                    joselitol

                    In fact the JBoss team want to makes a lot of money on selling information and support about JBoss

                    I really love reading such sentences after spending 4 fucking hours catching up my late on this forum helping people and fixing a couple of bugs. Now it's 3:30AM and you just pissed me off.