You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by pj <pj...@gmail.com> on 2013/03/26 10:48:38 UTC

Guice & CDI

Hello,
I'm trying to migrate a Websphere application to Tomee 1.5.1.
But CDI crash during startup because I'm using Guice and @Inject annotations
but I don't have specified a @Default implementations (because Guice use
@ImplementedBy).

I got the following error:

25 mars 2013 20:10:27 org.apache.openejb.cdi.OpenEJBLifecycle
startApplication
GRAVE: CDI Beans module deployment failed
javax.enterprise.inject.UnsatisfiedResolutionException: Api type
[com.x.persistence.ldap.LdapQueryHelper] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  ldapQueryHelper,
Bean Owner : [XnetGroupService, Name:null, WebBeans Type:ENTERPRISE, API
Types:[java.lang.Object,com.x.user.local.XnetGroupServiceLocal],
Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
	at
org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:77)

I would like to disable CDI ; for example, I have read in Weld
docuementation we can specify scan properties in the beans.xml. But I failed
to do this.

Do you have a solution to disable CDI in all of my packages ?
Thanks by advance



--
View this message in context: http://openejb.979440.n4.nabble.com/Guice-CDI-tp4661784.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Guice & CDI

Posted by Romain Manni-Bucau <rm...@gmail.com>.
scan.xml can be in META-INF of jar in ear IIRC and eclusions.list can be
global in tomee/conf (just add default-list as first line doing it)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/3/26 pj <pj...@gmail.com>

> Thanks to your reactivity,
>
> I'm building my Tomee app with my EJB project packaged as a JAR in the
> apps/
> folder and my JSF project deployed by Eclipse wtp. I don't want to package
> my EJB project as a web module dependency (in web-inf/lib), because I would
> like to be able to deploy a MDB or a scheduled EJB without web app.
> With this configuration, I tried to put the scan.xml or the exclusions.list
> in META-INF/ folder of my EJB project, but I have the same issue ; the EJB
> deployement crashed with the exception. I'm not sure these 2 files are
> taking into account with this deployment approach.
>
> Do you have an advise to help me ?
> Thanks.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Guice-CDI-tp4661784p4661795.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Guice & CDI

Posted by pj <pj...@gmail.com>.
Thanks to your reactivity,

I'm building my Tomee app with my EJB project packaged as a JAR in the apps/
folder and my JSF project deployed by Eclipse wtp. I don't want to package
my EJB project as a web module dependency (in web-inf/lib), because I would
like to be able to deploy a MDB or a scheduled EJB without web app.
With this configuration, I tried to put the scan.xml or the exclusions.list 
in META-INF/ folder of my EJB project, but I have the same issue ; the EJB
deployement crashed with the exception. I'm not sure these 2 files are
taking into account with this deployment approach.

Do you have an advise to help me ?
Thanks.



--
View this message in context: http://openejb.979440.n4.nabble.com/Guice-CDI-tp4661784p4661795.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Guice & CDI

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

two in fact depending on your concrete case.

If all your guice stuff is in identified jars (=not in WEB-INF/classes)
just add a WEB-INF/exclusions.list file with the prefixes or names of your
jars:

myguiceapp-
myguicesuperotherjar-


If you can't use this "jar filtering" just add a WEB-INF/scan.xml file with
the packages to scan (that's inclusions):

<scan>
  <packages>
    <package>my.cdi.app</package>
  <packages>
</scan>

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/3/26 pj <pj...@gmail.com>

> Hello,
> I'm trying to migrate a Websphere application to Tomee 1.5.1.
> But CDI crash during startup because I'm using Guice and @Inject
> annotations
> but I don't have specified a @Default implementations (because Guice use
> @ImplementedBy).
>
> I got the following error:
>
> 25 mars 2013 20:10:27 org.apache.openejb.cdi.OpenEJBLifecycle
> startApplication
> GRAVE: CDI Beans module deployment failed
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> [com.x.persistence.ldap.LdapQueryHelper] is not found with the qualifiers
> Qualifiers: [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  ldapQueryHelper,
> Bean Owner : [XnetGroupService, Name:null, WebBeans Type:ENTERPRISE, API
> Types:[java.lang.Object,com.x.user.local.XnetGroupServiceLocal],
> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
>         at
>
> org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:77)
>
> I would like to disable CDI ; for example, I have read in Weld
> docuementation we can specify scan properties in the beans.xml. But I
> failed
> to do this.
>
> Do you have a solution to disable CDI in all of my packages ?
> Thanks by advance
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Guice-CDI-tp4661784.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>