You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by stx_g <st...@yahoo.it> on 2012/05/04 19:02:37 UTC

EJB injection issue

Hi All,
  
  I’m developing an application that use EJB and JAX-RS.

  Using Maven, I package the application in a war archive and deploy it to
TomEE+. 

  Sometimes it works very well but sometimes some EJBs are not injected
inside rest web service.

  In catalina.out log I found : 

-------------------------------
INFO: Auto-linking resource-ref 'java:comp/env/WdR2DS' in bean
EjbGenericDbTable to Resource(id=WdR2DS)
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EJBMyBatisDb".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EJBSessionManager".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EJBRicercaCorrente".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EJBAuthService".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EJBProgettoRF".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"EjbGenericDbTable".  Will attempt resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
buildEjbRefs
WARNING: Unresolved ejb reference
"java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
"/home/Users/stefano/apache-tomee-plus-1.0.0/webapps/wdr2".  Will attempt
resolution again at runtime.
May 4, 2012 2:34:35 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application
"/home/Users/stefano/apache-tomee-plus-1.0.0/webapps/wdr2.war" loaded.
-------------------------------


And when rest web service end up with exceptions like that.

-------------------------------
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at
org.apache.openejb.server.cxf.rs.OpenEJBPerRequestPojoResourceProvider$InitialContextWrapper.invoke(OpenEJBPerRequestPojoResourceProvider.java:102)
        ... 37 more
Caused by: javax.naming.NameNotFoundException: Name
"comp/env/it.kitelabs.wdr2.rs. RSRicercaCorrente/rc" not found.
        at
org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:195)
        at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:149)
        ... 42 more
-------------------------------

  I can’t understand why!! 

  Could you help me, please?


- Stefano

--
View this message in context: http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJB injection issue

Posted by Romain Manni-Bucau <rm...@gmail.com>.
It should work.
Le 11 mai 2012 18:05, "stx_g" <st...@yahoo.it> a écrit :

