Failed to invoke CXF service in JBOSS 6.
samwun9988 Oct 1, 2011 7:10 AMHi,
I built a CXF2 web service with EJB3 for jboss6 using interface for mothod invocation.
But JBOSS 6 throws the following error when it invokes a web service method through the interface.
ERROR [org.jboss.wsf.common.invocation.InvocationHandlerJAXWS] Method invocation failed with exception: null: java.lang.reflect.InvocationTargetException
...
...
Caused by: java.lang.RuntimeException
at ix.houseware.category.service.CategoryWebServiceImpl.findAll(CategoryWebServiceImpl.java:52) [:]
Interface CategoryService file:
import ix.houseware.category.entity.CategorySubcategories;
import java.util.Collection;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface CategoryWebService {
@WebMethod(operationName = "findAll")
public Collection<CategorySubcategories> findAll();
}
Implementation CatagoryWebServiceImpl class:
import ix.houseware.category.entity.CategorySubcategories;
import ix.houseware.category.entity.facade.CategorySubcategoriesFacade;
import java.util.ArrayList;
import java.util.Collection;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(serviceName = "CategoryWebService")
@Stateless()
public class CategoryWebServiceImpl implements CategoryWebService {
@EJB
private CategorySubcategoriesFacade categorySubcategoriesFacade;
@WebMethod(operationName = "findAll")
@Override
public Collection<CategorySubcategories> findAll() {
try {
return categorySubcategoriesFacade.findAll();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
Facade class:
public abstract class AbstractFacade<T> {
private static final Logger logger = Logger.getLogger(AbstractFacade.class);
private Class<T> entityClass;
public AbstractFacade(Class<T> entityClass) {
this.entityClass = entityClass;
}
protected abstract EntityManager getEntityManager();
public List<T> findAll() {
System.out.println("calling FindAll()................");
logger.info("****************calling findAll()...**********************");
try {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return getEntityManager().createQuery(cq).getResultList();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
The exception is occured at categorySubcategoriesFacade.findAll() where the method findAll() is not getting call at all.
Does anyone know how to invoke a method through interface?
Thanks
Sam