javaee / jersey

This is no longer the active Jersey repository. Please see the README.md
http://jersey.github.io
Other
2.86k stars 2.35k forks source link

hk2-cdi bridge doesn't work correkt #3427

Open glassfishrobot opened 8 years ago

glassfishrobot commented 8 years ago

( With maven i use

<dependency>
        <groupId>org.glassfish.jersey.containers.glassfish</groupId>
        <artifactId>jersey-gf-cdi</artifactId>
        <version>2.14</version>
</dependency>

)

If i register a concrete resource class, injection works correct e.g.:

ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.register(RootResource.class);
public class RootResource  
 {
  @Inject
  @SimpleDb(value="mariadb")
  private EntityManager em; 

  @GET
  @Produces({ "text/plain" })
  public final String getValue()
   {
     ...............................

But now, i load a resource class dynamically, with

c = Class.forName(.....);
and register ist with
resourceConfig.register(c);

or

resourceConfig.registerInstances(c.newInstance());

But, it doesn't work and crashes with error

Unknown HK2 failure detected: MultiException stack 1 of 1 org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl .......................

Have u overseen something, or is it not possible to use such anonymous classes?

Environment

Java SE 1.8.0_92-b14 Windows 7

Affected Versions

[2.14]

glassfishrobot commented 8 years ago

Reported by Adi9999

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JERSEY-3155