How to add a portable CDI extension programmatically?

Examples for creating a portable CDI Extension (like this) all use the javax.enterprise.inject.spi.Extension extension point to allow the ServiceLoader to load the Extension. Is there a Weld/CDI API/SPI to register the Extension dynamically, programm

NullPointerException of EJB injected into the servlet

Where does the NullPointerException reported in the Glassfish log originate? The ConverterServlet seems to have dollar as a BigInteger number, non-null. If ConverterBean would simply log the dollar amount that would be at least a step in the right di

How to propagate the same instance using CDI

I have a web application with JAX-RS, CDI and EJB. In each resource I inject a Stateless SessionBean, and my question is whether it is possible to inject the same instances into a provider of JAX-RS and the Stateless SesionBean. I am trying to pass s

Transactional CDI Bean Does Not Save Record in Database

I am trying to build a simple REST service, using JAX-RS, that will perform the standard CRUD operations on a database table. I am able to successfully query for records, but I cannot insert new ones. I do not get any errors and when I step through t

Java EE 7 CDI Manual Instantiation

I have a Class with fields annotated with @Inject. I instantiate the Class using reflection, but I want the CDI to inject instances to do the Class instance fields. Is there a way of doing it? Object myInstanceWithDependecies = Class.forName("com.pac

@Inject can not initialize the object

I am using tomee server to run my javaEE app. I have written a filter which injects an object. However the object does not seem to get instantiated : Following is my code : Filter.java @Priority(value = 2) @Provider @Singleton public class Filter imp

When is the injected bean actually initialized?

I have the following scenario in my code base: //this bean, which will be injected, //is not annotated public class HelperUtil { //only default constructor with no args public void doThis(String _in) { //... } public void doThat() { //... } } In the

Dynamic data loading based on a session attribute

I'm trying to dynamically load dataSet accordingly to an user session attribute, which I inject and set it as a parameter in a namedQuery. The namedQuery works fine, but I'm not getting the dataSet as desired. I mean, when the session attribute is 98

CDI: WELD-001408 Unsatisfied dependencies, how to solve 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 Enti

Logger, convert from @Inject to producer

I am having trouble implementing a Login interface like the example Simple CRUD Web Application with JSF 2.1, PrimeFaces 3.5, EJB 3.1, JPA (ORM) / EclipseLink, JAAS , MySQL On TomEE's mailing list, I have been told that the LoginController.java I am

Failed to deploy CDI: WELD-001414 The bean name is ambiguous

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

@ Zero injection value in @FacesComponent

I have the impression that CDI is not working with classes that have a @javax.faces.component.FacesComponent. Is this true? Here's my example, that doesn't work. The MyInjectableClass is used at other points in the code where injection is not a probl

Deploying multiple dependent CDI bugs in an EAR file

i have a question about how to deploy multiple jars which contains CDi implementations together with a webapp. This is my Jar Structure -------- ---------- ------------ | WAR | <-- | API Jar | <-- | Data Jar | -------- ---------- ------------ ^ | --

Transaction Management and CDI

I would like to develop an application with CDI (I use Spring usually) to discover this technology. I have read many articles about CDI to learn how it works. I have a simple question about transaction management (for persistence in database for exam

What do you need for CDI capacity in a JSF project?

I have a JSF project targeted on WebSphere Application Server 8 and I tried to use the CDI concept. I have a /WEB-INF/beans.xml like: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://java.sun.com/xml/ns/javaee&

Scoped Bean conversation for the same view

I have a DTO which has a list. I want to add new rows to datatable when user clicks add button. But when I click add the dto i.e constructor is called and value is initialized and list size is 0. The bean is conversation scoped. Should I start and en

How to make Primefaces work with @ConversationScoped beans?

I build a short page with JSF-Compnents which displays and increments a value from a @ConversationScoped Bean. This page is able to end the Conversation and is getting a new Bean after ending the old Conversation. Here is what it looks like: <!DOCTYP

Conversation Scope in Resource Manager in JSF?

I have a Resource Handler that needs to access lower level beans that work in conversation scope. Our application allows multiple login sessions on different browser tabs working within the same browser session by keeping the login details at this sc

Can not convert ejbRef to ejb

QuestionCommonBusiness public interface QuestionCommonBusiness { void create(Question question); void update (Question question); void delete(Question question); Question read(Integer id); List<Question> all(); } QuestionLocalBusiness public interfa

Glassfish 3.1.1 CDI Classloader delegate false

My main problem is that I want to use myfaces jsf implementation and because of that, I have to use delegate=false in glassfish-web.xml. This ends up in loading classes from my application first and then look at the server libraries. When I use hiber

GWT RequestFactory: how to use unique EntityManager per query

In order to get RequestFactory to persist attached entities, I need to ensure that I use the same EntityManager for each request. I cobbled together my own Factory class for this based on a ThreadLocal implementation, but I'm unsure how to properly r