11 Replies Latest reply on Sep 21, 2007 7:50 AM by ncmvshankar

    EJB 2.1 and EJB 3 in same jar

    huuskart

      I'm trying to deploy on JBoss 4.2.1.GA a jar (in ear) that contains EJB 2.1 and EJB 3 components.

      However, only the EJB 3 components are deployed. There are no errors or any other indication that JBoss even thinks that the jar contains any EJB 2.1 components.

      I have understood that EJB 3 + EJB 2.1 deployment from the same jar should work. However, is there some configuration knob that I need to turn on (in persistence.xml or ejb--jar.xml) in order for this to work. Or do I need to annotate even the EJB 2.1 modules with some annotation in order for them to be picked up?

        • 1. Re: EJB 2.1 and EJB 3 in same jar
          marcin.cinik

          Hi!

          We've got the same problem. How to deploy EJB 2.1 and EJB 3.0 (mixed mode) packed in the same jar on JBoss 4.2GA ?

          Marcin

          • 2. Re: EJB 2.1 and EJB 3 in same jar
            wolfc

            The EJB 3 deployer in AS 4.2 can only deploy EJB 2.1 session beans. 2.1 Entity BMP/CMP beans are not deployable.

            The only change necessary is setting a correct version in the deployment descriptor.

            If you still have deployment problems please post a stack trace.

            • 3. Re: EJB 2.1 and EJB 3 in same jar
              marcin.cinik


              I'm using annotations in my EJB3.0 beans without any deployment XML descriptor. I don't want any deployment descriptor for these beans. Deployment descriptor contains only informations about EJB2.1 beans. Should I also put informations about EJB3.0 beans in the deployment descriptor ?

              The real problem is that XDoclet does not understand JAVA5 grammar and it cannot generate deployment descriptor for EJB3.0 beans which use JAVA5-specific features like annotations, generecis, enums.

              Marcin

              • 4. Re: EJB 2.1 and EJB 3 in same jar
                wolfc

                 

                "Marcin.Cinik" wrote:
                I'm using annotations in my EJB3.0 beans without any deployment XML descriptor. I don't want any deployment descriptor for these beans. Deployment descriptor contains only informations about EJB2.1 beans. Should I also put informations about EJB3.0 beans in the deployment descriptor ?

                No, that should work fine. Just make sure that the version and namespace in the existing deployment descriptor is set correctly.

                Post your descriptor if it still fails.

                • 5. Re: EJB 2.1 and EJB 3 in same jar
                  marcin.cinik

                  Descriptor file: (it contains declarations for EJB2.1 session beans only - EJB3 beans use annotations for the whole appserver staff).

                  <?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/j2ee/ejb-jar_3_0.xsd" version="3.0">
                  
                   <description><![CDATA[No Description.]]></description>
                   <display-name>Generated by XDoclet</display-name>
                  
                   <enterprise-beans>
                  
                   <!-- Session Beans -->
                   <session >
                  [...]
                  
                  


                  Here is what JBoss 4.2GA says:
                  2007-09-20 15:30:50,257 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=xxx.jar
                  org.jboss.xb.binding.JBossXBException: Failed to parse source: NYI
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:178)
                   at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:169)
                   at org.jboss.ejb3.metamodel.EjbJarDDObjectFactory.parse(EjbJarDDObjectFactory.java:82)
                   at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:44)
                   at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:83)
                   at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:365)
                   at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:321)
                   at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
                   at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
                  
                  [...]
                  Caused by: java.lang.RuntimeException: NYI
                   at org.jboss.ejb3.metamodel.EjbJarDDObjectFactory.setValue(EjbJarDDObjectFactory.java:1306)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.xb.binding.ObjectModelBuilder.invokeFactory(ObjectModelBuilder.java:417)
                   at org.jboss.xb.binding.DelegatingObjectModelFactory.setValue(DelegatingObjectModelFactory.java:154)
                   at org.jboss.xb.binding.ObjectModelBuilder.endElement(ObjectModelBuilder.java:358)
                   at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.endElement(SaxJBossXBParser.java:295)
                   at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
                  
                  
                  


                  • 6. Re: EJB 2.1 and EJB 3 in same jar
                    wolfc

                    This one falls under the category: Doh! :-)

                    Security-role-ref don't work in 4.2.0, it's been fixed in AS 4.2.1.

                    http://jira.jboss.com/jira/browse/EJBTHREE-997

                    • 7. Re: EJB 2.1 and EJB 3 in same jar
                      marcin.cinik

                      Thanks for the reply and investigation. It is hard for us to upgrade now to JBoss 4.2.1, but maybe there is workaround to this. Could we just replace a class file in any jar ? or maybe whole jar file. Or maybe there exists any patch to solve this problem ?

                      We use security-role-ref a lot and cannot resign from this.

                      Marcin

                      • 8. Re: EJB 2.1 and EJB 3 in same jar
                        wolfc

                        The fix has been ported to JBoss Enterprise Application Platform 4.2.0.GA_CP01. You can get it via JBoss Operation Network.

                        • 9. Re: EJB 2.1 and EJB 3 in same jar
                          huuskart

                           

                          The EJB 3 deployer in AS 4.2 can only deploy EJB 2.1 session beans. 2.1 Entity BMP/CMP beans are not deployable.


                          OK, this explains the problem. I had no EJB 2.1 sessions, only entities in the module.

                          Is there somewhere documentation about AS 4.2 EJB 3 capabilities. I tried to look, but did not find anything comprehensive in any obvious place (which would be the Documentation link for AS project -- there does not appear to be any documentation for 4.2). JBoss EJB3 project has the reference document, but that's not very helpful either, as far as I can see.

                          Is there going to be any change to this in AS 4.2 series? What about AS version 5?

                          • 10. Re: EJB 2.1 and EJB 3 in same jar
                            ncmvshankar

                            Is it possible to deploy the jar file containing ejb2.1 and ejb3.0 in JBoss AS 4.0.5GA? Please reply.

                            • 11. Re: EJB 2.1 and EJB 3 in same jar
                              ncmvshankar

                              Is it possible to deploy a jar containing ejb2.1 and ejb3.0 in jboss AS 4.0.5GA? please reply