On Sep 5, 2005, at 12:06 AM, kapi59ttp wrote:

Hi there!!!
I am developing a project with OpenEJB and i need to use it with Apache
Tomcat, but i dont know how to start. I have seen @ the web the way to
configure an app to use OpenEJB, but after that how can i get the EJB
instance??? Do i need to use in the JSP page a class with the code of
the OpenEJB client???
Could anyone help me making a helloworld example??? :S

I am quite lost, as u can see.

I've updated quite a bit of the docs lately, but the Tomcat stuff still needs help. There is an example of a new style of integrating OpenEJB and Tomcat so that OpenEJB exists just in the webapp and not globally in Tomcat. If this is what you are going for, check out the example in the OpenEJB 1.0 beta 1 distro.

distro is here: http://openejb.codehaus.org/dist/openejb-1.0- beta1.zip
  unpack and go to this directory: openejb-1.0-beta1/examples/moviefun/

Give that a shot with the latest Tomcat 4.x release. If you get that working, feel free to be brave and try the 5.5.x code, which has not been tested yet. I don't foresee any issues, but those are always famous last words.

That example is currently running online at:

  http://demo1.openejb.org/moviefun/


Aside from that example, the basic usage pattern of webapps that use OpenEJB is initialization and lookup.

Initialization
--------------

The LoaderServlet runs first and initializes OpenEJB (load-on-startup = 0). You can set any configuration parameters in the LoaderServlet's init-params. You *must* set the openejb.home parameter to the location where you installed OpenEJB.

Lookup
------

Afterwards, ejbs can be looked up using the LocalInitialContextFactory (i.e. Local Server). See http:// www.openejb.org/Local+Server for example code.

You don't need to pass any special parameters to the LocalInitialContextFactory after the LoaderServlet runs. The LocalInitialContextFactory will find the OpenEJB instance in the classloader and can locate and return beans in the EJB Container to you when you look them up from the JNDI Context. Check the log file as detailed here to see if your ejbs were successfully loaded and what their JNDI names are: http://www.openejb.org/ Deployments#Deployments-Logfile


Keep asking as many questions as you like, this text makes good additions to the docs and with our new wiki backend it's as easy as cut and paste. Hopefully we can not only fix your issue but improve the docco at the same time.

Let us know how it goes.

Thanks,
David

Reply via email to