Luis Soeiro
Luis Soeiro

Reputation: 4272

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

We want to evaluate OpenEJB for our application. 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.

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. However, we want to be able to debug the code in Netbeans. If I try to do that, NB launches JBOSS or other application servers. 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.

We know we can use an embedded version of OpenEJB, but that is not what we are looking for. So:

  1. What is the suggested project structure for an EJB application for Netbeans + OpenEJB?
  2. Is it possible to use Netbeans' Java EE knowledge (wizards, build system, client applications) with OpenEJB?
  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)?

Upvotes: 3

Views: 2210

Answers (1)

vkraemer
vkraemer

Reputation: 9892

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.

That means that you will need to be creative with your development and debugging.

I guess you could...

  1. register GlassFish Server 3
  2. create an ejb project that targets that server.
  3. code, code, code.
  4. build the project archive (dot-jar file)
  5. start the openejb server in debug mode
  6. copy the jar file created in step 4 to the appropriate location.
  7. Use the 'Attach debugger...' item of the Debug menu to attach to the openejb server that you started in step 5.

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.

Upvotes: 2

Related Questions