weld

CDI Producer and Injection

十年热恋 提交于 2019-12-22 07:01:20
问题 i want to use a producer in my application but i'm stuck at the point, where i'm trying to inject the bean. im getting the famous WELD-001409 error. please lighten up my understanding of cdi producer. here's my interface: @Named public interface MessageSender { void sendMessage(); } the bean: public class EmailMessageSender implements MessageSender { @Override public void sendMessage() { System.out.println("Sending email message"); } } and the producer: @SessionScoped public class

Weld using alternative producer from src/test/META-INF/beans.xml

≯℡__Kan透↙ 提交于 2019-12-21 21:34:24
问题 I am trying to use Weld SE 2.3.0.Final to swap an alternative implementation of an injected dependency during testing by supplying a different beans.xml in src/test/resources/META-INF It always seems to use the main version of beans.xml though and I'm not sure why. First of all here are the supporting classes Engine.java public interface Engine { void start(); void stop(); } DefaultEngine.java @Vetoed public class DefaultEngine implements Engine { public void start() { System.out.println(

Is it possible to inject EJB implementation and not its interface using CDI?

元气小坏坏 提交于 2019-12-20 09:37:32
问题 My configuration is: Wildfly 8.2.0, Weld Is it possible to inject in bean and not in its interface in CDI ? @Stateless class Bean implements IBean { ... } interface IBean { ... } @SessionScoped class Scoped { @Inject Bean bean; //Fail @Inject IBean iBean; //OK } EDIT : More Info in my previous question: Stateless EJB implements interface injection failed 回答1: Yes you can, but as EJB inject the business view the only business view you are exposing is the @Local view which is the default when

WELD-001519 An InjectionTarget implementation is created for an abstract class 'xxx'. It will not be possible to produce instances of this type

只谈情不闲聊 提交于 2019-12-19 19:53:10
问题 I'm running an application in the following environment. GlassFish Server 4.0 Mojarra 2.2.4 PrimeFaces 4.0 final PrimeFaces Extension 1.1.0 OmniFaces 1.6.3 After adding OmniFaces, the following warnings appear on the server terminal. WARNING: WELD-001519 An InjectionTarget implementation is created for an abstract class org.omnifaces.eventlistener.DefaultServletContextListener. It will not be possible to produce instances of this type! WARNING: WELD-001519 An InjectionTarget implementation is

CDI deployment failure:WELD-001414 Bean name is ambiguous

我只是一个虾纸丫 提交于 2019-12-19 06:22:13
问题 I have an application, which has multiple modules and various dependencies. When I deploy the application on Glassfish 4, I am getting error: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name JerseyClassAnalyzer resolves to beans: [Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default @Named @Any], Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default

CDI deployment failure:WELD-001414 Bean name is ambiguous

时光总嘲笑我的痴心妄想 提交于 2019-12-19 06:21:44
问题 I have an application, which has multiple modules and various dependencies. When I deploy the application on Glassfish 4, I am getting error: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name JerseyClassAnalyzer resolves to beans: [Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default @Named @Any], Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default

CDI : WELD-001408 Unsatisfied dependencies, how to resolve it?

一个人想着一个人 提交于 2019-12-18 18:48:09
问题 I do a small test project with CDI. My application is composed of an EJB EAR and WAR, all deployed on Glassfish 4. I'm using Hibernate 4.3.4 to access the database. My goal is to verify that a class in an EJB (DAO) can receive an injection of an EntityManager. The pattern SessionBean + EJB is not fantastic but I have to modify an application already created so I do not have much choice. Here is my code of the EJB: @Named public class DAOTest implements Serializable { private static final long

How to inject EntityManager in CDI (weld)?

南笙酒味 提交于 2019-12-18 13:08:21
问题 In my project , I use JSF+JPA+CDI+WildFly 8.2 in the persistence layer. I have a BasicDao , like this: public class BasicDao<M, K> { private org.jboss.logging.Logger logger = org.jboss.logging.Logger .getLogger("BasicDao"); @Inject @Primary protected EntityManager em; Class<M> mclass; public EntityManager getEm() { return em; } public void setEm(EntityManager em) { this.em = em; } @Transactional(value=TxType.NOT_SUPPORTED) public M find(K id){ return em.find(mclass, id); } @Transactional

How Catch WELD-001303 Faces Flow

匆匆过客 提交于 2019-12-13 15:44:58
问题 I'm studying the flow faces and implemented something similar as described in http://en.kodcu.com/2013/08/jsf-2-2-use-faces-flow/ have difficulty after leaving the flow if I use the browser back button and click on a button the previous page I get the exception WELD-001303 No active contexts for scope type javax.faces.flow.FlowScoped . Does this happen because the flow has already been destroyed? Is there any possibility of treating this error? Or should I simply redirect to a page when

CDI Transactional Interceptor not working

拥有回忆 提交于 2019-12-13 15:23:57
问题 I have a Java SE application with these classes: main: public static void main(String args[]) { Weld weld = new Weld(); WeldContainer container = weld.initialize(); ShopCar sc = container.instance().select(ShopCar.class).get(); sc.execute(); weld.shutdown(); } My DAO(not fully implemented): /** * * @author vFreitas * @param <T> The type T */ public class JpaDAO<T> implements DAO<T>, Serializable { /* The EntityManager of my connection */ private final EntityManager em; /* The class to be