facebook

[Closed] Packaging WebProject Source in EJB JAR File

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #240782 Reply

    hurffwebb
    Member

    I have an application consisting of:

    1) EAR Project
    2) Web Project
    3) EJB Project

    My EJB classes need to have access to the classes I have in my Web project. I see the option in the EJB Build properties to merge classes from Referenced “Java Projects”, but how can I merge my class files from my Web Project into my EJB JAR file?

    Better yet, how can I jar the classes in my Web project and put them in the root level of my EAR to be accessed by all components of my EAR?

    I notice both options I need are available for Java Projects only, but why not Web Project source? Can someone please clarify?

    Thanks in advance.

    #240819 Reply

    Riyad Kalla
    Member

    dwebb,
    You are correct, common code should belong in a top level Java Project that can be marked as a depdendency of all the projects that need it.

    As to your 2nd question, check Section 9 here: http://myeclipseide.com/enterpriseworkbench/help/index.jsp?topic=/com.genuitec.myeclipse.doc/html/quickstarts/earprojects/index.html

    #240823 Reply

    hurffwebb
    Member

    OK, I am in agreement with you on how the classes should be structured, stored in different projects, and packaged together. If I take that path, which I would like to take, here is my delimma:

    For each logical Use Case I have the following package structure:

    /usecase/action - Contains Struts Actions
    /usecase/dao - Data Access
    /usecase/manager - Connection/Business Logic Management
    /usecase/form - Struts Action Forms
    /usecase/model - Value Objects

    I tried to keep my struts specific packages in the Web project, and move the others to a common Java Project. While this seems ideal, the problem that I run into is that the classes in /model reference classes in /form and vice versa. If I tell Eclipse that the Web project references the Common Java Project and that the Common Java Project references the Web project, I get a cyclical build error message.

    I understand the cyclical reference, but I dont understand how else I can split classes out into 2 separate projects that reference each other. Any Suggestions? Thanks for you help!!!

    #240837 Reply

    Riyad Kalla
    Member

    Hmm, honestly I would be tempted to tell you not to move the /model classes out of the web project. Typically value objects are used in the web tier to represent and transfer data between the database and the web portion of your app and visa versa… because of this I think it’s fine if you kept those items in your web… but, if you are using them in your EJB project as well, I can understand why this would get tricky and/or feel strange to do.

    Is your EJB project using the value objects?

    #240843 Reply

    hurffwebb
    Member

    My Web and EJB Project use classes from /model and /manager.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: [Closed] Packaging WebProject Source in EJB JAR File

You must be logged in to post in the forum log in