1
votes

I am having trouble adding the JAX-RS 2.0 facet to an Eclipse 4.3. Dynamic Web project with Glassfish 4.0. I tried the approach noted here and the values that are filled in for the parameters with "Disabled Library Configuration" are:

JAX-RS servlet name: JAX-RS Servlet
JAX-RS servlet class name: javax.ws.rs.core.Application
URL mapping patterns: /jaxrs/*

That gets saved without any problems. Then, when I go back to the Project Properties, I get a pop-up that says "The currently displayed page contains invalid values". Acknowledging that, and getting to the JAX-RS facet page, all the fields are now empty, and instead of saying "Disabled Library Configuration", the Type says "Unknown Library Configuration". Going to the main Project Facets page and trying to uncheck the JAX-RS facet item gives a pop-up that says "Failed while uninstalling JAX-RS (REST Web Services) 2.0. Reason: Failed while uninstalling JAX-RS (REST Web Services) 2.0. The details say "Failed while uninstalling JAX-RS (REST Web Services) 2.0. org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp"

I updated Eclipse to 4.3.1 and got the same behavior. The fields getting blanked out without any warning when they were initially saved, and not being able to uninstall the JAX-RS facet leads me to believe there's something wrong with my Eclipse install or project file (although I tried this with several projects and they all behaved the same).

Can anyone point me at a way to fix this?

1

1 Answers

0
votes

I'm using Jersey as runtime and this is how I can configure directly in web.xml. I did not have much luck using the project facet settings. Hope this helps. (change the provide package param below to fit yours)

<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
  <param-name>jersey.config.server.provider.packages</param-name>
  <param-value>com.paypal.l10n.nextgen.extractor.rest</param-value>
</init-param>
<init-param>
 <param-name>unit:WidgetPU</param-name>
 <param-value>persistence/widget</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>