Adding external jars to EJB project using EAR content folder

sonx picture sonx · Apr 18, 2011 · Viewed 16.1k times · Source

i have EAR and an EJB project. I noticed eclipse (sts) creates and earContent folder so I assume this is where I need to add external jars.

I added my hibernate and log4j jars on this folder but my EJB classes cannot resolve Logger class and hibernate classes.

What's the correct way of adding these jars? or should I just add them to the EJB build path?

Answer

paprika picture paprika · Feb 10, 2012
  • Add jars to ear project EarContent folder
  • In Eclipse Right click ejb project, Properties
  • Deployment Assembly - Manifest Entries - Add
  • Choose your jars to add, OK
  • OK
  • jars now added to manifest in ejb project, should work.

I'm looking at this in a project for the first time, I'd be very surprised if there wasn't a better solution to this that doesn't require Maven. The Java EE Tools - Update EAR Libraries option looks particularly suspicious, but doesn't seem to do the above. Note I'm on Helios still.