简体   繁体   English

如何使用OpenEJB在Netbeans中为EJB开发设置项目?

[英]How to setup a project in Netbeans for EJB development using OpenEJB?

We want to evaluate OpenEJB for our application. 我们想为我们的应用程序评估OpenEJB。 We have already performed some tests and now we need to start a pilot project. 我们已经进行了一些测试,现在我们需要启动一个试点项目。

While I've seen how to use OpenEJB for testing purposes (mainly for JUnit tests), I have not seen how to set up an EJB 3.X project inside Netbeans for deployment in OpenEJB. 虽然我已经看到如何使用OpenEJB进行测试(主要用于JUnit测试),但我还没有看到如何在Netbeans中设置EJB 3.X项目以便在OpenEJB中进行部署。

The way we did for testing purposes was to create a new Java EE project, select JBOSS as the Application Server and then manually copy the JARs to OpenEJB. 我们为测试目的而做的方法是创建一个新的Java EE项目,选择JBOSS作为Application Server,然后手动将JAR复制到OpenEJB。 However, we want to be able to debug the code in Netbeans. 但是,我们希望能够在Netbeans中调试代码。 If I try to do that, NB launches JBOSS or other application servers. 如果我尝试这样做,NB会启动JBOSS或其他应用程序服务器。 I couldn't figure out how to install OpenEJB as a server in Netbeans, I didn't find anything enlightening in Java forums and there were no answers from stackoverflow. 我无法弄清楚如何在Netbeans中安装OpenEJB作为服务器,我在Java论坛中没有发现任何启发,并且没有来自stackoverflow的答案。

We know we can use an embedded version of OpenEJB, but that is not what we are looking for. 我们知道我们可以使用OpenEJB的嵌入式版本,但这不是我们想要的。 So: 所以:

  1. What is the suggested project structure for an EJB application for Netbeans + OpenEJB? Netbeans + OpenEJB的EJB应用程序的建议项目结构是什么?
  2. Is it possible to use Netbeans' Java EE knowledge (wizards, build system, client applications) with OpenEJB? 是否可以在OpenEJB中使用Netbeans的Java EE知识(向导,构建系统,客户端应用程序)?
  3. If we need to use OpenEJB just as libraries in the classpath, what is the correct approach to generate EJBs and client applications that can work with other EJB containers later (stay Java EE compatible)? 如果我们需要在类路径中使用OpenEJB作为库,那么生成可以在以后与其他EJB容器一起使用的EJB和客户端应用程序的正确方法是什么(保持Java EE兼容)?

Unfortunately, the folks behind the OpenEJB project have not contributed a server integration plugin for OpenEJB to the NetBeans project... It looks like they haven't published one on the NetBean Plugin Portal, either. 不幸的是,OpenEJB项目背后的人还没有为NetBeans项目贡献OpenEJB的服务器集成插件......看起来他们还没有在NetBean插件门户上发布一个插件。

That means that you will need to be creative with your development and debugging. 这意味着您需要对开发和调试充满创意。

I guess you could... 我想你可以......

  1. register GlassFish Server 3 注册GlassFish Server 3
  2. create an ejb project that targets that server. 创建一个针对该服务器的ejb项目。
  3. code, code, code. 代码,代码,代码。
  4. build the project archive (dot-jar file) 构建项目存档(dot-jar文件)
  5. start the openejb server in debug mode 在调试模式下启动openejb服务器
  6. copy the jar file created in step 4 to the appropriate location. 将步骤4中创建的jar文件复制到适当的位置。
  7. Use the 'Attach debugger...' item of the Debug menu to attach to the openejb server that you started in step 5. 使用Debug菜单中的'Attach debugger ...'项附加到您在步骤5中启动的openejb服务器。

If starting openejb requires that you start multiple processes (one for Tomcat and one for the ejb container), you can attach NB to multiple processes at the same time. 如果启动openejb要求您启动多个进程(一个用于Tomcat,一个用于ejb容器),则可以同时将NB附加到多个进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM