Common JAR file between EJB and WAR inside an EAR

Hi,
I'm trying to deploy an EAR application outside the development environment and I have the following problem.
My EAR has the following structure :
application.ear
|-- ejbs.jar
|-- web.war
Inside the WAR, in /WEB-INF/lib/, I have a set of JAR files that are used by the Web app and also, of course, by the EJB.
During the deployment step, EJB module cannot be deployed because it miss some classes into the classpath.
I think it is a common problem in J2EE development, so does someone has a solution for this problem ?
Please note I'm using Macromedia JRun 4 SP1 on Windows XP.
Regards,
Damien.

Ok,
I have found a solution that seems elegant to me. I'm going to try and explain...
My appli.jar EJB module and my appli.war Web module are using both two JAR, let's say common.jar and util.jar.
The way to share those JAR between the two modules is to have the following structure for the EAR :
appli.ear
  |-- appli.jar
  |-- appli.war
  |-- common.jar
  |-- util.jar
  |-- META-INF
       |-- application.xml
       |-- manifest.mfIn this structure :
* the common.jar and the util.jar are not part of the WAR (/web-inf/lib)
* the manifest.mf file has the following content :
Manifest-Version: 1.0
Created-By: My Application
Class-Path: common.jar util.jarPlease note that space is used as separator for the classpath entry to allow independancy from OS.
And you know what ? It works ! Well, on Macromedia JRun 4.0 SP1 and on Windows XP but I hope it works on other platforms.
I hope it will help a lot of people because I spent a lot of time before to find a solution !
Regards,
Damien.

