我的服务端代码有这样的一段特殊的东西
throw new SoapException("soapException",new SoapFault(123,"hello"));
问题就在这个SoapFault,这个对象里面是这样的。
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"errorCode",
"msg"
})
@XmlRootElement(name = "ServiceException")
public class SoapFault { @XmlElement(name = "ErrorCode")
protected long errorCode;
@XmlElement(name = "Msg", required = true)
protected String msg; public SoapFault(ServiceException serviceException){
this.errorCode = serviceException.getErrorCode();
this.msg = serviceException.getMessage();
}
public SoapFault(long errorCode,String msg){
this.errorCode = errorCode;
this.msg = msg;
}
/**
* 获取errorCode属性的值。
*
*/
public long getErrorCode() {
return errorCode;
} /**
* 设置errorCode属性的值。
*
*/
public void setErrorCode(long value) {
this.errorCode = value;
} /**
* 获取msg属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsg() {
return msg;
} /**
* 设置msg属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsg(String value) {
this.msg = value;
}
}
我在tomcat发布的时候会报这个错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManagerService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.interceptor.Fault: Could not find JAXB information for bean class com.centralsoft.framework.core.soa.SoapFault in context. Make sure it follows JAXB conventions.问题好像就是在于那些出代码外的@XmlType这些东西。求大神解答,很急,在线等。SpringJava
throw new SoapException("soapException",new SoapFault(123,"hello"));
问题就在这个SoapFault,这个对象里面是这样的。
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"errorCode",
"msg"
})
@XmlRootElement(name = "ServiceException")
public class SoapFault { @XmlElement(name = "ErrorCode")
protected long errorCode;
@XmlElement(name = "Msg", required = true)
protected String msg; public SoapFault(ServiceException serviceException){
this.errorCode = serviceException.getErrorCode();
this.msg = serviceException.getMessage();
}
public SoapFault(long errorCode,String msg){
this.errorCode = errorCode;
this.msg = msg;
}
/**
* 获取errorCode属性的值。
*
*/
public long getErrorCode() {
return errorCode;
} /**
* 设置errorCode属性的值。
*
*/
public void setErrorCode(long value) {
this.errorCode = value;
} /**
* 获取msg属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsg() {
return msg;
} /**
* 设置msg属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsg(String value) {
this.msg = value;
}
}
我在tomcat发布的时候会报这个错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManagerService': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.interceptor.Fault: Could not find JAXB information for bean class com.centralsoft.framework.core.soa.SoapFault in context. Make sure it follows JAXB conventions.问题好像就是在于那些出代码外的@XmlType这些东西。求大神解答,很急,在线等。SpringJava
解决方案 »
- struts2标签、OGNL和EL怎么取属性值包含"."号的值?
- 链接oracle的问题
- hibernate更新问题
- struts怎么得到服务器返回的信息,在action中怎样写
- axis1.4 开发的webservice tomcat5.x 下没问题,was6.1上报错
- 如何在网页打开时自动执行我自写的一个函数呢
- J2EE.net.Cn 这样的域名牛不牛?
- XDoclet中@ejb关于findByXXX的问题
- 我想要一个java连接sqlserver的连接池,谢谢
- 100分散分问问题啦!!!!请诸大虾相助!!
- netbeans7.0.1自带的glassfish3.1只能启动一次
- classpath与java.ext.dirs的一个疑问,求大神解惑
2.@XmlElement这个我记得是放在get方法上的@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"errorCode",
"msg"
})
@XmlRootElement(name = "ServiceException")
public class SoapFault {
protected long errorCode;
protected String msg; public SoapFault(ServiceException serviceException){
this.errorCode = serviceException.getErrorCode();
this.msg = serviceException.getMessage();
}
public SoapFault(long errorCode,String msg){
this.errorCode = errorCode;
this.msg = msg;
}
/**
* 获取errorCode属性的值。
*
*/
@XmlElement(name = "ErrorCode")
public long getErrorCode() {
return errorCode;
} /**
* 设置errorCode属性的值。
*
*/
public void setErrorCode(long value) {
this.errorCode = value;
} /**
* 获取msg属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
@XmlElement(name = "Msg", required = true)
public String getMsg() {
return msg;
} /**
* 设置msg属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsg(String value) {
this.msg = value;
}
}