Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Jersey missing explicit dependency on javax.annotation #3767

Open
cowwoc opened this issue Feb 1, 2018 · 4 comments
Open

Jersey missing explicit dependency on javax.annotation #3767

cowwoc opened this issue Feb 1, 2018 · 4 comments

Comments

@cowwoc
Copy link

cowwoc commented Feb 1, 2018

When using Jersey client under Java 9 I get:

java.lang.NoClassDefFoundError: javax/annotation/Priority
	at org.glassfish.jersey.model.internal.RankedProvider.computeRank(RankedProvider.java:111)
	at org.glassfish.jersey.model.internal.RankedProvider.<init>(RankedProvider.java:72)
	at org.glassfish.jersey.internal.inject.Injections.lookupService(Injections.java:113)
	at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:97)
	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:445)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:351)

My dependencies are:

		<dependency>
			<groupId>org.glassfish.jersey.core</groupId>
			<artifactId>jersey-client</artifactId>
			<version>2.26</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.inject</groupId>
			<artifactId>jersey-hk2</artifactId>
			<version>2.26</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.media</groupId>
			<artifactId>jersey-media-json-jackson</artifactId>
			<version>2.26</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.connectors</groupId>
			<artifactId>jersey-jetty-connector</artifactId>
			<version>2.26</version>
		</dependency>

Jersey should depend on javax.annotation instead of assuming it will be provided.

@cowwoc
Copy link
Author

cowwoc commented Feb 1, 2018

See https://github.com/jersey/jersey/issues/3712 for a related discussion.

@chkal
Copy link

chkal commented Mar 31, 2018

I think that adding this dependency will lead to many problems for JDK8 users. Why don't you just add this dependency to your pom?

@cowwoc
Copy link
Author

cowwoc commented Mar 31, 2018

@chkal I tried but never did manage to get this working. If Jersey 2.26 is usable on JDK 9 and 10, the steps should be documented somewhere. I suspect some actual code changes will be required, aside from documentation.

@chkal
Copy link

chkal commented Apr 1, 2018

AFAIK the Java EE related packages aren't visible to your application by default. Perhaps you could have a look here to see if this helps:

https://blog.codefx.org/java/java-9-migration-guide/#Dependencies-On-Java-EE-Modules

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

No branches or pull requests

2 participants