0
votes

I have peculiar issue with CDI. Application deployed on glassFish 3.0.1

The scenario is as below

Maven proj1 :: My jax-rs code has EJB(through interface) injection along with Qualifier

class A_jaxrs{

@Inject @Demo
  DemoManager demoManager;

}

Maven proj2 :: All the interface are defined in project2 along with the qualifier

class interface DemoManager{
}

@Qualifier
public @interface Demo{
}

Maven proj3 :: Stateless bean is defined

@Demo
@Stateless
class DemoManagerBean implements DemoManager{

@Override
public void demoString() {
    System.out.println("Year 2014");
}

}

Empty beans.xml is included in all the projects All the projects(as jars) are packaged within the ear

But my ear deployment fails with injection failure.....

Netbeans also reports Unsatisfied dependency error at injection point

Any help ? However the same scenario works with @Ejb("...")

1
Do you need to use an EAR? Can you deploy a WAR with the same JARs in it?John Ament

1 Answers

0
votes

At first, why do you use so old version of Glassfish? It has a lot of bugs. Couldn't you use more recent one? Like 4.0?

Secondly your qualifier annotation is wrong, it should be:

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
public @interface Demo{
}