facebook

EJB packaging & xdoclet problems

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

    harryajh
    Member

    I have an enterprise app with 7 ejb’s & 1 web component.

    One of my ejb’s looks like below,

    //////////////////////////////////////////////////////////////////
    package prd.ejb;

    // loads of imports, interface methods, comments etc… removed

    import prd.dto.*;
    import prd.interfaces.*;

    public class ProjectEJB implements SessionBean
    {
    public System_DTO getSystem() throws EJBException, RemoteException
    {
    return persistance.getSystem();
    }
    }
    //////////////////////////////////////////////////////////////////

    but running xdoclet produces this –

    //////////////////////////////////////////////////////////////////
    package prd.interfaces;

    // again loads removed

    public interface Project
    extends javax.ejb.EJBObject
    {
    public prd.ejb.System_DTO getSystem( )
    throws java.rmi.RemoteException;
    }
    //////////////////////////////////////////////////////////////////

    for some reason it thinks System_DTO is in the prd.ejb package not prd.dto??????? what the heck is going on? – each time I add a new method I have to manually change them!

    Also, I want to add a JAR file to an EJB so it gets packaged within the WAR file & the EJB class can use it’s class methods etc.. how/where do I put it? There is no WEB-INF/lib directory as with we components & presently I can only achieve this by expanding the JAR files in to the EJB’s classes directory.

    This never seems to get any easier does it – constant downtime & headbanging is really what Java’s all about!

    thanks

    harry

    #219886 Reply

    Scott Anderson
    Participant

    Harry,

    Sorry you’re experiencing some issues.

    for some reason it thinks System_DTO is in the prd.ejb package not prd.dto??????? what the heck is going on? – each time I add a new method I have to manually change them!

    Have you read our EJB Development tutorial in the Documentation section? It provides quite a bit of detail on properly configuring XDoclet to generate your EJB interface classes as desired. The Documentation section is available in the left navigation menu, or as a direct link here:
    http://www.myeclipseide.com/ContentExpress-display-ceid-67.html. Additionally, here’s a direct link to the EJB tutorial:
    http://www.myeclipseide.com/images/tutorials/quickstarts/firstejb/

    Also, I want to add a JAR file to an EJB so it gets packaged within the WAR file & the EJB class can use it’s class methods etc.

    Actually, that’s a bit backward. According to the J2EE spec, the classloader hierarchies work the other way around. That is to say that the web components have access to classes packaged in the EJB components, but the EJB components do not have access to what’s packaged in the web components. To provide the visibility you want, you’ll either have to expand the jar into the EJB component as you’re doing now, or package everything as an EAR that contains all the components along with the library jar and modify the MANFIEST.MF files in the web and EJB project to add a Class-Path entry that points to the relative location of the library jar.

    The good news is that in our next release, 3.8.3 (early December) we’ll be adding direct support for merging library projects into EJB jars at deployment time as well as packaging library jars into the root of EAR projects at deployment time.

    #219907 Reply

    harryajh
    Member

    thanks for that scott, will read up on xdoclet now.

    Regarding the EJB & JAR files issue, I’m actually trying to setup up an EJB that uses the iBatis persistance framework (3 JAR files) + the log4j.jar & commons-logging-2.jar files (these last 2 need to be used by a web app & other EJB’s!).

    I cannot work out for the life of me where to put them or how to properly reference them? if I open the EJB’s manifest file in ME, from the “Runtime” tab the only way I can get to include these JAR files on the classpath is if they are within the EJB file – this still doesn’t work during runtime by the way!

    All I want to do is to store these JAR files somewhere? & use there functionality from within an EJB file. Nothing I try seems to work except to expand them in to the EJB file.

    I have an EAR app with 7 EJB’s & 1 web component.

    Can you help at all?

    cheers

    #219910 Reply

    Scott Anderson
    Participant

    All I want to do is to store these JAR files somewhere?

    For EAR deployment for libraries that are used by both the EJB and Web tiers we recommend that you jar your common project(s) and them to the root level of your EAR project. They’ll be automatically packaged by doing this. Next, you need to tell your EJB jar and WAR where to look for the common jar and this is done by modifying the Class-Path entry in each project’s MANIFEST.MF file to point to the library’s relative deployment-time location. A writeup on the format for the entries needed in the manifest is available here:
    http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: EJB packaging & xdoclet problems

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