facebook

[Closed] EJB Project including external Jar problems

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

    jnikolai
    Member

    I’m having trouble getting an external jar, specifically commons-logging.jar, to be deployed in the EJB JAR file for deployment. Let me explain:

    I have 3 modules: A web project, an EJB Project and an Enterprise Application Project. I wish to use commons-logging.jar for logging in both the web and EJB modules. Using the Properties -> Java Build Path -> Libraries dialog within the web and EJB projects I added the commons-logging.jar to both using “Add External Jars…”

    Deploying the EAR project results in the web.war file which contains the proper WEB-INF/lib/commons-logging.jar. The services.jar file, on the other hand, does not contain the commons-logging.jar file in it. As a result the deployment into the Oracle App Server fails because it can’t find the logging library used by the EJB classes.

    I have been able to deploy an EAR file which contains the following structure:

    commons-logging-1.0.4.jar
    commons.jar
    services.jar
    web.war
    META-INF/MANIFEST.MF
    META-INF/application.xml

    … but still Oracle barfs on deployment saying it can’t find the logging classes. It seems the solution is to add the commons-logging.jar file into the EJB services.jar file but I can’t seem to get it deployed that way.

    Under Windows -> MyEclipse -> Web Project you can tell it to deploy dependent libraries into the lib directory… Is there something similar for EJB Projects? How can I setup Eclipse and/or MyEclipse to add the commons-logging.jar file in the EJB services.jar archive?

    Thanks for your help,
    – John

    #239791 Reply

    Riyad Kalla
    Member

    John,
    The problem is that there is not a comparable deployment setting for EJB projects to deploy external JARs, so you will need to drop the logging JAR into the EJB project for it to be deployed as well. I believe optionally you should be able to place this single jar in the root of your EAR, and both projects will have access to it.

    #239808 Reply

    jnikolai
    Member

    I finally got it working. The user guide came in handy:
    http://myeclipseide.com/enterpriseworkbench/help/index.jsp. Specifically the MyEclipse Application Developer Guide -> Getting Started -> Enterprise Application Project -> Advanced Features (Section 9).

    The problem was that my EJB and enterprise module properties were foobar from when I was trying to tweak them. After stepping through the Advanced Feature section and setting the properties correctly, the EAR file was deployed correctly into oc4j… The trick is getting the MANIFEST.MF Class-Path property set properly.

    Thanks for your help!

    #239810 Reply

    jnikolai
    Member

    A classic case of RTFM 🙄

    #239821 Reply

    Riyad Kalla
    Member

    Thank you for double checking the doc and posting here, this will be very helpful to others.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: [Closed] EJB Project including external Jar problems

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