1 2 Previous Next 15 Replies Latest reply on Oct 27, 2010 12:55 PM by maxandersen

    Publish to server places EJB jar outside of EAR

    john_deviney

      I have 4 projects configured:

       

        * java jar

        * ejb jar  (EE module dependencies include the java module)

        * jsf war  (EE module dependencies include ejb and java modules)

        * ear module  (EE module dependencies include the other 3 modules)

       

      Each of the modules were created using their respective wizards in JBDS. 

       

      If I export the ear module as an ear file from project explorer to my local server deploy directory everything works fine.  The ear deploys and runs as expected.

       

      If I use the publish to server feature the tool always deploys the ear and ejb files separately and the application fails to deploy because of classloader issues.  The ear module does not contain the ejb module like I would expect.

       

      Am I not using the tool correctly or could this be a bug in JBDS?

       

      My environment:

       

      JBDS Version: 3.0.1.GA

      Build id: v201006010437R

      Build date: 201006010449

      Java 6

      Mac OS X 10.6.4

        • 1. Re: Publish to server places EJB jar outside of EAR
          john_deviney

          It looks like I am unable to launch and debug jboss applications from within JBDS at all due to the above issue.  Every path to launch and debug a server application attempts to deploy the invalid bundles mentioned in my first post.

           

          Looks like I will have to revert to launching jboss from the command line in debug mode and attaching to the jvm from the tool.  This is unfortunate because that is one more nice feature in JBDS I can't use.

           

          If anyone can offer guidance on my question I would appreciate it.

          • 2. Re: Publish to server places EJB jar outside of EAR
            john_deviney

            Problem solved but I think there is a bug in the EE tools.

             

            I created a new ejb project within the context of the ee project and it now publishes as part of the EAR instead of adjacent to it.

             

            When I started I created a jar, ejb and web project.  Then I created a ee project and added the other 3 as EE modules.

             

            For server publishing to work in this scenario it seems I have to create ejb modules from within the context of the ee module.  This was not a problem for the web project, only for the ejb project.

             

            I will submit as a JIRA bug.

            1 of 1 people found this helpful
            • 3. Re: Publish to server places EJB jar outside of EAR
              maxandersen

              yes, please - need some more steps to know how to reproduce it.

              • 4. Re: Publish to server places EJB jar outside of EAR
                john_deviney

                Max,

                 

                I tried to reproduce the problem from memory but was not able to.

                 

                1) Start in the Java perspective
                2) Create a Java project
                   2.0) Use default project contents is Checked
                   2.1) Create a dummy class
                3) Create an Ejb project
                   3.0) Use default project contents is Checked
                   3.1) Add new target server runtime
                   3.2) Target Jboss EAP 5.0
                   3.3) Set Jboss home to the JBDS bundled EAP 5.0
                   3.4) Set JRE to Java 1.6
                   3.5) Set configuration directory to my own configuration (copy of standard)
                   3.6) I do not select Create and EJB Client Jar
                   3.7) I do select Generate ejb-jar.xml deployment descriptor
                   3.8) JBDS prompts me to open the Java EE perspective, I click on Yes
                   3.9) Create a dummy EJB 3 stateless session bean with local interface only and container managed transactions
                      3.9.1) I do not select any EJB 2.x options
                4) Create a Jboss Tools Web/JSF project
                   4.0) Use default project contents is Checked
                   4.1) JSF environment is JSF 1.2 with Facelets
                   4.2) Template is FaceletsKickStartWithoutLibs
                   4.3) Servlet version is 2.5
                   4.4) I set target runtime to the target runtime I created in step 3
                   4.5) Target Server jboss-eap is checked
                   4.6) JBDS prompts me to open the Web Development perspective, I click Yes
                5) Create a Java EE Enterprise Application Project
                   5.0) Use default project contents is Checked
                   5.1) I set target runtime to the target runtime I created in step 3
                   5.2) EAR version is 5.0
                   5.3) Configuration is Default Configuration for my target runtime
                   5.4) Java EE module dependencies: I select all of the components created above
                   5.5) I check Generate application.xml deployment descriptor
                   5.6) Content directory defaults to EarContent
                   5.7) JBDS prompts me to open the Java EE perspective, I click on Yes
                6) Open the Servers view
                   6.1) Add the EE module to the server
                   6.2) This is where the Ejb module would appear adjacent to the EE module instead of nested below.
                        In this scenario I could not reproduce the problem; the Ejb module is nested under the EE module.

                1) Start in the Java perspective

                2) Create a Java project

                   2.0) Use default project contents is Checked

                   2.1) Create a dummy class

                3) Create an Ejb project

                   3.0) Use default project contents is Checked

                   3.1) Add new target server runtime

                   3.2) Target Jboss EAP 5.0

                   3.3) Set Jboss home to the JBDS bundled EAP 5.0

                   3.4) Set JRE to Java 1.6

                   3.5) Set configuration directory to my own configuration (copy of standard)

                   3.6) I do not select Create and EJB Client Jar

                   3.7) I do select Generate ejb-jar.xml deployment descriptor

                   3.8) JBDS prompts me to open the Java EE perspective, I click on Yes

                   3.9) Create a dummy EJB 3 stateless session bean with local interface only and container managed transactions

                      3.9.1) I do not select any EJB 2.x options

                4) Create a Jboss Tools Web/JSF project

                   4.0) Use default project contents is Checked

                   4.1) JSF environment is JSF 1.2 with Facelets

                   4.2) Template is FaceletsKickStartWithoutLibs

                   4.3) Servlet version is 2.5

                   4.4) I set target runtime to the target runtime I created in step 3

                   4.5) Target Server jboss-eap is checked

                   4.6) JBDS prompts me to open the Web Development perspective, I click Yes

                5) Create a Java EE Enterprise Application Project

                   5.0) Use default project contents is Checked

                   5.1) I set target runtime to the target runtime I created in step 3

                   5.2) EAR version is 5.0

                   5.3) Configuration is Default Configuration for my target runtime

                   5.4) Java EE module dependencies: I select all of the components created above

                   5.5) I check Generate application.xml deployment descriptor

                   5.6) Content directory defaults to EarContent

                   5.7) JBDS prompts me to open the Java EE perspective, I click on Yes

                6) Open the Servers view

                   6.1) Add the EE module to the server

                   6.2) This is where the Ejb module would appear adjacent to the EE module instead of nested below.

                        In this scenario I could not reproduce the problem; the Ejb module is nested under the EE module.

                 

                If I see it again I will post it.

                 

                Thanks.

                • 5. Re: Publish to server places EJB jar outside of EAR
                  john_deviney

                  This problem keeps coming back.  I've tried starting fresh with a new workspace and creating all new modules.  There are too many steps in the process for me to continue to identify a scenario that can be reproduced.  I simply don't have the time available.

                   

                  What I am trying to do in the tool is pretty straight forward: create an EAR that contains a JAR, EJB and JSF Web component.

                   

                  Surely someone else has run into the same problem.  If I continue to use JBDS I will have to run Jboss outside of the tool and attach remotely.

                  • 6. Re: Publish to server places EJB jar outside of EAR
                    maxandersen

                    Hi John,

                     

                    Sorry that you are having problems but creating an EAR that contains JAR, EJB and Web component is what our Seam wizard does all the time.

                     

                    Does that one fail for you too ?

                     

                    Could you not simply use that wizard and remove any parts you don't need/want ?

                     

                    Trying to find the fastests way to get you going...

                    • 7. Re: Publish to server places EJB jar outside of EAR
                      john_deviney

                      I really don't want to go down the path of building a Seam application and trying to remove all the stuff I won't use.  I'm not building a Seam application.  I'm building a classic layered web application using JSF => EJB3 => NaviteHibernate/POJO => MySQL.

                       

                      Another limitation with this issue is I can't find a way to export or deploy the EAR exploded.  I can only export as a compressed EAR.  Not ideal for doing JSF.  I tried the Project Archives view to export an exploded EAR but it's behaving the same way as the Server Publish feature; it doesn't see that there is an EJB declared in the application.xml for the EAR.

                      • 8. Re: Publish to server places EJB jar outside of EAR
                        maxandersen

                        JSF->EJB->Hibernate/Pojo => DB is exactly what the Seam project creates (plus of course it adds seam jars and config into it which is really minimal).

                         

                        Just a suggestion since I know that works and whatever I do to setup the project layout you give me manually it also works.

                         

                        About export exploded - if you use *our* JBoss AS deployer then it will be by default exploded - looks to me you are not using that ?

                         

                        May I suggest if you dont find a solution that you open a jira with the minimal example project + info of what version of jboss tools/eclipse you are using ? Then we can see what might be missing/causing it.

                        • 9. Re: Publish to server places EJB jar outside of EAR
                          john_deviney

                          Max,

                           

                          I tried deploying using both JBoss AS deployer and Project Archives.  They both behave the same way.  I will try the Seam project approach and see what happens.

                           

                          I will open a jira but probably not until the weekend.

                          • 10. Re: Publish to server places EJB jar outside of EAR
                            maxandersen

                            Thanks!

                            • 11. Re: Publish to server places EJB jar outside of EAR
                              john_deviney

                              Max,

                               

                              I looked at the seam perspective.  In the ejb component it defaults to jpa configuration.  Is it possible to delete this and insert a hibernate.har tree using native hibernate configuration?

                               

                              I see the seam root project contains the richfaces jars.  Why doesn't a JSF facelets project contain the same jars?  They are in the palette but not in the web app lib path.  I had to add them manually.

                               

                              Seems like there is more emphasis on the seam tools than the others.  I would hope that the JBDS could support any development scenario consistent with the javaee specification.

                               

                              Based on what I have seen so far I will pass on trying to use the seam tools.

                              • 12. Re: Publish to server places EJB jar outside of EAR
                                akazakov
                                I see the seam root project contains the richfaces jars.  Why doesn't a JSF facelets project contain the same jars?  They are in the palette but not in the web app lib path.  I had to add them manually.

                                What do you mean by "a JSF facelets project"? A project created via New JSF Project wizard? That wizard creates a basic JSF project. You can add Richfaces libs there via Right-Click-on-the-project->Configure->Add Custom Capabilities.

                                • 13. Re: Publish to server places EJB jar outside of EAR
                                  maxandersen

                                  John Deviney wrote:

                                   

                                  Max,

                                   

                                  I looked at the seam perspective.  In the ejb component it defaults to jpa configuration.  Is it possible to delete this and insert a hibernate.har tree using native hibernate configuration?

                                  You can do whatever you want

                                  But why use the (IMO horrible) .har when JPA provides the same ? (i.e. Hibernate entitymanager also scans for hbm.xml's automatically)

                                   

                                  I see the seam root project contains the richfaces jars.  Why doesn't a JSF facelets project contain the same jars?  They are in the palette but not in the web app lib path.  I had to add them manually.

                                   

                                  eh - Richfaces != Basic JSF. See Alexey's comment on this.

                                   

                                  Seems like there is more emphasis on the seam tools than the others.  I would hope that the JBDS could support any development scenario consistent with the javaee specification.

                                   

                                  eeh - you just showed me that we actually oblige to the javaee specification by using JPA instead of native hibernate + we did not force external 3rd party libraries on you for a basic JSF app ?

                                   

                                  Based on what I have seen so far I will pass on trying to use the seam tools.

                                  I'm confused why - since it uses more of JavaEE spec than all the other setups.

                                   

                                  In any case, I just suggested it since this wizard creates the "full set of projects" you were asking for and was the simplest way for me to show you that it actually does work.

                                   

                                  If you don't like the config it creates then remove those parts and you are left with a plain vanilla JSF app.

                                  • 14. Re: Publish to server places EJB jar outside of EAR
                                    john_deviney

                                    I didn't intend to spark a philosophical debate.  Yes, native hibernate is not javaee but that is what I want to use.  That is simply a personal preference and Jboss does continue to support native hibernate.

                                     

                                    I'm not bashing the tool.  I'm just trying to determine the best way to use the tool given my own requirements and personal preferences.  I do still believe there is a bug in JBDS regarding deployment of EE modules and I will follow up on this when I have time.  By the way, this issue is independent of how I use hibernate or whether or not I choose to use seam. 

                                     

                                    Thanks for the suggestion to use a seam project as a workaround.

                                    1 2 Previous Next