Monday, March 15, 2010

OpenWebBeans Apache Tomcat Support

Hello;

OpenWebBeans has been integrated with Apache Tomcat 6.x Java EE servlet/jsp container. So what?
  • You can deploy your JSR-299 enabled applications(Web deployment archives that contains WEB-INF/beans.xml marker file. ) directly into Tomcat. There is no need to define "servlet context listener" in a web.xml. Tomcat integration code automatically handles all configuration.
  • You can inject JSR-299 bean instances into Java EE component types including, Servlets, Filters, Tag Handlers, Listeners, JSF Managed Beans
You can checkout trunk from "http://svn.apache.org/repos/asf/openwebbeans/trunk/". And install it from root as "mvn install". After that do the followings
  • Add lifecycle listener to the server.xml of Tomcat. Listener class is org.apache.webbeans.web.tomcat.ContextLifecycleListener.java
  • Put JSR-299 API, JSR-330 API, Interceptor 1.1 API, and openwebbeans-tomcat and openwebbeans-spi modules to the "lib" directory of the Tomcat. (You can use geronimo-specs jars for JSR-299, JSR-330 and Interceptor APIs from http://repo2.maven.org/maven2/org/apache/geronimo/specs/)
  • Package your application with openwebbeans jars (Or if you use maven, just add dependency to openwebbeans-impl)
  • Enjoy!
There is an example in the samples directory :
http://svn.apache.org/repos/asf/openwebbeans/trunk/samples/tomcat-sample/

Have a nice week;

--Gurkan

No comments: