问题描述
我有EAR和一个EJB项目。我注意到eclipse(sts)创建和earContent文件夹,所以我认为这是我需要添加外部jar。我在这个文件夹中添加了我的hibernate和log4j jar,但是我的EJB类无法解析Logger类和hibernate类。
添加这些罐子的方法是什么?或者我应该将它们添加到EJB构建路径?
- 将jar添加到耳朵项目EarContent文件夹
- 在Eclipse中右键单击ejb项目,属性
- 部署程序集 - 清单条目 - 添加
- 选择你的罐子添加,OK
- OK
- 现在添加到ejb项目中的jar可以工作。
我在第一次看到这个项目,如果没有一个更好的解决方案,不需要Maven,我会非常惊讶。 Java EE工具 - 更新EAR库选项看起来特别可疑,但似乎没有这样做。注意我还在Helios。
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?
- 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.
这篇关于使用EAR内容文件夹将外部jar添加到EJB项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!