Questions tagged [weld]

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

See http://seamframework.org/Weld

592 questions
39
votes
6 answers

How to programmatically inject a Java CDI managed bean into a local variable in a (static) method

How can I programmatically inject a Java CDI 1.1+ managed bean into a local variable in a static method?
XDR
  • 4,070
  • 3
  • 30
  • 54
23
votes
4 answers

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

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…
Scandinave
  • 1,388
  • 1
  • 17
  • 41
17
votes
2 answers

Why do I need a no-args constructor to use ApplicationScoped beans with Constructor injection within CDI?

I'm trying to apply the constructor injection pattern to beans in my CDI application and am encountering the following error message: 15:18:11,852 ERROR [izone.adams.webapp.error.IzoneExceptionHandler] (default task-40)…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
16
votes
1 answer

What is the relationship between Weld and HK2

This might be a silly question, but I am puzzled by it and I could not find any clear explanation anywhere. HK2 is a dependency injection framework implementing JS330, the foundation of Glassfish V3 and V4. As far as I can see it is used by…
user2465039
  • 894
  • 1
  • 11
  • 28
15
votes
5 answers

CDI object not proxyable with injected constructor

When trying to inject arguments into the constructor of a CDI bean (ApplicationScoped), I'm encountering the following issue: Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435: Normal scoped bean class xx.Config is not…
Steven De Groote
  • 2,187
  • 5
  • 32
  • 52
15
votes
4 answers

How to avoid BusyConversationException in jsf

I'm getting BusyConversationException while navigating through pages in my jsf project. This mostly happens if the user tries to navigate to another page during an ajax call. This also happens when the user clicks on a link right after clicking on…
cubbuk
  • 7,800
  • 4
  • 35
  • 62
14
votes
1 answer

org.jboss.weld.exceptions.IllegalStateException: WELD-000227 after every change in code

I'm developing a webapp with NetBeans and Glassfish 4.1.1. and I'm using JSF and CDI to manage the backing beans for the facelets. Since shortly after changing anything in the code I always get an Internal Server Error with this…
BenSkeleton
  • 153
  • 2
  • 6
14
votes
3 answers

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

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 …
Tony
  • 2,266
  • 4
  • 33
  • 54
13
votes
3 answers

CDI Ambiguous dependency with @Produces - why?

I am using code like below: public Configuration { private boolean isBatmanCar = someMethod(...); @Produces public Car getCar(@New Car car) { if(isBatmanCar) { car.setName("BatmanCar"); } return…
Dariusz Mydlarz
  • 2,940
  • 6
  • 31
  • 59
12
votes
2 answers

CDI beans inside .jar are not found by the container (Unsatisfied dependencies)

I have created a Java project to serve as a lib to other projects, reducing code duplication between projects. This lib project is exported to jar to be included in Web projects (WAR, not EAR). In Web projects (where these classes are being removed)…
Renan Baggio
  • 411
  • 1
  • 4
  • 11
12
votes
1 answer

How to inject EntityManager in CDI (weld)?

In my project , I use JSF+JPA+CDI+WildFly 8.2 in the persistence layer. I have a BasicDao , like this: public class BasicDao { private org.jboss.logging.Logger logger = org.jboss.logging.Logger .getLogger("BasicDao"); …
SuperChia
  • 131
  • 1
  • 1
  • 4
11
votes
1 answer

How to hunt down obscure HA clustering bug in Wildfly 8.2.0.Final

The setup I have a Wildfly 8.2.0.Final application server running a cluster in domain mode using the full-ha profile. The cluster consists of two instances of wildfly, master and slave, each running on its own virtual machine. The application My…
noamik
  • 756
  • 6
  • 22
11
votes
2 answers

When is a @Dependent scoped CDI bean destroyed, if you obtain that bean via Provider.get()?

I am struggling to understand the effective lifecycle of a @Dependent scoped bean in both CDI 1.0 and CDI 1.1. My experiments so far have lead me to the following conclusions: A @Dependent scoped bean is not proxied. No @PreDestroy method is…
Chris Rankin
  • 256
  • 1
  • 3
  • 10
11
votes
3 answers

How to disable WELD on WildFly

How to fully disable WELD on WildFly. I don't need it, because I use another DI framework. Exception 0 : javax.enterprise.inject.UnsatisfiedResolutionException: Unable to resolve a bean for 'org.springframework.data.mongodb.core.MongoOperations'…
Rinat Mukhamedgaliev
  • 5,401
  • 8
  • 41
  • 59
10
votes
4 answers

@PostConstruct is not invoked for @ApplicationScoped on initialisation?

I have faced with the following issue. I am using Weld implementation of the CDI. I have found that if a service is annotated with @ApplicationScoped then @PostConstruct section is not invoked until the first usage of the service. Here is a code to…
Andremoniy
  • 34,031
  • 20
  • 135
  • 241
1
2 3
39 40