0

Like many others, I've experienced issues deploying Jersey webapps onto Glassfish 4.0. I've scoured similar postings but have not found anything that resolved the deployment errors I've been seeing.

The apps I'm trying to deploy/run did so successfully on Glassfish 3.1.

I decided to start from scratch with a simple Jersey app and start building on top of that. So I started with the Maven archetype referenced at https://jersey.java.net/documentation/latest/getting-started.html#new-webapp.

I ran the provided mvn command line to create the archetype project. I then modified the pom.xml's maven-compiler-plugin configuration values to be 1.7 (instead of 1.6) for source and target.

Built the application, deployed to Glassfish 4.0 (build 89), and received the following error

WELD-001408 Unsatisfied dependencies for type [Ref] with qualifiers >>[@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.server.internal.routing.UriRoutingContext(Ref, ProcessingProviders)]

This error is typical of the errors I'm seeing with my original applications. I interpret the error to mean that CDI was unsuccessful at injecting a Ref<ContainerRequest> parameter somewhere in the guts of Jersey.

What is the solution to these types of errors? This is a very simple Jersey webapp. It has a single Resource class with a single @GET method that returns a hardcoded string. There is no CDI involved in the application code itself.

additional info
Changing the POM's jersey.version from the original 2.5 to 2.0 results in

WELD-001414 Bean name is ambiguous. Name JerseyClassAnalyzer resolves to beans [Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default @Named @Any], Managed Bean [class org.glassfish.jersey.internal.inject.JerseyClassAnalyzer] with qualifiers [@Default @Named @Any]].

samseven
  • 33
  • 1
  • 6

2 Answers2

0

If you are not using CDI in your application you can get around this problem by deploying like this:

asadmin deploy --property implicitCdiEnabled=false

I think this is only a work-around solution though, as in general you should be able to include Jersey in your application without having this problem

jwells131313
  • 2,364
  • 1
  • 16
  • 26
0

After stopping and restarting the server, the archetype application deployed (and ran) successfully. (Did this via the admin console. In other words, deployment was successful even without setting implicitCdiEnabled to false). Apparently the server was in a corrupt state, but this was unexpected as the application had never completed a successful deployment.

samseven
  • 33
  • 1
  • 6