已使用的版本: 雄猫7 jre 6
我创建了一个新的动态Web项目,并在这个新项目中添加了axis2 Web服务客户端。然后我把这个项目变成了一个jar文件。 当我导出时,我只选择了src文件。我添加了这个jar文件和axis2客户端的最小jar。 这个最小的罐子: What's the minimum classpath for an Axis2 client?
我运行这个主项目,项目没有给出任何错误。但是这个项目部署 但是当我将此项目部署到weblogic服务器时,我收到以下错误:
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:122)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:347)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.iDdenBirimAdiGetir(UniversiteBirimv1Stub.java:494)
at webmethods.wsdls.universitebirim.universitebirimv1.TestWebServis.birimGetirv1(TestWebServis.java:15)
at dao.SozMaasDAO.ogrenimSuresiGetir(SozMaasDAO.java:1159)
at dao.SozMaasDAO.ogrenimDurumRowSelect(SozMaasDAO.java:1192)
at bus.SozMaasBUS.listYoktenMezunBilgisiGetir(SozMaasBUS.java:7622)
at bus.SozMaasBUS$$FastClassByCGLIB$$41cbd8aa.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at bus.SozMaasBUS$$EnhancerByCGLIB$$aa66edae.listYoktenMezunBilgisiGetir(<generated>)
at view.SozMaasView.hnd_yoktenMezunBilgisiGetir(SozMaasView.java:81)
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.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:473)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:410)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at filter.SecurityFilter.doFilter(SecurityFilter.java:416)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at filter.GZIPFilter.doFilter(GZIPFilter.java:32)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1499)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:263)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: org.apache.axiom.om.DeferredParsingException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:184)
at org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj:96)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.buildNext(OMDocumentImpl.java:1)
at org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj)
at org.apache.axiom.core.CoreChildNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreChildNodeSupport$org_apache_axiom_core_CoreChildNode$coreGetNextSibling(CoreChildNodeSupport.aj:115)
at org.apache.axiom.om.impl.llom.OMNodeImpl.coreGetNextSibling(OMNodeImpl.java:1)
at org.apache.axiom.core.CoreChildNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreChildNodeSupport$org_apache_axiom_core_CoreChildNode$coreGetNextSibling(CoreChildNodeSupport.aj)
at org.apache.axiom.core.CoreDocumentSupport.ajc$interMethod$org_apache_axiom_core_CoreDocumentSupport$org_apache_axiom_core_CoreDocument$coreGetDocumentElement(CoreDocumentSupport.aj:47)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.coreGetDocumentElement(OMDocumentImpl.java:1)
at org.apache.axiom.om.impl.common.AxiomDocumentSupport.ajc$interMethod$org_apache_axiom_om_impl_common_AxiomDocumentSupport$org_apache_axiom_om_impl_intf_AxiomDocument$getOMDocumentElement(AxiomDocumentSupport.aj:32)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:1)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:557)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:553)
at org.apache.axis2.transport.TransportUtils.createDefaultDocumentElement(TransportUtils.java:230)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:207)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:144)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:107)
... 53 more
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:666)
... 70 more
<May 12, 2017 3:50:29 PM EEST> <Error> <HTTP> <BEA-101017> <[ServletContext@181830207[app:kbs_3asd module:kbs_3asd path: spec-version:2.5]] Root cause of ServletException.
java.lang.NullPointerException
at dao.SozMaasDAO.ogrenimDurumRowSelect(SozMaasDAO.java:1198)
at bus.SozMaasBUS.listYoktenMezunBilgisiGetir(SozMaasBUS.java:7622)
at bus.SozMaasBUS$$FastClassByCGLIB$$41cbd8aa.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:163)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
Truncated. see log file for complete stacktrace
>
注意: 当我添加Web服务客户端时,代码是以这种方式创建的
webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.ıDdenBirimAdiGetir
但我改变了它们:
webmethods.wsdls.universitebirim.universitebirimv1.UniversiteBirimv1Stub.iDdenBirimAdiGetir
代码:
public static Birim birimAgaciGetir(long birim_id){
Birim birim= new Birim();
try {
UniversiteBirimv1Stub stub = new UniversiteBirimv1Stub();
IDdenBirimAdiGetir c2f = new IDdenBirimAdiGetir();
c2f.setBIRIM_ID(birim_id);
IDdenBirimAdiGetirE e= new IDdenBirimAdiGetirE();
e.setIDdenBirimAdiGetir(c2f);
IDdenBirimAdiGetirResponseE res = stub.ıDdenBirimAdiGetir(e);
System.out.println("Tested: "+res);
birim= res.getIDdenBirimAdiGetirResponse().getBirim();
//System.out.println(res.getIDdenBirimAdiGetirResponse().getBirim().getBAGLI_OLDUGU_BIRIM_ID());
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}catch (Exception e) {
System.out.println(e);
}
return birim;
}
我在主项目中使用过它。
System.out.println(res.getIDdenBirimAdiGetirResponse().getBirim().getBAGLI_OLDUGU_BIRIM_ID());
答案 0 :(得分:0)
我解决了这个问题,在项目中添加了两个罐子(StAX,Woodstox)
答案 1 :(得分:0)
在我的情况下,服务已关闭,因此axis2给出了相同的错误。服务启动后,我就可以调用并获得响应。