inject « ejb « Java Enterprise Q&A

1. question on EJB and resource injection

I am having problems getting JBoss to inject an environment variable value into a bean. Here is my bean class:

package com.topcoder.test;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.ejb.EJBContext;
import javax.ejb.Remote;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.naming.Context;
import ...

2. EJB3 - obtaining bean via injection vs lookup - what are the differences, implications, gotchas?

There are two ways I know of to obtain an EJB instance:

  • dependency injection in servlets and EJBs via the @EJB annotation
  • JNDI lookup via Context.lookup anywhere
What are the differences, implications and gotchas ...

3. Injected EJB sometimes Null

I'm using a stateless EJB via the @EJB annotation... most of the time everything works as it should but it seems that from time to time what is supposed to be ...

4. problem injecting Sessionscoped bean in Managed bean

I have a Session scoped bean

public class UserData implements Serializable {

private String uid;

public String getUid() {
    return uid;

public void setUid(final String uid) {
    this.uid = ...

5. How to inject one EJB 3.1 into another EJB

I'm developping simple app where one EJB should be injected into another. I'm developping in IDEA Jetbrains IDE. But after i make @EJB annotation in Ejb local statless class my IDE ...

6. QuartzScheduler injection in JBoss AS 6

How can i inject QuartzScheduler service into my Stateless bean on JBoss AS 6 ? Quartz service does start during JBoss AS 6 startup

00:58:38,025 INFO  [QuartzScheduler] Scheduler meta-data: Quartz Scheduler ...

7. Inject logger in EJB with jboss 5

Hey guys and gals. How can i inject custom Logger in EJB i'm using jboss 5 ga.

8. Java EE, injecting one EJB into another EJB

I've encountered one issue I can't seem to figure out. I would like to inject one EJB into another like this:

public class MainEJB {


9. how to Inject an EJB into a java class

I want to inject an EJB3 into a java class which is not an EJB. these classes are both on the same server and application. Is that possible ...and if yes ..then how ...

10. Problem injecting ejb into managed bean

I've made a simple application to test this problem i'm having in small scale. I've got an ejb:

public interface PersonaDAO {
public void sayHello(Persona persona);

public class PersonaDAOImpl implements PersonaDAO {

11. EJB3.1 properties file injection

is there some simple way to inject Properties class loaded with a file from the classpath into EJB (3.1)? Something like this:

private Properties someProperties;
Thank you, Bozo

12. EJB Injection in ReSTEasy JBoss AS 7

Does anyone know if JBoss AS 7 has support for EJB injection in ReSTEasy applications per J2EE spec? I know this did not work in AS6 and was a known spec ...

13. EJB package import vs resource injection

I'm new to EJB, and there's something about resource injection that has been bugging me for a while. I guess this is a pretty basic concept, but I couldn't figure it ...

14. How to Inject a Bean with EJB 3.1 before the class constructor runs?

I have a Facade that has a persistence unit. And I need the Facade and it's dependencies initialized before the RoleController Conconstructor runs, is it possible in EJB 3.1 to do ...

15. Bean not getting injected in EJB 3.1, only this bean has this behaveour

1 and JSF 2.0 + primefaces which is cool :D And I have this validator, but I cannot get the persistence unit injected properly in it. All other beans are working properlly, this ...

16. Java Inject Applicationscope Bean

I try to inject a applicationScoped Bean. I found similar topics at JSF2 ApplicationScope bean instantiation time? and JSF - get managed bean by name With the jsf way in faces ...

17. Inject @EJB bean based on conditions

A newbie question: is there anyway that I can inject different beans based on a condition that I set in a properties file. Here's what I want to achieve: I set some ...

18. Choose EJB to be injected without recompiling

Imagine you have two implementations of a @Local interface

public interface LocalInterface {

public class MyFirstImplementation implements LocalInterface {

public class MySecondImplementation implements LocalInterface {
And I want to choose, without recompiling the project (that ...

19. Injecting EJB within JAX-RS resource on JBoss7

I'm wondering why ejb injection into JAX-RS resource (RestEasy on JBoss7) is not working. EJBs are not part of war but its own EJB jar but I supposed this should not ...

20. Unresolved ejb-ref on EJB injection

Hi, I am referring to the bug reported in glassfish. In the workaround they have mentioned to package the interfaces as another package.I would like to know how I can ...

21. Unresolved ejb-ref on EJB injection

Hi, I am referring to the bug reported in glassfish. In the workaround they have mentioned to package the interfaces as another package.I would like to know how I can ...

23. What is the effect of injecting a bean and injecting an EJB into web services?

Hello all, I was developing web service but have few questions, I did not face any problem injucting Spring bean into webservice deployed in Weblogic. But I wanted to know what is the effect of injecting spring bean to a webservice and what is the effect of injecting an EJbean to a webservice? What care should we take while doing so. ...

24. problem injecting ejb in war