
Outro dia testei executar o Jersey 2.0 no Glassfish 4.0 e o servidor não conseguia identificar as rotas que eu especifiquei no web.xml e @Path nas classes dos recursos. Navegando na web em buscas de respostas encontrei isso:
Unfortunately, in case you are playing with the GlassFish 4.0 release (build 4.0-b89) there is a task you may want to do in order to get the released Jersey 2.0 version installed in your GlassFish instance. The version of Jersey 2.0 bundled with the released GlassFish 4.0 (4.0-b89) and Java EE 7 SDK does not contain a fix for injection issues that you may experience when CDI, JAX-RS and other injection-aware technologies (e.g. BeanValidation) are used together in one project. While the issue has been fixed in the released Jersey 2.0 binaries, these fixed binaries were not picked by the final GlassFish 4.0 build due to some maven repository stale cache issues. Since we only found out about the issue a day before GlassFish 4.0 and Java EE 7 release, it was not possible to re-spin the build and have it fully tested for the release. I was told by the GlassFish team that they plan to release a new build soon which should contain the final Jersey version as well as any fixes for critical issues reported by the community.
Extracted from (http://marek.potociar.net/2013/06/13/jax-rs-2-0-and-jersey-2-0-released/)
Para usar o Jersey versão 2.x no Glassfish 4.0, é necessário baixar um plugin “Jersey 2 Core, RESTful Web service…” no Update Tool do servidor. Parece que foi um solução encontrada pelos desenvolvedores para fazer com que o servidor desse suporte a nova versão do framework.
Na nova versão do Glassfish, versão 4.1, parece que esse problema foi solucionado. Quando baixei e fiz uso em meu projeto ele funcionou de cara. Por curiosidade fui procurar no Update Tools do Glassfish e não encontrei tal plugin indicado no texto do Marek. Parece-me que nessa nova versão o servidor já está vindo com suporte a nova versão do framework.