Saturday, February 27, 2010

Glassfish v3 - what's the deal to have Weld and REST?


It turns out I did the right thing, but obviously needed a few more mvn clean install cycles (or in other words I have no obvious clue why this consistently failed at the start



So I've been trying to write an app that uses CDI (Weld) and JAX-RS.
As I want separate layers, I coded everything up to have a web.war, an ejb.jar and packaged everything together in an ear-file.

I've coded a bean like this:

public class StatusManager {

public String foo() {

Now I can use it in a JSF like

 <h:commandButton value="Submit!" action="#{}"/>

Works like a charm.

When I try to accces the REST endpoint I get a "resource not found". Ok,
so I add some stuff to web.xml:


Now accessing the JAX-RS endpoint works like a charm, but the above JSF action breaks and the container shows the following in the logs:

com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.

Does anyone know what is going on and how to use both at a time?

1 comment:

Arun Gupta said...

Consider posting your question to ?