Could not dereference object
samwun9988 Feb 19, 2011 9:35 PMHello,
I have deployed a web service in Jboss 6.0. It shown that the service is deployed successfully:
Endpoint Name | jboss.ws:context=HousewareEnterpriseApplication1-ejb,endpoint=RoleWS | ||||||||||||||||||
Endpoint Address | http://localhost:8080/HousewareEnterpriseApplication1-ejb/RoleWS/RoleWS | ||||||||||||||||||
| |||||||||||||||||||
With my web service client, when I open its jsf page at:
http://localhost:8080/HousewareEnterpriseApplicationClient-war/faces/role_admin.xhtml
it throws the following exception:
11:22:15,044 WARN [org.apache.cxf.phase.PhaseInterceptorChain] Application {http://ws.houseware.com.au/}RoleWS#{http://ws.houseware.com.au/}findAll has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: org.jboss.injection.manager.spi.InjectionException: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: RoleFacade not bound]]
I have attached my client codes in the following section for reference.
RoleManager.java:
@Stateless
@LocalBean
public class RoleManager {
@WebServiceRef(wsdlLocation = "META-INF/wsdl/localhost_8080/HousewareEnterpriseApplication1-ejb/RoleWS/RoleWS.wsdl")
private RoleWS_Service service;
public java.util.List<au.com.houseware.wsdl.generated.Role> findAll() {
au.com.houseware.wsdl.generated.RoleWS port = service.getRoleWSPort();
return port.findAll();
}
RoleController.java:
@ManagedBean(name="role")
@SessionScoped
public class RoleController
{
@EJB
private RoleManager roleManager;
private Role role;
private final static Logger logger = Logger.getLogger(RoleController.class.getName());
private ArrayList<Role> roleList;
public ArrayList<Role> getRoles()
{
if (roleList == null) {
List<Role> retList = roleManager.findAll();
roleList = new ArrayList<Role>();
for (Role cust : retList) {
roleList.add((Role) cust);
}
}
return roleList;
}
RoleFacade.java:
@Stateless
public class RoleFacade extends AbstractFacade<Role> {
@PersistenceContext(unitName = "HousewareEnterpriseApplication1-ejbPU")
private EntityManager em;
@Resource
private javax.transaction.UserTransaction utx;
protected EntityManager getEntityManager() {
return em;
}
public RoleFacade() {
super(Role.class);
}
public void createRoleFromName(String name) {
Role role = new Role();
role.setRoleId(RandomNumberUtil.tinyId());
role.setRoleName(name);
super.create(role);
}
}
Very appreciate for any suggestion and help to resolve this error.
Thanks
Sam