facebook

Shared code [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #198972 Reply

    Erez
    Member

    I have a J2EE application constisting of both EJB & WEB projects. How do I set each of the project so they could use shared utilities? In other words, what is the directory structure of such an application.

    Thanks in advance,
    Erez

    #198979 Reply

    Scott Anderson
    Participant

    Erez,

    To use shared utilities you should place the utility jar files in the top level of your EAR project and then reference them appropriately in each web/ear project’s MANIFEST Class-Path. The MyEclipse deployer will pick up the libraries and deploy them properly and the MANIFEST Class-Path entries will tell the projects where to find them.

    In order for the utilities to be found during compile time, you’ll also need to add them to the build path of your web and ejb projects through the standard Eclipse build path properties.

    Making this process simpler is an open enhancement request as referenced here:
    https://www.genuitec.com/forums/topic/adding-libs-to-class-path-in-manifest-mf-enhancement/&highlight=manifest

    –Scott
    MyEclipse Support

    #199005 Reply

    Erez
    Member

    In my existing project under JBuilder I simply have a source directory under which I have all my packages:

    – src
    services (Session EJBs)
    domain (Entity EJBs)
    util (utility classes shared among all the project)
    common (classes shared by all)
    web (WEB module)

    This is the first level of my source directory, and of course I am using all sorts of third party jars from Struts etc. What is the recommended tree structure using MyEclipse to achieve this? And more specifically where do I put the packages of util and common ? Should they be in a third project ?

    TIA,
    Erez

    #199015 Reply

    support-michael
    Keymaster

    As Scott indicated you need to work with an Enterprise application in order to deploy you EJB and Web projects as a single application unit, i.e., an EAR. So you will need to separate your JBuilder project into 3 J2EE projects, an Enterprise project, an EJB Project, and a Web Project. The reason for not allowing EJBs and Web elements in a super project has to do with MyEclipse simulating the classpath structure of a J2EE project at design time. Here is a basic outline of steps for creating a MyEclipse Enterprise application:

    1) Begin by creating 3 projects, 1 of each type described above
    2) Copy the respective code into each project. Place you web content (JSPs) below the <web-root> folder that you specified when creating the Web Project.
    3) Copy all required web libs into the <web project>/<webroot>/WEB-INF/lib folder
    4) Place all utility jars in the root folder of you Enterprise project
    5) Per Scott’s direction (see his post in this thread) add a ClassPath entry to the MANIFEST.MF file that specifies the names of the utility jars.

    Michael
    MyEclipse Support

    #199018 Reply

    Erez
    Member

    4) Place all utility jars in the root folder of you Enterprise project

    I don’t mean to nag, but the utility jars are not jars there are packages of my own containing source files that need to be compiled. Should I put them in a forth project or can I put them inside the EAR project as a src directory? As I undertand it, the EAR should not contain sources, or am I wrong??

    Erez

    #199023 Reply

    Erez
    Member

    In my JBuilder project I had except for the EJB and WEB modules some other packages NOT in the form of JARs but loosen classes. They were shared by both the EJB and the WEB modules. What the JBuilder does is for each module (EJB and WEB) it includes those required classes from the shared packags.

    How can I achieve the same? and if not what is the alternatives?
    Thanks again,

    Erez

    #199025 Reply

    Scott Anderson
    Participant

    Erez,

    Currently, you’ll have to jar the output of your projects and add them to the EAR as we’ve instructed. There is an open enhancement request to support ‘depende projects’ which is basically the capability you’re asking for. It’s high on the development priority list at this point. You can find several discussions about it if you use the forum search facility and look for ‘all terms’ when specifying: dependent projects

    –Scott
    MyEclipse Support

    #199029 Reply

    Erez
    Member

    Thanks Scott, I will look forward to this update, and by the way I actually solved it by using linked resource folders. Not the prettiest solution but it works.

    Thanks,
    Erez

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Shared code [Closed]

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