Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: InjectionManagerFactory not found in Springboot application #124

Open
prajaktaNextdoor opened this issue Jun 3, 2021 · 0 comments

Comments

@prajaktaNextdoor
Copy link

Hi, I am trying to use the 'qds-sdk-java' maven dependency in my Spring-Boot application. But I keep running into the following error when InvokableBuilder.invoke() method to run a query in qubole.

java.lang.IllegalStateException: InjectionManagerFactory not found.
	at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory$0(Injections.java:98)
	at org.glassfish.jersey.internal.inject.Injections$$Lambda$988/000000007A83F720.get(Unknown Source)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	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.client.ClientConfig$State$$Lambda$978/000000005992E220.get(Unknown Source)
	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$AsyncInvoker.method(JerseyInvocation.java:740)
	at com.qubole.qds.sdk.java.details.QdsClientImpl.invokePreparedRequest(QdsClientImpl.java:163)
	at com.qubole.qds.sdk.java.details.QdsClientImpl.invokeRequest(QdsClientImpl.java:153)
	at com.qubole.qds.sdk.java.details.InvocationCallbackBase.invoke(InvocationCallbackBase.java:58)

I have tried adding the following dependencies.

<dependency>
            <groupId>org.glassfish.jersey.inject</groupId>
            <artifactId>jersey-hk2</artifactId>
            <version>2.27</version>
        </dependency>

<dependency>
            <groupId>com.qubole.qds-sdk-java</groupId>
            <artifactId>qds-sdk-java</artifactId>
            <version>1.3.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.amazonaws</groupId>
                    <artifactId>aws-java-sdk</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.jersey.core</groupId>
                    <artifactId>jersey-common</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.jersey.core</groupId>
                    <artifactId>jersey-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.hk2.external</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

But that did not help.

I even tried adding the maven shade plugin. with or without the added dependency for 'org.glassfish.jersey.inject'.

<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>
                                    _**<<ABSOLUTE_PATH_TO_MY_MAIN_CLASS>>**_
                                </mainClass>
                            </transformer>
                        </transformers>
                        <createDependencyReducedPom>
                            false
                        </createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Then I get the following error during mvn clean install:

Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.2:shade (default) on project <<XYZ>>: Error creating shaded jar: error in opening zip file ~/.m2/repository/com/almworks/sqlite4java/libsqlite4java-linux-i386/1.0.392/libsqlite4java-linux-i386-1.0.392.so

Then I tried using the maven assembly plugin by removing the problematic dependencies from org.glassfish.jersey.inject.

<dependency>
            <groupId>org.glassfish.jersey.inject</groupId>
            <artifactId>jersey-hk2</artifactId>
            <version>2.27</version>
            <exclusions>
                <exclusion>
                    <groupId>com.almworks.sqlite4java</groupId>
                    <artifactId>libsqlite4java-osx</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.almworks.sqlite4java</groupId>
                    <artifactId>libsqlite4java-linux-i386</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

<dependency>
            <groupId>com.qubole.qds-sdk-java</groupId>
            <artifactId>qds-sdk-java</artifactId>
            <version>1.3.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.amazonaws</groupId>
                    <artifactId>aws-java-sdk</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.jersey.core</groupId>
                    <artifactId>jersey-common</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.jersey.core</groupId>
                    <artifactId>jersey-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish.hk2.external</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

<build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>debug.JanusClient</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <warName><<NAME_OD_PROJECT>></warName>
                    <outputDirectory>target</outputDirectory>
                </configuration>
            </plugin>
            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                    <configuration>
                        <forkMode>once</forkMode>
                    </configuration>
            </plugin>
.....
</build>

But this gives me the original error I started with:

java.lang.IllegalStateException: InjectionManagerFactory not found.

Could you please advise?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant