weld

WELD-001300 when trying to lookup BeanManager by JNDI

我是研究僧i 提交于 2019-12-06 12:53:35
I configured Jetty 9.2.5 + Weld 2.2.7 (currently the latest versions) as described by the Weld documentation . Everything works fine, except the lookup of the BeanManager by JNDI. Lookup of other JNDI entries just work as expected. I got the error (note this is not a javax.naming.NameNotFoundException ) javax.naming.NamingException: WELD-001300: Unable to locate BeanManager The code I use: BeanManager beanManager = null; try { final Context ctx = new InitialContext(); try { // JNDI name defined by spec beanManager = (BeanManager) ctx.lookup("java:comp/BeanManager"); } catch

How can I enable CDI with Jersey Test Framework?

依然范特西╮ 提交于 2019-12-06 07:56:44
问题 I found How can I inject a data source dependency into a RESTful web service with Jersey (Test Framework)? but I think I'm gonna ask a little bit different question. This is a follow-up question of @PostConstruct of abstract ancestors are not invoked I wrote a JAX-RS library and I'm trying to unit-test with Jersey Test Framework. I seems HK2 injects properly. But I found some of my life cycle interceptor method annotated with @PostConstruct or @PreDestroy aren't invoked (or only some invoked)

Tomcat 7, Weld, RESTEasy not Scanning JARs

时间秒杀一切 提交于 2019-12-06 01:35:18
I have Tomcat 7.0.47 and I'm hosting a REST Easy JAXRS service. The service uses two external JARs, one that has a base repository interface and default implementation and one that creates a concrete repository derived from the base (i.e. these two JARs have a dependency). The service works, i.e. I can send a request and get back data from the database. Now what I'm trying to do is get the repository injected into the REST service, to do this I've changed the REST code to look like @Path("/country") public class CountryService { @Inject ICountriesRepository repository; @GET @Produces({

JavaEE CDI in Weld: Generic Events?

佐手、 提交于 2019-12-05 21:35:12
I have an idea for a specific event handling based on generics, but seems like Weld can't handle them. I asked google but couldn't find an alternative CDI extension for this. Question : is there a CDI extension, that can handle event propagation of generic-typed events? In the following the explicit problem I have. I have three general events, EntityCreated, EntityChanged and EntityDeleted. The base class for them is defined like this: public abstract class DatabaseEvent<TargetType> { public TargetType target; public DatabaseEvent(TargetType target) { this.target = target; } } The events then

How to bootstrap weld-se in a JUnit test

不羁岁月 提交于 2019-12-05 18:13:44
I have a maven project for unit tests and would like to use CDI. I've put the weld-se dependency in pom.xml like this : <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> </dependency> <dependency> <groupId>org.jboss.weld.se</groupId> <artifactId>weld-se</artifactId> <version>1.1.8.Final</version> </dependency> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <version>1.0-SP3</version> </dependency> I'm bootstrapping weld in a JUnit test runner : public class WeldJUnit4Runner extends BlockJUnit4ClassRunner { private

Inject producer method that returns String CDI

…衆ロ難τιáo~ 提交于 2019-12-05 02:37:35
I would like to inject constant string message to managed bean in JSF web application using CDI, here is producer class: @Named @RequestScoped public class StringProducer { @Produces @Named("message") @RequestScoped public String getMessage() { return "Hello World"; } } and here is how it is injected in another managed bean: @Inject Named("message") String message; but this always result in exception: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435 Normal scoped bean int is not proxyable I tried to wrap String type within Instance like this: @Inject Named("message")

CDI object not proxyable with injected constructor

余生长醉 提交于 2019-12-05 00:16:46
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 proxyable because it has no no-args constructor - Managed Bean [class xx.Config] with qualifiers [@Default @Named @Any]. at org.jboss.weld.bean.proxy.DefaultProxyInstantiator.validateNoargConstructor(DefaultProxyInstantiator.java:50) at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:217) at org.jboss.weld.util.Proxies

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

。_饼干妹妹 提交于 2019-12-04 20:57:13
问题 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) org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435: Normal scoped bean class webapp.util.LoginManagerAction is not proxyable because it has no no-args constructor - <unknown javax.enterprise.inject.spi.Bean instance>. at org.jboss.weld.bean.proxy

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

点点圈 提交于 2019-12-04 17:51:43
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("Cough cough vrummmmm"); } public void stop() { System.out.println("Phhhut clank"); } } Car.java public

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

喜夏-厌秋 提交于 2019-12-04 16:38:03
问题 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 IllegalStateException after 'successful' deploying and running the app via the browser: org.jboss.weld.exceptions.IllegalStateException: WELD-000227: Bean identifier index inconsistency detected - the distributed container probably does not work with identical