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]].