jboss-weld

integrating GWT with CDI (Seam/Weld)

倖福魔咒の 提交于 2019-12-12 20:30:24
问题 What's the best way to integrate CDI with GWT? In particular, I'd like to know how to make dependency injection work for my RemoteServiceServlet extensions. Apparently CDI won't work with classes derived from javax.servlet.Servlet. I'm happy to ditch RemoteServiceServlet if there is an alternative. I don't really need DI on the GWT client-side, but would happily use it if it Just Worked. 回答1: It turns out to be a bug in Weld, which is already fixed in version 1.1.0. Intellij IDEA X also has

How to inject ConversationScoped beans in a Servlet

雨燕双飞 提交于 2019-12-12 12:16:43
问题 I need to inject a ConversationScoped bean into a servlet. i use the standard simple @Inject tag and I invoke the servlet with the cid parameter but when it invokes any method in the injected bean I get the following error: org.jboss.weld.context.ContextNotActiveException : WELD-001303 No active contexts for scope type javax.enterprise.context.ConversationScoped Can I inject these beans in servlets or I can inject only Session and Request scoped beans? 回答1: In a servlet the context is

Jetty: adding <resource-env-ref> programmatically

心已入冬 提交于 2019-12-12 09:18:38
问题 I have a standalone application with embedded Jetty and Wicket. I'd like to use CDI for injection. So I've found http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#d0e5286 and now I'm trying to add this programatically, but it's quite complex. How do I code that? Other sources I've found are: http://osdir.com/ml/java.jetty.support/2007-02/msg00198.html http://docs.codehaus.org/display/JETTY/JNDI So far I have: Server server = new Server( 8080 ); Context ctx = new Context

How to discover a CDI producer in a WAR context?

房东的猫 提交于 2019-12-12 03:54:30
问题 I'm stuck with a CDI problem. I've deployed a war that contains various jars in its WEB-INF/lib folder. One of those jars has a Logger producer (a class with a method which is annotated with @Produces ) and some custom qualifier annotations, some other jars have classes where I want to use the qualifiers and inject Loggers. The idea was to avoid code duplication. But now, to my surprise, WELD complains during deployment, that it has unsatisfied dependencies for the Logger. It looks like, the

SocketException in Java EE 6 application

*爱你&永不变心* 提交于 2019-12-11 23:22:23
问题 I get the following exception seemingly at random on several occations per day in production environment, and it's starting to bother me. I never get it while developing soi I have a hard time deciding the cause. Does anyone know what the cause might be? I've searched around on the exception without really finding anything useful. 2011-12-0808:18:51,311VARNING[javax.enterprise.resource.webcontainer.jsf.application](http-0.0.0.0-80-16)JSF1064:Unable to find or serve resource,jquery/ui/jquery

Wildfly 14 CDI: WELD-001408 on 3rd part JAR after migration from JBoss 7

跟風遠走 提交于 2019-12-11 18:28:54
问题 We are migrating a few old systems written in Java 5, 6 and 7 to Java 8 and from JBoss 7 to Wildfly 14. After the migration, I get all the time this kind of error: WELD-001408: Unsatisfied dependencies for type InterfaceTypeConverterProvider with qualifiers @Named I understand that from CDI 1.2 things changed and the @Inject don't work as it used to be and it need some refactoring. I got many errors like this, some of them are classes in my own project that try to Inject other classes also

JBoss Weld CDI : Inject the same instance in two different Objects

谁说胖子不能爱 提交于 2019-12-11 06:24:54
问题 I have two basis class A and B . B is injected in A . I have a third class C injected in A and B , as follow : class A { @Inject B b; @Inject C c; } class B { @Inject C c; } class C { } I'd like the instance of C contained in A and in B is the same. I could use a setC() method in B , but that's not at all the philosophia of injection. Should I use Weld scopes ? If yes, how should I do ? Thanks 回答1: The solution is simply annotate my classes and injections with @Singleton Annotation class A {

Use @EJB as injection annotation in Weld

被刻印的时光 ゝ 提交于 2019-12-11 05:32:20
问题 I have an application which is part JavaEE (the server side) part JavaSE (the client side). As I want that client to be well architectured, I use Weld in it to inject various components. Some of these components should be server-side @EJB. What I plan to do is to extend Weld architecture to provide the "component" allowing Weld to perform JNDI lookup to load instances of EJBs when client tries to reference them. But how do I do that ? In other worrds, I want to have on the client side public

Weld CDI on Google App Engine: Injection in servlet not happening

自闭症网瘾萝莉.ら 提交于 2019-12-11 04:00:05
问题 This is my first time working with GAE and I'm trying to get CDI working. Long story short: The @Inject field in my servlet is not getting injected (it's always null ). I'm working in Eclipse and debug the application on the local test server included in the GAE SDK (which is started by Eclipse as well). When I access the servlet on localhost , I get a null-pointer exception for someService . I've also output the value of someService to verify it is really null , which it is. Edit: When I

How to programmatically lookup and inject a CDI managed bean where the qualifier contains the name of a class

血红的双手。 提交于 2019-12-11 03:59:25
问题 I am trying to programmatically lookup and inject a CDI managed bean where the qualifier contains the name of a class (not the class I want to inject), however the problem I've got is that the code I'm using to lookup the correct bean always returns with null . The beans I want to inject are annotated with a custom annotation called @CQRSCommandHandler which contains the name of a class being used as a qualifier and the beans also implement an interface called CommandHandler . The classes I'm