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

Jersey missing explicit dependency on javax.annotation #3767

Open
jerseyrobot opened this issue Feb 1, 2018 · 5 comments
Open

Jersey missing explicit dependency on javax.annotation #3767

jerseyrobot opened this issue Feb 1, 2018 · 5 comments

Comments

@jerseyrobot
Copy link
Contributor

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.

@jerseyrobot
Copy link
Contributor Author

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

@jerseyrobot
Copy link
Contributor Author

@chkal Commented
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?

@jerseyrobot
Copy link
Contributor Author

@cowwoc Commented
@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.

@jerseyrobot
Copy link
Contributor Author

@chkal Commented
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

@jerseyrobot
Copy link
Contributor Author

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