You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Amirouche Boubekki <am...@gmail.com> on 2011/02/26 14:41:08 UTC

Openejb + Tomcat

Héllo,

I'm trying to get working a java jee project with openejb and tomcat with no
success so far.

I'm using the lastest openejb jars 3.1.4 with Apache TomEE pre-bundled with
openejb, I'm using java 1.6.0_24 from sun

I use Helios Eclipse to run the project.

A simple web application is available at bitbucket [1] demonstrating how i
use openejb+servlet.

Currently the server fail to build the Foo servlet which use an ejb injected
with the @EJB annotations, here is the stacktrace from the 500 page :

*exception*

javax.servlet.ServletException: Erreur à l'instantiation de la classe
servlet faf.Foo
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	java.lang.Thread.run(Thread.java:662)

*cause mère*

javax.naming.NameNotFoundException: Le Nom faf.Foo n'est pas lié à ce Contexte
	org.apache.naming.NamingContext.lookup(NamingContext.java:770)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:278)
	org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:192)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	java.lang.Thread.run(Thread.java:662)


There is also an error in the console :

ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
property 'source' to 'org.eclipse.jst.jee.server:faf2' did not find a
matching property.
java.lang.NullPointerException
    at
org.apache.openejb.tomcat.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java:60)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

What am I missing ?


[1] https://bitbucket.org/abki/tomcatopenejbspring/src

Re: Openejb + Tomcat

Posted by Amirouche Boubekki <am...@gmail.com>.
It only works when I export the projet war, Is there any chance I could get
this working directly from eclipse ?

Thanks for you time.


Amirouche.

2011/2/27 Jonathan Gallimore <jo...@gmail.com>

> Hi there,
>
> Thanks for giving the TomEE bundle a try. It looks like you have included
> the OpenEJB jars in your war's WEB-INF directory, which you don't need to do
> (the container should provide them for you), and should avoid doing as we'll
> try and scan them and deploy them as ejb jars at deploy time.
>
> I've removed these from your project, and included javaee-api.jar in a
> directory that doesn't get included in the war when it is exported from
> Eclipse. It looks like it builds and runs correctly now.
>
> I've uploaded a zip of your modified project to:
> http://people.apache.org/~jgallimore/poc.zip
>
> Hope that helps.
>
> Regards
>
> Jon
>
> On Sat, Feb 26, 2011 at 1:41 PM, Amirouche Boubekki <
> amirouche.boubekki@gmail.com> wrote:
>
>> Héllo,
>>
>> I'm trying to get working a java jee project with openejb and tomcat with
>> no
>> success so far.
>>
>> I'm using the lastest openejb jars 3.1.4 with Apache TomEE pre-bundled
>> with
>> openejb, I'm using java 1.6.0_24 from sun
>>
>> I use Helios Eclipse to run the project.
>>
>> A simple web application is available at bitbucket [1] demonstrating how i
>> use openejb+servlet.
>>
>> Currently the server fail to build the Foo servlet which use an ejb
>> injected
>> with the @EJB annotations, here is the stacktrace from the 500 page :
>>
>> *exception*
>>
>> javax.servlet.ServletException: Erreur à l'instantiation de la classe
>> servlet faf.Foo
>>
>>  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>
>>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>
>>  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>>
>>  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>>
>>  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>>        java.lang.Thread.run(Thread.java:662)
>>
>> *cause mère*
>>
>> javax.naming.NameNotFoundException: Le Nom faf.Foo n'est pas lié à ce
>> Contexte
>>        org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>>        org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>>
>>  org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:278)
>>
>>  org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:192)
>>
>>  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>
>>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>
>>  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>>
>>  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>>
>>  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>>        java.lang.Thread.run(Thread.java:662)
>>
>>
>> There is also an error in the console :
>>
>> ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
>> property 'source' to 'org.eclipse.jst.jee.server:faf2' did not find a
>> matching property.
>> java.lang.NullPointerException
>>    at
>>
>> org.apache.openejb.tomcat.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java:60)
>>    at
>>
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>>    at
>>
>> org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
>>    at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
>>    at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>    at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>    at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
>>    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>>
>> What am I missing ?
>>
>>
>> [1] https://bitbucket.org/abki/tomcatopenejbspring/src
>>
>
>

Re: Openejb + Tomcat

Posted by Jonathan Gallimore <jo...@gmail.com>.
Hi there,

Thanks for giving the TomEE bundle a try. It looks like you have included
the OpenEJB jars in your war's WEB-INF directory, which you don't need to do
(the container should provide them for you), and should avoid doing as we'll
try and scan them and deploy them as ejb jars at deploy time.

I've removed these from your project, and included javaee-api.jar in a
directory that doesn't get included in the war when it is exported from
Eclipse. It looks like it builds and runs correctly now.

I've uploaded a zip of your modified project to:
http://people.apache.org/~jgallimore/poc.zip

Hope that helps.

Regards

Jon

On Sat, Feb 26, 2011 at 1:41 PM, Amirouche Boubekki <
amirouche.boubekki@gmail.com> wrote:

> Héllo,
>
> I'm trying to get working a java jee project with openejb and tomcat with
> no
> success so far.
>
> I'm using the lastest openejb jars 3.1.4 with Apache TomEE pre-bundled with
> openejb, I'm using java 1.6.0_24 from sun
>
> I use Helios Eclipse to run the project.
>
> A simple web application is available at bitbucket [1] demonstrating how i
> use openejb+servlet.
>
> Currently the server fail to build the Foo servlet which use an ejb
> injected
> with the @EJB annotations, here is the stacktrace from the 500 page :
>
> *exception*
>
> javax.servlet.ServletException: Erreur à l'instantiation de la classe
> servlet faf.Foo
>
>  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
>  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>
>  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>
>  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>        java.lang.Thread.run(Thread.java:662)
>
> *cause mère*
>
> javax.naming.NameNotFoundException: Le Nom faf.Foo n'est pas lié à ce
> Contexte
>        org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>        org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>
>  org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:278)
>
>  org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:192)
>
>  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
>  org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>
>  org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>
>  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>        java.lang.Thread.run(Thread.java:662)
>
>
> There is also an error in the console :
>
> ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
> property 'source' to 'org.eclipse.jst.jee.server:faf2' did not find a
> matching property.
> java.lang.NullPointerException
>    at
>
> org.apache.openejb.tomcat.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java:60)
>    at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>    at
> org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
>    at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
>    at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
>    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>
> What am I missing ?
>
>
> [1] https://bitbucket.org/abki/tomcatopenejbspring/src
>