facebook

Including an existing EJB jar as part of the EAR [Closed]

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

    bcholmes
    Member

    I’m building an application using WebLogic Portal and, specifically, its content management API. One of the things I need to do is include a coupl’a their .jar files with my application. The trick is that the .jar files are actually EJB .jar files, and need to also be included in my EAR so that the EJBs get deployed to my application et al.

    If I were making these EJBs from scratch, it’d be obvious how to do this — I’d just create an EJB project and add them to my Enterprise Application Project. Because the EJBs have already been bundled into a .jar (for which I have no source code), I’m not certain about how to go about this. Any advice?

    BC

    #208644 Reply

    Riyad Kalla
    Member

    BC,
    I believe you need to drop these JARs in the root of your EAR Project and modify your MANIFEST.MF file (I think) in your EAP to include the JAR in the classpath.

    #208645 Reply

    bcholmes
    Member

    That’s what I would have done if the .jars had been normal jars. (And, in fact, we tried that just ’cause we were desperate — that is, we dropped the .jars into the EAR Project and add a Class-Path entry to the MANIFEST.MF of one of my EJB projects). The problem is that I’m pretty sure that I need an entry in my application.xml so that the EJBs inside the third-party .jar get deployed at WebLogic start-up time. Just adding them to the classpath isn’t enough for that.

    Generally, the only way I can get stuff added to the application.xml is to use the MyEclipse->Add and Remove Modules dialog, and that dialog expects that my EJB stuff is already sitting in an EJB project. Can I tell MyEclipse that my EJB module is already bundled into a .jar?

    (My final fall-back is to try exploding the .jar into an EJB project with no source code… I worry that that’s gonna take me to a world of pain, but I’ll try it if nothing else works).

    #208646 Reply

    Riyad Kalla
    Member

    BC,
    Hang tight, I asked our lead support to check this out.

    #208649 Reply

    Scott Anderson
    Participant

    BC,

    You’ve presented an interesting problem since you’re correct that application.xml would need to be updated. I initially thought you could simply add the jar to the top level of your EJB’s source folder, but that puts everything in a jar in a jar, if you know what I mean. However, I’ve found something that will work, although it’s a bit unorthodox to say the least.

    For your EAR, you need to create an EJB project to hold the class files from the compiled jars you’re trying to deploy. But first, you need to configure the EJB project to allow the source and output folders to be the same folder like in the screenshot below.


    Note that once the project is configured that with the src also being the output folder that I then unjar’ed the class files into the source folder. Now, when depoloyed as part of the EAR, this project will look just like a normal EJB. One word of warning though, if you manually clean the project, the class files will be removed. However, they’ll stay there just fine if you don’t manually clean since there is nothing to build.

    I know it’s a little strange, but it does ‘get you there’. 🙂

    #208713 Reply

    bcholmes
    Member

    @support-scott wrote:

    However, I’ve found something that will work, although it’s a bit unorthodox to say the least.

    Yup, that’s unorthodox. But thanks for the work-around!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Including an existing EJB jar as part of the EAR [Closed]

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