i'm facing strange error while trying deploy ejb 3.1 application in jboss 7.1.1 application server: weld-001409 ambiguous dependencies type [entitymanager] qualifiers [@default] @ injection point [[parameter 1] of [constructor] @inject public br.com.sigga.siot.dao.masterdata.impl.profiledaoimpl(entitymanager)]. possible dependencies [[resource producer field [entitymanager] qualifiers [@any @default] declared [[field] @persistencecontext @produces private br.com.sigga.siot.cdi.jpaproducer.entitymanager], resource producer field [entitymanager] qualifiers [@any @default] declared [[field] @persistencecontext @produces private br.com.sigga.siot.cdi.jpaproducer.entitymanager]]]
as can see, "possible dependencies" points twice same entitymanager
producer: br.com.sigga.siot.cdi.jpaproducer.entitymanager
. field declared follows:
@persistencecontext(unitname = "siotmobility") @produces private entitymanager entitymanager;
a similar case related in weld-001409 ambiguous dependencies cannot change application server glassfish 4.1. :-)
my development environment: eclipse luna, java 7, maven 3.x (eclipse's embedded version). have 1 maven project (siot-mobility) 3 modules (siot-mobility-[ear|ejb|web]).
the ear module's pom declares following dependencies:
<dependencies> <dependency> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-web</artifactid> <version>${project.version}</version> <type>war</type> </dependency> <dependency> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-ejb</artifactid> <version>${project.version}</version> <type>ejb</type> </dependency> </dependencies>
maven ear plugin configuration:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-ear-plugin</artifactid> <configuration> <version>6</version> <defaultlibbundledir>lib</defaultlibbundledir> <modules> <webmodule> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-web</artifactid> </webmodule> <ejbmodule> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-ejb</artifactid> </ejbmodule> </modules> </configuration> </plugin>
feel free ask me more info me. :-) in advance.
error found: ejb module present twice in generated ear, once on root path of ear file , second time in web-inf/lib
folder of war file.
i changed dependency declaration in war project's pom file from:
<dependency> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-ejb</artifactid> </dependency>
to:
<dependency> <groupid>br.com.sigga</groupid> <artifactid>siot-mobility-ejb</artifactid> <scope>provided</scope> </dependency>
this way, ejb module not copied web-inf/lib
folder of war file , have 1 entitymanager
producer in generated ear file.
Comments
Post a Comment