Hi Gurkan,

Thanks for the details.
I have been building the OWB from the trunk and followed the readme which is based on M3, the M4 specific readme is not yet available.

I did understand that we need the place the common jars specific to jsr330/jsr299 in the $TOMCAT/lib and configure the openejb in tomcat. After this we should be able to deploy the ejb-sample.war in the $TOMCAT/webapps, pretty simple!

Is there anything else I should look from configuration perspective?

Here is what I see from the Tomcat console currently

***********************************************************************************************
INFO: Deploying web application archive ejb-sample.war
context path = /ejb-sample
23 Feb, 2010 3:41:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
23 Feb, 2010 3:41:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ejb-sample] startup failed due to previous errors
23 Feb, 2010 3:41:09 PM org.apache.catalina.loader.WebappClassLoader findResourceInternal INFO: Illegal access: this web application instance has been stopped already. Could not load org/apache/openjpa/util/ImplHelper.class. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. 23 Feb, 2010 3:41:09 PM org.apache.catalina.loader.WebappClassLoader findResourceInternal INFO: Illegal access: this web application instance has been stopped already. Could not load org/apache/openjpa/util/ImplHelper$1.class. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. 23 Feb, 2010 3:41:09 PM org.apache.catalina.startup.HostConfig deployDirectory ***********************************************************************************************

Regards,
Vicky
Gurkan Erdogdu wrote:
Hello Vicky;

Some configuration file names are changed. README_M3 is a little bit old with respect to openwebbeans.properties content. We have a plan to release M4 this week that it contains lots of bug fixes. Therefore instead of using M3 artifacts, until M4 releases, checkout source from SVN and build it yourself.

>>> "atinject-api-1.0.0-incubating-M3.jar....
at-inject.(JSR-330 API).jar and cdi.jar (JSR-299 API) projects have moved to geronimo specs. You can download it from http://repo1.maven.org/maven2/org/apache/geronimo/specs/ manually or if you use "maven", you can define dependencies to them looking at pom content fro there.

Locations :
----------------------------
http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-atinject_1.0_spec/
http://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-jcdi_1.0_spec/

You have to add those jars into TOMCAT lib folder.

>>>WEB-INF/lib, I don't understand what does this mean, it is not clear.
It means that some of the libraries (jars) that OWB needs are not contained in Tomcat. You have to manually add those jars into your application WEB-INF/lib. For example, if you create a JSF application, add JSF jars into WEB-INF/lib with OWB JSF plugin. Another example is that OWB needes validator.jar.

Generally you have to add implementation jar(webbeans-impl) and its dependencies to application WEB-INF/lib except atinject.jar and cdi.jar. webbeans-impl jar must be reside in WEB-INF/lib folder of the application, not in TOMCAT/lib folder.

For Configuration:
------------------------
openwebbeans-default.properties does not use EJB meta-data discovery as default. To use EJB discovery you have to tweak some properties. Look at http://svn.apache.org/repos/asf/openwebbeans/trunk/samples/ejb-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties.

Moreover, README_M3 talked about resource plugin that was responsibe for injecting Java EE resources into bean (For example, EntityManager, DataSource etc.). There is no ResourcePlugin in current codebase. It has removed. Now, there is a ResourceInjectionService. You have to configure this service in openwebbeans.properties to use OpenEJB resource injection service instead of default. (Look at ejb-sample openwebbeans.properties).

Currently OWB looks for META-INF/openwebbeans/openwebbeans.properties files to run over default configuration properties. If you have a JAR that is located in Tomcat LIB folder that contains META-INF/openwebbeans/openwebbeans.properties file, it is read by OWB.

One more thing, OWB uses EJB interceptor (OpenWebBeansEJBInterceptor) to inject dependencies to EJB beans. Therefore your every session bean must have this interceptor. Again look at samples.

Please look at ejb-sample application for current configuration.

You can also join us on freenode channel on #IRC with #openwebbeans channel.

Thanks;

--Gurkan


2010/2/23 Vicky Kak <[email protected] <mailto:[email protected]>>

    Vicky Kak wrote:

        Hi Folks,

        I am in process of testing openwebbean with Tomcat/openejb, I
        did read the related section from the following docs
        https://svn.apache.org/repos/asf/openwebbeans/trunk/readme/README_M3.txt

        Here is the section which explains it
        
********************************************************************************************

        EJB Support via Embeddable OpenEJB Container in Tomcat 6.X
        ---------------------------------------------

        Configuration Steps:
        --------------------------------------------
        1* Download Tomcat 6.X version
        2* Configure OpenEJB. Look at URL
        http://openejb.apache.org/tomcat.html for installation.
        3* Copy "atinject-api-1.0.0-incubating-M3.jar" to Tomcat /lib
        folder.
        4* Copy "openwebbeans-api-1.0.0-incubating-M3.jar"
        5* Look at ejb-sample.war for "WEB-INF/lib" libraries to
        develop custom application.
         You can also look at a source of the project.
        
********************************************************************************************

        "atinject-api-1.0.0-incubating-M3.jar" does not get generated
        at atinject-tck location, I was expecting it to be there. It
        is not there, I did pull the CDI api jar and dropped it in the
        $TOMCAT_HOME/lib.

        "openwebbeans-api-1.0.0-incubating-M3.jar" should also be
        copied to the $TOMCAT/lib, this should be pointed in the
        instructions too.

        >>Look at ejb-sample.war for "WEB-INF/lib" libraries to
        develop custom application.
        I don't understand what does this mean, it is not clear.


        
********************************************************************************************

        How to Develop EJB Applications
        ---------------------------------------------
        1* Add "META-INF/openwebbeans.properties" into your
        application classpath.
        2* Add
        "org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService=true"
        to use EJB functionality.
         So OWB container looks for EJBs.
        3* Add
        
"org.apache.webbeans.resource.spi.ResourceService=org.apache.webbeans.spi.ee.openejb.resource.OpenEjbResourceServiceImpl"
        to
        use OpenEJB Resource injections.
        4* Add "openwebbeans-ejb", "openwebbeans-resource" and
        "openwebbeans-geronimo" plugins into your web application
        classpath.
        It adds EJB, Resource and Open EJB Resource plugins into your
        application.
        5* If you want to use other plugins, add respective plugins
        into your application classpath. For example, if you wish to use
        JSF framework, you add "openwebbeans-jsf" plugin.
        6* Add OWB related interceptor into your EJB Beans. This is
        called
        "org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor"
        This is needed for OWB injections.
        7* Update your application's "web.xml" to add OWB specific
        configuration.

        ---------------------------------------------
        
********************************************************************************************


        Why can't we have this openwebbeans.properties as a part of
        the jars which we have dropped in $TOMCAT/lib, it is not good
        idea to configure the classpath for the Tomcat and then start.
        I see the default properties file being here
        
https://svn.apache.org/repos/asf/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties


        This does not contain the property values as mentioned in "How
        to Develop EJB Applications", I was thinking of taking the
        same file setting it to the Tomcat CP.

        I have been able to configure the openEJB for Tomcat and have
        not yet followed the instructions to set the
        META-INF/openwebbeans.properties and hence getting this error
        
*******************************************************************************

        context path = /ejb-sample
        23 Feb, 2010 1:33:28 PM
        org.apache.catalina.core.StandardContext start
        SEVERE: Error listenerStart
        
*******************************************************************************


        Before digging more into the code and finding the details I
        would like to know more from the community.

        Regards,
        Vicky






--
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com

Reply via email to