cdi

Tommahawk Myfaces and CDI

Deadly 提交于 2019-12-13 05:31:09
问题 I'm having some problems using CDI with Tommahawk Myfaces when trying to create a JSF page to upload a file. Referring to this question it looks as though Tommahawk MyFaces isn't compatible with CDI but is this correct? My Bean is like this: @ManagedBean @RequestScoped public class Bean { private UploadedFile uploadedFile; public void submit() throws IOException { String fileName = FilenameUtils.getName(uploadedFile.getName()); String contentType = uploadedFile.getContentType(); byte[] bytes

Glassfish doesn't bring up EntityManager if DAO is not Stateless

谁说我不能喝 提交于 2019-12-13 04:14:50
问题 I have an EAR application with an EJB module, that contains one persistence unit and many EJBs (as service and DAO layer). @Stateless public class BranchDAO { @PersistenceContext private EntityManager entityManager; } But DAOs as Stateless beans are not recommended. So I create this annotation using CDI: @Dependent @Stereotype @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface DAO { } After my DAO is changed to not use @Stateless : @DAO public class BranchDAO {

CDI and WELD in java-web-start APP (java se)

最后都变了- 提交于 2019-12-13 04:12:18
问题 Im trying to use CDI in a Java-web-start app but get stuck at classloading. Looks like FileSystemURLHandler treats the URLs in the web-start cache as files. org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler - could not read entries java.io.FileNotFoundException: http:\localhost:8080\myapp.jar Which is the same as: https://issues.jboss.org/browse/WELD-1040 My limited skills in jira and git-hub suggests that someone started working on it, but it didnt make it into a release:

Ambiguous dependency with only one @ApplicationScoped class

為{幸葍}努か 提交于 2019-12-13 03:49:41
问题 I have one class declared this way: @ApplicationScoped public class MessageHandlerImpl implements MessageHandler { ... } and I inject it on another class like this: @ApplicationScoped public class MessageReceiverImpl implements MessageReceiver { @Inject MessageHandler messageHandler; ... } When I try to start my application I receive the following exception: org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type MessageHandler with qualifiers @Default at

How to build a plugin architecture using CDI - I'm using Wildfly 10

99封情书 提交于 2019-12-13 03:47:58
问题 I want to build a JEE plugin based architecture. The main idea is do something similar to what eclipse is, but in the context of JEE. My goal is to have a minimum of modules as the core, and allow others modules extend its functionality. To this, I have implemented a test using 4 modules: gauges: Defines and implements a gaugesregistry service, also defines a gauge POJO. cashgauges: implements a gauge producer using CDI. this is a plugin mock. othergauges: implements a gauge producer using

MyBatis CDI + Container-Managed Transaction

假装没事ソ 提交于 2019-12-13 03:45:43
问题 I would like to use mybatis with container-managed transaction in my aplication. I use mybatis 3.4.2 and mybatis-cdi 1.0.0. My code works but at the moment I open and close sessions manually and I do not know how to inject either SqlSession or Mapper to my EJB. It seems that mybatis-cdi does not do its job properly in my case. That is my deployment structure: EAR +--- commons.jar (interfaces, POJOs) +--- ejb.jar (stateless EJBs + MyBatis mapper + session factory) +--- web.war (demo servlet

Dependency Injection using CDI with Jersey with/without abstract binding

非 Y 不嫁゛ 提交于 2019-12-13 03:00:17
问题 First of all, this is not opinionated question and I have read most of related questions in SO. I am seeking advise if below implemented solution is the right approach/method. I have read many tutorials on how to implement DI in a jersey-based webapp and most of them recommend that its a must to create a beans.xml in WEB-INF/* in order to enable CDI but, I wonder if using Jersey's AbstractBinder achieve the same result? I have a jersey-webapp that has the following in web.xml <servlet>

Arquillian: Attempted to register the same Observer, ServerSetupObserver multiple times

旧街凉风 提交于 2019-12-13 02:16:06
问题 I am trying to configure arquillian with wildfly but am the following Getting error in the process of running test: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)....... Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ........... Caused by: java.lang

Wildfly 8.2 + JSF + SessionScoped : sometimes wrong data returned

我与影子孤独终老i 提交于 2019-12-13 01:26:10
问题 In one of our systems in production we encounter a very weird problem in jboss 8.2 and latest JDK 7, centos 7 64 bits, latest primefaces on javax.enterprise.context.SessionScoped beans. (No jsf annotations are used in the whole project, only CDI annotation to avoid potential conflicts) At some point in time (we don't know what triggers it) during the processing of one request the @SessionScoped bean give contradictory informations. Yet the processing occurs always in only one session and one

CDI: Injecting single instance works, but injecting Instance<> does not. Why?

不羁的心 提交于 2019-12-12 21:31:12
问题 I'm trying to implement somewhat of a "plugin feature" with the help of CDI injection. But i'm having some trouble and thought i might get some outside perspective from my fellow "Stackers" :-) I got so far that something like this works: @Inject @ScoringModule("AGE") private AgeModule ageModule; @Inject @ScoringModule("CUSTOMER_TYPE") private CustomerTypeModule customerTypeModule; When i "run" this then both fields get injected with the appropriate instances. But when i try to inject them a