Hi,

I'm not completely sure what you want to do, but I'll do my best to answer
your question. You mention that you were running Tomcat in Eclipse in
another post (
http://n4.nabble.com/Tomcat-Integration-problem-td1678990.html#a1680356)
which is perhaps adding to some of the confusion. Although we do have an
OpenEJB plugin for the WTP functionality, it currently does not support
Tomcat, only the standalone OpenEJB server.

I've been looking at a looking at a contribution from Jean-Sébastien Scrève
to add Tomcat support to the Eclipse plugin, but have not completed the work
to integrate it yet (https://issues.apache.org/jira/browse/OEP-32). I'd be
happy to get back onto it once I've cleared a couple of other things off my
plate. Or I'd be happy to help if anyone else wants to have a go.

Anyway, back to your question -

There's essentially three different ways you can run OpenEJB: Embedded,
Standalone and in Tomcat.

Embedded:
---------------

Running OpenEJB in this mode makes it really easy to test your EJBs. As long
as you setup your class path correctly you can start OpenEJB in Embedded
mode by adding the following code to your test:

Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
InitialContext context = new InitialContext(p);

This will scan your classpath and deploy any EJBs it finds.

You can lookup your beans using the usual:

EJBObject obj = (EJBObject) context.lookup("EJBJNDIName");

where EJBObject is your EJB's interface, and EJBJNDIName is your EJB's JNDI
name.

David has put together a video showing how to use the embedded mode to test
EJBs in Eclipse: http://vimeo.com/6149008


Standalone
---------------

You can run the OpenEJB server in standalone mode, this provides an EJB
container that you can access remotely. You can download the standalone
server from here:
http://www.apache.org/dyn/closer.cgi/openejb/3.1.2/openejb-3.1.2.zip. Unzip
this, and create two folders in the openejb folder called apps and logs.
Copy your .EAR or .JAR with your EJBs to the apps folder you created, and
then run 'openejb start' in the bin directory. This will start the server
and deploy your beans. You don't get much on STDOUT, so its worth looking at
openejb.log in the logs folder.

The standalone server is only concerned with EJBs and won't serve up
webapps. As mentioned previously you can run the standalone server within
Eclipse, and I've done a video demonstrating this: http://vimeo.com/7393498


Tomcat
----------

You can integrate OpenEJB with Tomcat. This gives you the advantage that you
can deploy your EJBs along with your webapp. It sounded like you had this
working one of your previous posts. Essentially you follow the instructions
here: http://openejb.apache.org/tomcat.html which basically involves doing
the following:

copy openejb.war to Tomcat's webapps folder
goto http://localhost:8080/openejb and click the install link, and follow
the wizard through.
restart Tomcat
drop you EAR files in Tomcat's webapps folder and OpenEJB will pick them up
and deploy them. Again, have a look at the log files as STDOUT can be quiet.

You only need to deploy the openejb.war app to get this working, you don't
need the standalone server as well to get this going.

We don't have a video for this, but I could make one if that would be
useful.

Hope that helps.

Jon



On Wed, Mar 24, 2010 at 10:03 AM, hemilshah <[email protected]>wrote:

>
> Hi,
>
> Please brief me about using OpenEJB with Tomcat. I am confuse with two
> different paths -
>
> 1) Using OpenEJB as standalone server
> 2) Integrating openejb with Tomcat.
>
> Basically, i want to use EJBs with Tomcat so i have integrated it with
> Tomcat as specified on website, but i am unable to deploy EJB. For that it
> seems i need use OpenEJB server separately. So is it really required. Just
> integrating with Tomcat is not sufficient ? And if it is sufficient, how
> shall i deploy EJB to OpenEJB on Tomcat server ?
>
> Please clarify me about this.
>
> THanks.
> Regards,
> Hemil
> --
> View this message in context:
> http://n4.nabble.com/How-to-use-OpenEJB-with-Tomcat-tp1680307p1680307.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Reply via email to