[英]How do I add EJB capabilities to an Eclipse dynamic web project?
I am developing a simple application with EJB 3.0 using OpenEJB for deployment and Eclipse as an IDE.我正在使用 EJB 3.0 开发一个简单的应用程序,使用 OpenEJB 进行部署,并将 Eclipse 作为 IDE。
I created the project as a 'dynamic web application' in Eclipse. When I tried creating the first stateless session bean, I realized that the @Remote annotation could not be resolved.我在 Eclipse 中将项目创建为“动态 web 应用程序”。当我尝试创建第一个无状态 session bean 时,我意识到无法解析 @Remote 注释。
What is the right way to fix this problem?解决此问题的正确方法是什么?
Thanks for helping.感谢您的帮助。
Update: I found the answer.更新:我找到了答案。
TomEE's installation has a directory containing all the jar files needed to compile and run EJB's 'apache-tomee-webprofile-1.0.0-beta-2/webapps/openejb/lib' TomEE 的安装目录包含编译和运行 EJB 的“apache-tomee-webprofile-1.0.0-beta-2/webapps/openejb/lib”所需的所有 jar 文件
I created a User Library in Eclipse containing all the jars from the lib folder described above and added it to the build path.我在 Eclipse 中创建了一个用户库,其中包含上述 lib 文件夹中的所有 jars,并将其添加到构建路径中。
The EJB interfaces now compile properly. EJB 接口现在可以正确编译。
Now you can create EJBs in the EJB project and call them from the WEB project.现在您可以在 EJB 项目中创建 EJB 并从 WEB 项目中调用它们。
And you can deploy or debug your EAP on an Application Server (like JBoss) that supports Enterprise Application Projects.您可以在支持企业应用程序项目的应用程序服务器(如 JBoss)上部署或调试您的 EAP。 The EAP is deployed as a unique file with
.ear
extension. EAP 被部署为带有
.ear
扩展名的唯一文件。
If you use Tomcat for example you cannot deploy the ear packages.例如,如果您使用 Tomcat,则无法部署ear包。
Here a page with a description about creating ear with Eclipse.这是一个页面,其中包含有关使用 Eclipse 创建耳朵的描述。
A simple way to add eclipse library support for TomEE or TomEE+ is the following:为 TomEE 或 TomEE+ 添加 eclipse 库支持的简单方法如下:
The tomEE libraries have been added to your eclipse project. tomEE 库已添加到您的 eclipse 项目中。
I'm using maven and get it work with the following simple steps:我正在使用 maven 并通过以下简单步骤让它工作:
That's it!而已!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.