> Hi Romain.
>
>
>
> Romain Manni-Bucau wrote
> >
> >
> > without a sample to work on that's a bit hard :s
> >
>
> Yes, I know. :-(
>
>
> Romain Manni-Bucau wrote
> >
> > do you use an ear?
> >
>
> No, we use a WAR package but I just found a mistake we made: the majority
> of
> EJBs are inside the classes directory but there are some EJBs even inside
> one library packaged in JAR and placed inside the lib directory
> (WEB-INF/lib).  Could this be a problem?
>
>
> - Stefano
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164p4626845.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: EJB injection issue

Posted by stx_g <st...@yahoo.it>.
Hi Romain.



Romain Manni-Bucau wrote
> 
> 
> without a sample to work on that's a bit hard :s
> 

Yes, I know. :-(


Romain Manni-Bucau wrote
> 
> do you use an ear?
> 

No, we use a WAR package but I just found a mistake we made: the majority of
EJBs are inside the classes directory but there are some EJBs even inside
one library packaged in JAR and placed inside the lib directory
(WEB-INF/lib).  Could this be a problem?


- Stefano



--
View this message in context: http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164p4626845.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJB injection issue

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hmm,

without a sample to work on that's a bit hard :s

do you use an ear?

- Romain


2012/5/11 stx_g <st...@yahoo.it>

> Hi Romain,
>
>  I’m sorry, I’m late but ... I spent a lot of time figuring out what's
> wrong in my application ... without success.
>
>
> Romain Manni-Bucau wrote
> >
> > a workaround can be to use EJB as rest services (think to remove
> > transactions if you dont need them for performances reasons)
> >
>
>   No way, it does’t work.  :-(
>
>
> Romain Manni-Bucau wrote
> >
> > well that's said it should work so please check you don't have
> conflicting
> > libraries (compare your WEB-INF/lib to tomee/lib)
> >
>
>  In my lib directory I have only Log4J (log4j-1.2.16.jar) and MyBatis
> (mybatis-3.0.6.jar) plus two other libraries developed by my team.
>
>
> Romain Manni-Bucau wrote
> >
> > if you manage to reproduce it (let's say "try it n times" is enough ;))
> > and
> > can share the sample it is the best.
> >
>
>   I’m working on a sample but I can’t reproduce the problem: with this
> small
> application, TomEE+ seems to be extremely reliable.
>
>  Do you have any suggestions?
>
>
>  Thanks a lot.
>
>
>
> - Stefano
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164p4626010.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: EJB injection issue

Posted by stx_g <st...@yahoo.it>.
Hi Romain,

  I’m sorry, I’m late but ... I spent a lot of time figuring out what's
wrong in my application ... without success.


Romain Manni-Bucau wrote
> 
> a workaround can be to use EJB as rest services (think to remove
> transactions if you dont need them for performances reasons)
> 

  No way, it does’t work.  :-(


Romain Manni-Bucau wrote
> 
> well that's said it should work so please check you don't have conflicting
> libraries (compare your WEB-INF/lib to tomee/lib)
> 

 In my lib directory I have only Log4J (log4j-1.2.16.jar) and MyBatis
(mybatis-3.0.6.jar) plus two other libraries developed by my team.


Romain Manni-Bucau wrote
> 
> if you manage to reproduce it (let's say "try it n times" is enough ;))
> and
> can share the sample it is the best.
> 

  I’m working on a sample but I can’t reproduce the problem: with this small
application, TomEE+ seems to be extremely reliable. 

  Do you have any suggestions?


  Thanks a lot.



- Stefano



--
View this message in context: http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164p4626010.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJB injection issue

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

a workaround can be to use EJB as rest services (think to remove
transactions if you dont need them for performances reasons)

well that's said it should work so please check you don't have conflicting
libraries (compare your WEB-INF/lib to tomee/lib)

if you manage to reproduce it (let's say "try it n times" is enough ;)) and
can share the sample it is the best.

- Romain


2012/5/4 stx_g <st...@yahoo.it>

> Hi All,
>
>  I’m developing an application that use EJB and JAX-RS.
>
>  Using Maven, I package the application in a war archive and deploy it to
> TomEE+.
>
>  Sometimes it works very well but sometimes some EJBs are not injected
> inside rest web service.
>
>  In catalina.out log I found :
>
> -------------------------------
> INFO: Auto-linking resource-ref 'java:comp/env/WdR2DS' in bean
> EjbGenericDbTable to Resource(id=WdR2DS)
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EJBMyBatisDb".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EJBSessionManager".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EJBRicercaCorrente".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EJBAuthService".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EJBProgettoRF".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "EjbGenericDbTable".  Will attempt resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.JndiEncInfoBuilder
> buildEjbRefs
> WARNING: Unresolved ejb reference
> "java:comp/env/it.kitelabs.wdr2.rs.RSRicercaCorrente/rc" in bean
> "/home/Users/stefano/apache-tomee-plus-1.0.0/webapps/wdr2".  Will attempt
> resolution again at runtime.
> May 4, 2012 2:34:35 PM org.apache.openejb.config.AppInfoBuilder build
> INFO: Enterprise application
> "/home/Users/stefano/apache-tomee-plus-1.0.0/webapps/wdr2.war" loaded.
> -------------------------------
>
>
> And when rest web service end up with exceptions like that.
>
> -------------------------------
> Caused by: java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>        at java.lang.reflect.Method.invoke(Method.java:616)
>        at
>
> org.apache.openejb.server.cxf.rs.OpenEJBPerRequestPojoResourceProvider$InitialContextWrapper.invoke(OpenEJBPerRequestPojoResourceProvider.java:102)
>        ... 37 more
> Caused by: javax.naming.NameNotFoundException: Name
> "comp/env/it.kitelabs.wdr2.rs. RSRicercaCorrente/rc" not found.
>        at
> org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:195)
>        at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:149)
>        ... 42 more
> -------------------------------
>
>  I can’t understand why!!
>
>  Could you help me, please?
>
>
> - Stefano
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJB-injection-issue-tp4609164.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>