在我的服务器中,当客户端尝试访问我的webservice时,我收到此错误
Caused by: javax.xml.bind.JAXBException: hibernate.SBaraque is not known to this context at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:619) at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:145) ... 42 more
当我的客户端尝试调用此方法时显示此错误:
@WebResult(name="listes")
public List findByPropery(@WebParam(name="arg1") String arg1, @WebParam(name="Value1") Object Value1);
调用DAO类
public List findByPropery(String arg1, Object Value1) {
// TODO Auto-generated method stub
System.out.println("findByPropery DAO IN");
return getSession().createQuery("from SBaraque where "+arg1+" = ?").setParameter(0, Value1).list();
}
这是我的界面:
@WebService
public interface InterfaceService {
public void save(@WebParam(name="object") Object obj);
public void modify(@WebParam(name="object") Object obj);
public void delete(@WebParam(name="object") Object obj);
@WebResult(name="listes")
public List findAll();
@WebResult(name="object")
public Object findById (@WebParam(name="id") Integer id);
@WebResult(name="listes")
public List findByListPropery(@WebParam(name="arg1") String arg1,
@WebParam(name="Value1") Object Value1,
@WebParam(name="arg2") String arg2,
@WebParam(name="Value2") Object Value2);
@WebResult(name="listes")
public List findByPropery(@WebParam(name="arg1") String arg1,
@WebParam(name="Value1") Object Value1);
@WebResult(name="listes")
public List findBySQLRequest(@WebParam(name="request") String request);
@WebResult(name="listes")
public List findByHQLRequest(@WebParam(name="request") String request);
}
答案 0 :(得分:0)
您可能需要添加@XmlSeeAlso注释,该注释将指向服务将接受并返回的所有可能类。否则,JAXB对它们一无所知。