dom4j:Adding text to an XML document must not be null
2014-03-30 14:24
281 查看
在使用dom4j组装xml时,出现如下错误:
解决:每一个element的test值都需要判断,建议写成方法
StringUtil类:
org.apache.cxf.interceptor.Fault: Adding text to an XML document must not be null at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalArgumentException: Adding text to an XML document must not be null at org.dom4j.DocumentFactory.createText(DocumentFactory.java:174) at org.dom4j.tree.AbstractElement.addText(AbstractElement.java:899) at org.dom4j.tree.AbstractElement.setText(AbstractElement.java:1120) at com.dyst.tippe.util.XMLUtils.genQueryResponseXmlFor04C01(XMLUtils.java:132) at com.dyst.tippe.service.impl.PunishProxyServiceHelper.handle(PunishProxyServiceHelper.java:95) at com.dyst.tippe.service.impl.PunishProxyServiceImpl.queryObjectOut(PunishProxyServiceImpl.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy12.queryObjectOut(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ... 32 more
解决:每一个element的test值都需要判断,建议写成方法
StringUtil类:
public static String replaceNullString(String str){ if(str == null ) return ""; else return str; }
相关文章推荐
- could not be set to a 'string' value. You must set this property to a non-null value of type
- IllegalArgumentException: Argument for @NotNull parameter 'file' of com/intellij/openapi/vfs/VfsUtilCore.virtualToIoFile must not be null
- Error parsing XML: prefix must not be bound to one of the reserved namespace names
- Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named
- tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
- 导入adt项目进入android studio报Error:(2) Error parsing XML: prefix must not be bound to one of the reserved
- Not-null property references a transient value - transient instance must be saved before current ope
- Unable to add window -- token null is not for an application
- Serialization from an Object to XML Document in C#
- 运行React Native示例出现null is not an object (evaluating 'this.state.text')
- Unable to add window -- token null is not for an application错误的解决方法
- 异常:According to TLD tag beanwrite must be empty but is not
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- Dialog throwing "Unable to add window — token null is not for an application” with getApplication()
- Guestinfo.hbm(1)The markup declarations contained or pointed to by the document type declaration must be well-formed
- Unable to add window -- token null is not for an application
- Unable to add window -- token null is not for an appli,无法在window中弹出对话框
- java.lang.IllegalStateException: Target host must not be null, or set in parameters.
- Silverlight 调试错误之--“The break point currently will not be hit , no symbols have been loaded to this document”
- org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-fo