2 Replies Latest reply on Dec 16, 2009 9:19 AM by oliverroell

    How to create a project including EJBs and Servlets/JSPs?

    oliverroell

      Hi,

       

      how can I create a JBoss-project in Eclipse with the JBoss Tools 3.0.1 for servlets and EJBs?

       

      After creating a "Dynamic Web Project" there is no possibility to choose an "EJB Module" in the "Project Facets".

       

      After creating an EJB-project there is no possibility to choose a "Dynamic Web Module" in the "Project Facets".

       

      Is it possible with the JBoss Tools 3.0.1 to create a project that includes an "EJB Module" and a "Dynamic Web Module" in the "Project Facets"?

       

      With the JBoss IDE 1.6 this was never a problem. I have created a "J2EE 1.4 Project" including support for servlets and EJBs. But there must be a counterpart within the JBoss Tools 3.0.1 for creating JEE 5-projects that inlude support for servlets and EJBs. Can anybody help me, please?

       

      Kind regards

      Oliver

       

        • 1. Re: How to create a project including EJBs and Servlets/JSPs?
          maxandersen

          JEE 5 (and previous versions of J2EE) projects does not allow mixing ejb and servlets in the same project, that is changing in JEE 6 though.

           

          That means that base WTP eclipse does not have support for mixing these two things, BUT neither had JBossIDE 1.5 or 1.6 - you were simply not using the WTP parts at that time.

           

          But note, nothing prevents you from adding java code that are EJB's - that is what was available in JBossIDE before and is still completely ok in JBoss Tools.

           

          J2EE 1.4 Project (if that is the JBoss Tools thing you refer to, was as far as I recall purely a Java project with classpath containers ?).

          I don't believe that offered more than a Dynamic Web Project did.

           

          Anyway create an EAR project and you will have a project that supports both ear, ejb etc. the source will just be stored in different directories.

          1 of 1 people found this helpful
          • 2. Re: How to create a project including EJBs and Servlets/JSPs?
            oliverroell

            Hello Max,

             

            thank you for the quick answer.

             

            I am struggling a little with creating the project-structure and the packaging.

            For the JBossIDE there was a very good tutorial "An introduction and walkthrough of JBossIDE 1.4". These examples describe step by step how to build an J2EE-application containing Servlets & EJBs. After this walkthrough the reader knows enough to create and build own projects. I miss such a tutorial for the current JBoss Tools 3.

             

            Yes, there is a "Getting Started with JBoss Developer Studio April 2008" tutorial, but it's not as comprehensive as the JBossIDE-tutorial, and I miss the EJB-part.

            And yes, there is the Anghel Leonard-book "JBoss Tools 3" that I have bought. The examples are good, but I still miss the EJB-part.

             

            I believe it's not difficult to create and package EAR-files including Servlets & EJBs with Eclipse and the JBoss Tools, but you must know the doing. Is there really no tutorial or introduction which can guide me?

             

            I think there are two possibilities:

             

            1. All in one

             

            Create a Dynamic Web Project and extend it with some session-beans, so that I have Servlets & EJBs in one project. After that, use the "project archives" to create a WAR, an EJB-JAR and an EAR.

             

            2. Three separate projects

             

            a) File / New / Other / Web / Dynamic Web Project

            Only for the WAR.

             

            b) File / New / Other / EJB /  EJB Project

            Only for the EJB-JAR.

             

            c) File / New / Other / Java EE / Enterprise Application Project

            Only for the EAR containing the WAR from a) and the EJB-JAR from b).

             

            What is the better approach? Or is there another way?

             

            Kind regards

            Oliver