Java.lang.RuntimeException:Cannot Create a secure xmlinputfactory exception handling

Source: Internet
Author: User

background : I recently in the WebService CXF interface of the writing debugging process, found a very strange phenomenon-I am in the local to the interface to make a round-trip request is completely no problem, whether the main method is called directly or in the business scenario calls are no problem, There is no problem testing on other colleagues ' computers, but as soon as one is deployed to the server, an error is given. Attempts to locally replace Tomcat with the same version of the line, attempt to re-update all class files, and attempt to replace all jars on the online server will not resolve the issue. Now attached error code and subsequent solutions:

1. Error:

Error:
[ERROR] 2017-09-23 12:18:45,973 Com.aebiz.app.msg.commons.sendMessage.MesServiceImpl.sendMessageCode ( messerviceimpl.java:92)-org.apache.cxf.service.factory.ServiceConstructionException:Failed to create Service.javax.xml.ws.WebServiceException:org.apache.cxf.service.factory.ServiceConstructionException:Failed to Create service. At Org.apache.cxf.jaxws.ServiceImpl.initialize (Serviceimpl.java:163) at Org.apache.cxf.jaxws.ServiceImpl.<init> (serviceimpl.java:129) at Org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate (Providerimpl.java:99) at Javax.xml.ws.Service.<init> (service.java:77) at Com.aebiz.app.web.modules.controllers.open.api.impmessage.service.ImpMessageService.<init> (impmessageservice.java:47) at Com.aebiz.app.web.modules.controllers.open.api.impmessage.impl.SendMessageServiceImpl.sendMessage ( Sendmessageserviceimpl.java:30) at Com.aebiz.app.msg.commons.sendMessage.MesServiceImpl.sendMessageCode (Messerviceimpl.java:84) at Com.aebiz.app.web.modules.controllers.front.pc.member.PcMemberLoginController.mobileCaptcha ( Pcmemberlogincontroller.java:291) at com.aebiz.app.web.modules.controllers.front.pc.member.pcmemberlogincontroller$ $FastClassBySpringCGLIB $$ C9e2d809.invoke (<generated>) at Org.springframework.cglib.proxy.MethodProxy.invoke (Methodproxy.java:204) at Org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint ( Cglibaopproxy.java:721) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 157) at Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (Exposeinvocationinterceptor.java :92) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179) at Org.springframework.aop.framework.cglibaopproxy$dynamicadvisedinterceptor.intercept (CglibAopProxy.java: 656) at com.aebiz.app.web.modules.controllers.front.pc.member.pcmemberlogincontroller$ $EnhancerBySpringCGLIB $$ 13aad116.mobilecaptcha (<generated>) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl . Invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (Invocablehandlermethod.java: 205) at Org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest ( Invocablehandlermethod.java:133) at Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle ( Servletinvocablehandlermethod.java:116) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod ( Requestmappinghandleradapter.java:827) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( Requestmappinghandleradapter.java:738) at Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( Abstracthandlermethodadapter.java:85) at Org.springframework.web.servlet.DispatcherServlet.doDispatch (Dispatcherservlet.java:963) at Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java:897) at Org.springframework.web.servlet.FrameworkServlet.processRequest (Frameworkservlet.java:970) at Org.springframework.web.servlet.FrameworkServlet.doGet (Frameworkservlet.java:861) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:634) at Org.springframework.web.servlet.FrameworkServlet.service (Frameworkservlet.java:846) at Javax.servlet.http.HttpServlet.service (Httpservlet.java:741) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:231) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.apache.tomcat.websocket.server.WsFilter.doFilter (Wsfilter.java:53) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (Characterencodingfilter.java: 197) at Org.springframework.web.filter.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:107) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Com.aebiz.app.web.commons.filter.RouteFilter.doFilter (Routefilter.java:32) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter (Proxiedfilterchain.java:61) at Org.apache.shiro.web.servlet.AdviceFilter.executeChain (Advicefilter.java:108) at Org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal (Advicefilter.java:137) at Org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:125) at Org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter (Proxiedfilterchain.java:66) at Org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain (Abstractshirofilter.java:449) at org.apache.shiro.web.servlet.abstractshirofilter$1.call (abstractshirofilter.java:365) at Org.apache.shiro.subject.support.SubjectCallable.doCall (Subjectcallable.java:90) at Org.apache.shiro.subject.support.SubjectCallable.call (Subjectcallable.java:83) at Org.apache.shiro.subject.support.DelegatingSubject.execute (Delegatingsubject.java:383) at Org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal (Abstractshirofilter.java:362) at Org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (Onceperrequestfilter.java:125) at Org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (Delegatingfilterproxy.java:346) at Org.springframework.web.filter.DelegatingFilterProxy.doFilter (Delegatingfilterproxy.java:262) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (Applicationfilterchain.java:193) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (Applicationfilterchain.java:166) at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:199) at Org.apache.catalina.core.StandardContextValve.invoke (Standardcontextvalve.java:96) at Org.apache.catalina.authenticator.AuthenticatorBase.invoke (Authenticatorbase.java:475) at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java:140) at Org.apache.catalina.valves.ErrorReportValve.invoke (Errorreportvalve.java:80) at Org.apache.catalina.valves.AbstractAccessLogValve.invoke (Abstractaccesslogvalve.java:651) at Org.apache.catalina.core.StandardEngineValve.invoke (Standardenginevalve.java:87) at Org.apache.catalina.connector.CoyoteAdapter.service (Coyoteadapter.java:342) at Org.apache.coyote.http11.Http11Processor.service (Http11processor.java:498) at Org.apache.coyote.AbstractProcessorLight.process (Abstractprocessorlight.java:66) at Org.apache.coyote.abstractprotocol$connectionhandler.process (Abstractprotocol.java:796) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (Nioendpoint.java:1374) at Org.apache.tomcat.util.net.SocketProcessorBase.run (Socketprocessorbase.java:49) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1142) at Java.util.concurrent.threadpoolexecutor$worker.run (Threadpoolexecutor.java:617) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (Taskthread.java:61) at Java.lang.Thread.run (Thread.java:745) caused By:org.apache.cxf.service.factory.ServiceConstructionException:Failed to create service. At Org.apache.cxf.wsdl11.WSDLServiceFactory.<init> (wsdlservicefactory.java:87) at Org.apache.cxf.jaxws.ServiceImpl.initializePorts (Serviceimpl.java:218) at Org.apache.cxf.jaxws.ServiceImpl.initialize (Serviceimpl.java:161) ... 77morecaused By:javax.wsdl.WSDLException:WSDLException:faultCode=PARSER_ERROR:java.lang.RuntimeException:Cannot Create a secure xmlinputfactory at Org.apache.cxf.wsdl11.WSDLM Anagerimpl.loaddefinition (Wsdlmanagerimpl.java:221) at Org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition (Wsdlmanagerimpl.java:163) at Org.apache.cxf.wsdl11.WSDLServiceFactory.<init> (wsdlservicefactory.java:85) ... 79morecaused By:java.lang.RuntimeException:Cannot Create a secure xmlinputfactory at Org.apache.cxf.staxutils. Staxutils.createxmlinputfactory (Staxutils.java:315) at Org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory (Staxutils.java:265) at Org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader (Staxutils.java:1774) at Org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader (Staxutils.java:1673) at Org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition (Wsdlmanagerimpl.java:208) ... Bayi more

2. in the search process, found the great God as described below

Links are as follows: Https://stackoverflow.com/questions/20114945/cxf-web-service-client-cannot-create-a-secure-xmlinputfactory

Description of the Great God: After adding -Dorg.apache.cxf.stax.allowInsecureParser=1 JAVA_OPTIONS setDomainEnv.sh the-in, It's working fine now.

3. According to the method of the great God, the following configuration is done in the catlina.sh file of the Tomcat server, and then it resolves the

Java.lang.RuntimeException:Cannot Create a secure xmlinputfactory exception handling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.