Similar Messages

  • Where do I put classes shared between EJBs and WAR

    I have written some ValueObject classes stored in their own jar, they are used by a number of ejbs and and a Web application WAR. I have packaged the thing up as a single EAR but neither the EJBs or the jsps can see these classes.
    How do I share these classes at each end. is their a general deployment descriptor solution or is it application server specific.
    I am deploying to IBM Websphere 6

    verify .classpath file under your web folder for both options
    Sorry, what do you mean is their a classpath value in the xml descriptors. I put my ValueObject into a jar within the WEB-INF\lib of the WAR but these arent seen by the EJBs which are within the EAR but not the WAR. Im not aware that there is a seperate WEB-INF directory for the EAR.
    Structure as follows
    app.ear
            testejb.jar
            META-INF
            testweb.war
                   test.jsp
                   META-INF
                   WEB_INF
                         classes
                              testui.class
                         lib
                             valueobjects.jar

  • Deploy EAR. Both ejb and war share classes?

    how do you package an ear that has both ejbs and wars that share a common set of classes.
    I have read through all the messages that state to add the Manifest entry Class-Path.
    I've added it to the war, ejb and ear Class-Path and I still get the same NoClassDefFoundError.
    Does anybody truely know how to get this to work? I've tried many things, and it sounds like this should work/.....?????

    Hi Madhav,
    You need to specify Class-Path in ejb-jar MANIFEST.MF,
    not in the ear.
    Regards,
    Slava Imeshev
    "Madhav Inamti" <[email protected]> wrote in message
    news:[email protected]..
    >
    I have tried the manifest classpath too and it just does not work. I had alibrary
    jar specified the ear's manifest classpath and the library jar in the earfile
    too. This should have made the ear classloader load the library jar.Didn't work.
    Does anybody on this newsgroup know about this .. ?
    "Dimitri I. Rakitine" <[email protected]> wrote:
    Since ejb classloader is a parent of a webapp classloader, you should
    only
    add these jar's to your ejb-jar Class-Path Manifest entry. Make sure
    your dependencies
    hierarchy is ok - NoClassDefFoundError usually means that the class
    itself was found,
    but not it's dependent class(es).
    Michael <[email protected]> wrote:
    how do you package an ear that has both ejbs and wars that share acommon set of classes.
    I have read through all the messages that state to add the Manifestentry Class-Path.
    I've added it to the war, ejb and ear Class-Path and I still get thesame NoClassDefFoundError.
    Does anybody truely know how to get this to work? I've tried many
    things,
    and it sounds like this should work/.....?????
    Dimitri

  • Commons jar file

    I have an application which under certain conditions sends out some emails to a group of users:-
    mailService.sendEmail(email_Add, message);mailService is an instance of MailService which resides in a commons.jar file under the lib folder in JBOSS.
    The application code resides in an ear file relay.ear under deploy folder of JBOSS.
    The application reads the email address from the database:-
    select emailAddress from users where userId='bbbb';Now whats required is to move the code executing this query in the class UsersDao to the utilitJar file as well so that any other application which might want to send email can also grab the emailaddress directly such that the call would now look like:-
    mailService.sendEmail(userId, message);So the utility jar would access the database and send out emails.
    My understanding is that it would not be possible since the lib folder doesnt have access to the datasources and connection pool under JBOSS.
    Please advise if I am wrong?
    In case there is another work around for this?
    In case I am eight are there any documents/links explaining it so that I could present it to our design team.
    Thanks in advance for your help.

    LisaM wrote:
    gimbal2 wrote:
    Why not make the commons lib part of your war or ear? Then it has access to whatever your application has access to.That could have been a good idea but as mentioned in my earlier post whats required is just simply putting it in the lib directory under libs folder and in case I am not wrong I dont think one could access the JNDI datasources and dataaccess from that folder. All I need is a confirmation of this. That one cannot access database from JBOSS/lib folder.Wait, what? Your requirement is to put the library somewhere where you quite specifically don't expect it to work?

  • Propagation of ctx between EJB and JSP

    Hello,
    Does anybody know how to propagate the Security
    Context between EJB and JSP so that when I login in my JSP page the user will be after recognized in my EJB system ?
    Thanks
    Francesco

    try this...as a test..
    take a simple Contact ejb (as simple as you can make it, just a name and email address). In the ejb-jar.xml set up a role, for example, user, and restrict the access to only this role for all methods.
    try to access the ejb from a jsp, and you should get the login form identified in your web.xml file.
    make sure that the ejb is noted in the web.xml file, also.
    this should work...
    no try this...identify a role in your web.xml file, (user, for example) and restrict the access to the a particular jsp which is not calling the ejb. IF you navigate to this jsp, you should get the login prompt...
    this should work....
    now the tough part
    in your application.xml create a role with the same name, user. By doing this, you have created a global role, and connect the two together.
    Now point your browser to the restricted jsp with no calls to the ejb...you should get the login, so login in.
    now navigate to your jsp which is unrestricted, but calls the restricted ejb...
    there should now be no login prompt.
    This should work.

  • Sharing files between users and macs

    My husband and I share an iMac. I have a MBA for traveling and my husband a PC laptop (though he rarely uses for private stuff). We both have iPhones.
    We are looking for a way to:
    - Share our photos (we don't use iPhoto) and some files. We would like to have this in one shared folder, that we can access from both accounts in the iMac, the MBA and ideally (though not a must) the PC and iPhones. We would both need to have admin rights to edit documents, etc.
    - Have access to all the information in my account on the iMac from the MBA. Ideally, same thing for his and the PC.
    - Have access to all the data remotely when traveling.
    - Have all the data backed up locally (we already have a cloud backup, but we'd like to have a local backup too as it's easier and quicker to access)
    We have read a lot about configuration, NAS, time capsule... but we get more and more confused, as we are obviously no tech experts.
    Dropbox is not our preferred choice. We already have a cloud backup system. We'd rather have the files stored and accessed locally for everyday use.
    Using a NAS to store shared folders and backup the rest sounds good, but they either seem very complicated to set up, or they have mixed reviews in terms of stability, especially to access files remotely.
    Timecapsule seems easier and more straightforward, but I'm not sure it would solve the "sharing files between users and macs with admin rights"? It seems to be more focused on backing up the main drive and then providing access to the backed up files. (Though I might be completely mistaken!)
    We just can't manage to have one shared folder between both accounts in the iMac. We need to grant admin rights document by document. We don't manage to make it work automatically so we both have one folder to access with full rights for all the contents inside it. And this seems to me like something that should easily be done...?
    Any help, advice, proposals... would be greatly appreciated!!!

    Move any file you want to the other user to access to the Shared Folder. Anything you put in that folder is available to all users.
    The shared folder is here:
    Macintosh HD > Users > Shared

  • How to share files between pc and mac via external hard drive

    how can i share my files(mp3,mp4,documents) from my harddisk with mac. i am a new mac user and i have a harddisk of NTFS format(as i was a pc user).I learned that mac supports FAT32 format and therefore i can't write data on my external hard drive.
    but, reading a section of OSX yosemite(under compatibility) it is said that now we can easily share files between pc and mac.
    So please suggest me easier way that how can i share files between macs and pc as my friends uses pc and in future i really want to share my data with them without any hustle and i dont wanna loose my data in future

    You can format the HDD to a common one like ExFAT or Fat32 but a reformat will delete all data off of the HDD.
    Your other option is to use a third party software such as Paragon or Tuxera that will allow you to write to a NFTS formatted HDD.
    Ciao.

  • Common jar files location

    We have several "common" jar files that will be used across several of our existing
    applications. We are currently trying to figure out the 'best' location for these
    files. There is one school which feels that /opt/bea/wlserverX.x/ext is the proper
    location for these files and others say /opt/bea/wlserverX.x/lib, yet a third
    opinion is to put it at the same level as the aformentioned directories.
    Has anyone run into this in the past and what was your solution?
    any help would be greatly appreciated!!
    Sebastian

    Just put it in a commonly shared path of the classpath. For example the /lib folder of the application server in question. You only need admin rights on the appserver in question to be able to place the JARs in there.

  • Share files between Mac and Windows in same iMac with boot camp

    Hello,
    I am new in using Mac and recently I buy a IMac 24" model.
    I used to use PC a long time with a lot of old document.
    I want to install Windows XP with boot camp.
    But I also want to share my documents, music, video files between Mac and Windows in same iMac.
    How can I do this?
    Thanks in advance,
    Eric

    Hi Eric and welcome to Discussions and the Apple world.
    Mac OSX can read and write from Windows partitions (like the BootCamp Windows partition you are about to create) when using FAT32 as file system for Windows.
    However with FAT32 you are limited to a partition size of 32GB.
    Mac OSX can also read from Windows partitions that uses the NTFS file system, but it can not write to them unless you use a third-party helper like either Paragons NTFS for Mac http://www.paragon-software.com/home/ntfs-mac/ or NTFS-3G http://www.ntfs-3g.org/
    Windows can not even see or use a Mac OSX partition without additional help by MacDrive http://www.mediafour.com/products/macdrive/
    Regards
    Stefan

  • How do I sync a PDF file between iPhone and iPad in iBooks?

    How do I sync a PDF file between iPhone and iPad in iBooks?

    If the PDF supports it then you can try opening the PDF in iBooks on your phone and use the 'share' icon (the square with the upward pointing arrow) to email it to yourself (some PDFs a protected and don't support emailing) and use 'open in' in the Mail app on your iPad to copy it to its Mail app.
    Or you can connect the phone to your computer's iTunes and do File > Devices > Transfer Purchases to copy it over to your iTunes (that should copy PDFs and/or epubs that are in the iBooks app, not just ibooks) and if using a Mac with Mavericks or Yosemite on it then do File > Move Books From iTunes in its  iBooks app, and you can then sync it to your iPad.

  • Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system?

    Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system? When I try to connect from my iMac I get a window that says "The version of the server you are trying to connect to is not supported." Is there a work-around to this problem or is it just not possible? It would be largly appriciated for a solutin beings my business is a small town newspaper, and we have some important files on the older computer that need to be acessed daily.

    Actually to share files between OS 8-9 and OS X, all versions, is quite easy from what I read. Look here for some details.
    http://reviews.cnet.com/8301-13727_7-20003464-263.html
    And here.
    https://www.google.com/search?q=file+sharing+Mac+OS+9.x&oq=file+sharing+Mac+OS+9 .x&aqs=chrome..69i57.20706j0j1&sourceid=chrome&ie=UTF-8
    Or since both OS 9 and OS X can do SMB Windows sharing you could use that protocol to share files from one to the other.
    Doesn't really matter what OS you are using. Mac OS/OS X shar files with Windows computers of all types and versions of Windows so the same applies for the different versions of Mac OS/OS X.
    Each Operating System takes care of reading and writing files to there respective file formats of the hard drives so that does not have to be the same. They both just have to be able to do Ethernet with the same files sharing protocol.

  • Regarding the creation of common jar file ......!

    Hi All ,
    I need to create a new Jar file which consists of the generic code which we can use for connecting to the database. The class in the jar file should have methods like u201CExecuteSelectu201D. u201CExecuteInsertu201D, u201CExecuteDeleteu201D and u201CExecuteUpdateu201D.  which  should pass the required parameters to these methods so that they can execute the corresponding query. My  UDF should use this class file and call the methods above to run any SQL statements.
    any one having any idea about how to create the above requirements .....?
    Thanks in advance
    Aziz

    Hi,
    >> class in the jar file should have methods like u201CExecuteSelectu201D. u201CExecuteInsertu201D, u201CExecuteDeleteu201D and u201CExecuteUpdate
    For developing your requirement, you can use Eclipse or any other IDE which is supported for writing Java codes. Write the codes of your requirement in IDE and compile it. Make a .jar file of classes. and then create a new Imported archive and upload your .jar file. Then relevent  class has to be declared in the import statement. This way you can use your all classes in UDF.
    Regards
    Aashish Sinha

  • Differences between @EJB and @Resouce?

    Hi,
    I am confused about the differences between @EJB and @Resource?
    1.
    Can Session Beans be injected for both?
    If so what are the pro's / con's?
    2.
    Are the any difference between the type of components that cna be registered for one but not the other?
    3.
    Are they both equally usable with the ENC?
    Many thanks.

    @EJBs are 'special' resources. For example, @EJB (for a stateful session bean) results in
    1. Creation of the Stateful Session Bean,
    2. Other dependencies are injected into this newly created bean,
    3. If the bean has a @PostConstruct bean then that method is invoked (after invoking applicable interceptors)
    Hope this helps

  • Copying files between Iphone and PC over 3G-connection?

    Hi,
    Is there any application for copying files between PC and Iphone using a 3G or Edge connection? I'm using Jaadu VNC client on my Iphone but it has no functions for file transfers (as far as I know).
    Thanks for any hints!

    No. I don't believe that would be allowed with the SDK. You could always email them to yourself.

  • I had formatted external HDD as Mac OS Extended(journaled) earlier, but now i want to format the same as ExFAT so that i can copy files between PC and MAC. But it is giving 'Can't unmount' error while i try to run Erase

    I had formatted external HDD as Mac OS Extended(journaled) earlier, but now i want to format the same as ExFAT so that i can copy files between PC and MAC. But it is giving 'Can't unmount' error while i try to run Erase

    Use the PC to reformat the drive.

Maybe you are looking for