igniterealtime / REST-API-Client

Java REST API Client for the Openfire to manage Openfire instances by sending an REST/HTTP request to the server
Apache License 2.0
102 stars 62 forks source link

java.lang.IllegalStateException: InjectionManagerFactory not found. #29

Closed evgenyh closed 6 years ago

evgenyh commented 6 years ago

java.lang.IllegalStateException: InjectionManagerFactory not found. at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98) at java.base/java.util.Optional.orElseThrow(Optional.java:397) at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98) at org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:68) at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:432) at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:341) at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:826) at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:285) at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:143) at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:112) at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:108) at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:99) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:456) at org.igniterealtime.restclient.RestClient.call(RestClient.java:148) at org.igniterealtime.restclient.RestClient.post(RestClient.java:93) at org.igniterealtime.restclient.RestApiClient.createUser(RestApiClient.java:104)

Redor commented 6 years ago

Do you use jersey somewhere else in your code? (it seems to conflict with that)

evgenyh commented 6 years ago

no. it not conflict with another jersey, but declared jersey in pom of this lib have problems with java 10. I fixed this by forcing specific versions of these deps.

Redor commented 6 years ago

May I ask, which version do you use for Java 10?

evgenyh commented 6 years ago
<dependency>
            <groupId>org.igniterealtime</groupId>
            <artifactId>rest-api-client</artifactId>
            <version>1.1.4</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.hk2.external</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
evgenyh commented 6 years ago
org.glassfish.jersey.inject jersey-hk2 ${jersey.version} org.glassfish.hk2.external javax.inject javax.annotation javax.annotation-api org.javassist javassist
evgenyh commented 6 years ago
2.26
evgenyh commented 6 years ago

overall, it would be great to get rid of jersey as transport as it dragging with it tons of irrelevant transitive deps.

Redor commented 6 years ago

Thy @evgenyh

maciejfranek commented 4 years ago

Same happened me for scala/spark versions: scalaVersion=2.12.9 sparkVersion=2.4.5

With openJDK 1.8.

In my case following exclusion was sufficient:

    implementation("org.glassfish.jersey.inject:jersey-hk2:2.27") {
        exclude group: 'org.glassfish.hk2.external', module: 'javax.inject'
    }
evgenyh commented 4 years ago

OMG :) this is 2.5 y.o thread & according to your info, your dependencies is a waaaay outdated.

apratim19 commented 3 years ago

I am having this same problem while invoking Datadog API from AWS Lambda. I have tried these solutions, but no luck. Can it be because of how AWS Lambda loads Classes? NOTE: The same works when I run the function from a TEST class from within my IDE.

Any suggestions please?


  | 2021-05-03T23:58:12.412-04:00 | java.lang.IllegalStateException: InjectionManagerFactory not found.
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98)
  | 2021-05-03T23:58:12.412-04:00 | at java.util.Optional.orElseThrow(Optional.java:290)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:68)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:432)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:341)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:826)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:285)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:143)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:112)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:108)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:99)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:445)
  | 2021-05-03T23:58:12.412-04:00 | at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:351)
  | 2021-05-03T23:58:12.412-04:00 | at com.datadog.api.v1.client.ApiClient.sendRequest(ApiClient.java:1476)
  | 2021-05-03T23:58:12.412-04:00 | at com.datadog.api.v1.client.ApiClient.invokeAPI(ApiClient.java:1435)
  | 2021-05-03T23:58:12.412-04:00 | at com.datadog.api.v1.client.api.MetricsApi.submitMetricsWithHttpInfo(MetricsApi.java:533)
  | 2021-05-03T23:58:12.412-04:00 | at com.datadog.api.v1.client.api.MetricsApi.submitMetrics(MetricsApi.java:476)
  | 2021-05-03T23:58:12.412-04:00 | at com.koddi.raw.beacon.metric.statsD.DataDogHttpMetricsApi.$anonfun$send$1(DataDogHttpMetricsApi.scala:115)
  | 2021-05-03T23:58:12.412-04:00 | at scala.util.Try$.apply(Try.scala:213)
  | 2021-05-03T23:58:12.412-04:00 | at com.koddi.raw.beacon.metric.statsD.DataDogHttpMetricsApi.send(DataDogHttpMetricsApi.scala:115)
  | 2021-05-03T23:58:12.412-04:00 | at com.koddi.raw.beacon.metric.application.EventHandler.pushStats(EventHandler.scala:102)
  | 2021-05-03T23:58:12.412-04:00 | at com.koddi.raw.beacon.metric.application.SnsEventHandler.handle(SnsEventHandler.scala:67)
  | 2021-05-03T23:58:12.412-04:00 | at com.koddi.raw.beacon.metric.SnsLambdaHandler.handleRequest(SnsLambdaHandler.scala:27)
  | 2021-05-03T23:58:12.412-04:00 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 2021-05-03T23:58:12.412-04:00 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  | 2021-05-03T23:58:12.412-04:00 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  | 2021-05-03T23:58:12.412-04:00 | at java.lang.reflect.Method.invoke(Method.java:498)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:263)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:180)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:902)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:340)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:63)
  | 2021-05-03T23:58:12.412-04:00 | at java.lang.Class.forName0(Native Method)
  | 2021-05-03T23:58:12.412-04:00 | at java.lang.Class.forName(Class.java:348)
  | 2021-05-03T23:58:12.412-04:00 | at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:150)