java—两个运行相同服务的相同主机,但其中一个无法解析wsdl

f8rj6qna  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(192)

我们处于以下情况:我们通过自动化提供新的k8s集群,并通过自动化构建/部署我们的微服务。到目前为止,我已经部署了几个pre-prod集群,但是现在我们进入了集成测试环境,现在有一个服务容器正在做一些非常奇怪的事情。
在host1上运行的容器照常启动:

2020-12-10 00:46:39,717 INFO  [main] company.Api (Api.java:20) - Running against https://sandboxapi2.example.com/3.0/exampleApi.asmx with user company_example_api_user1
2020-12-10 00:46:39,864 DEBUG [main] resource.DefaultResourceManager (DefaultResourceManager.java:110) - resolving resource <org.apache.cxf.wsdl11.WSDLManagerImpl/bus> type <interface org.apache.cxf.Bus>
2020-12-10 00:46:39,865 DEBUG [main] resource.DefaultResourceManager (DefaultResourceManager.java:110) - resolving resource <null> type <interface org.apache.cxf.Bus>
2020-12-10 00:46:40,066 TRACE [main] helpers.DOMUtils (DOMUtils.java:83) - can't load class com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl
2020-12-10 00:46:40,457 DEBUG [main] jaxws.ServiceImpl (ServiceImpl.java:430) - creating port for portName
2020-12-10 00:46:40,458 DEBUG [main] jaxws.ServiceImpl (ServiceImpl.java:431) - endpoint reference:
2020-12-10 00:46:40,458 DEBUG [main] jaxws.ServiceImpl (ServiceImpl.java:432) - endpoint interface:
2020-12-10 00:46:40,513 INFO  [main] factory.ReflectionServiceFactoryBean (ReflectionServiceFactoryBean.java:391) - Creating Service {http://api.example.com/}exampleApi from WSDL: jar:file:/lib/exampleclient-1.0-SNAPSHOT.jar!/example.wsdl
...

但是在host2上运行的容器在解析绑定到容器映像中的wsdl时遇到致命错误:

2020-12-10 00:48:06,865 INFO  [main] company.Api (Api.java:20) - Running against https://sandboxapi2.example.com/3.0/exampleApi.asmx with user company_example_api_user1
2020-12-10 00:48:07,036 DEBUG [main] resource.DefaultResourceManager (DefaultResourceManager.java:110) - resolving resource <org.apache.cxf.wsdl11.WSDLManagerImpl/bus> type <interface org.apache.cxf.Bus>
2020-12-10 00:48:07,037 DEBUG [main] resource.DefaultResourceManager (DefaultResourceManager.java:110) - resolving resource <null> type <interface org.apache.cxf.Bus>
2020-12-10 00:48:07,231 TRACE [main] helpers.DOMUtils (DOMUtils.java:83) - can't load class com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl
[Fatal Error] :1:1: Content is not allowed in prolog.

两个容器作为pod部署在同一个k8s部署中,只是部署到集群中的不同主机上。
我试过/验证过的东西:
图像在每个构建中都有唯一的标记,标记从不修改,容器规范使用适当的特定标记,例如: company/example:master.99-6920514A ,所以我们在每个主机上得到的图像肯定是相同的。
没有文件或卷装载到容器,所有配置都通过环境变量提供。
重新配置吊舱。
重新部署与服务关联的所有k8s资源:部署、配置Map等。
从机器上擦除图像并重新拉出。
填充配置并手动运行容器。
验证类路径中所有内容的校验和是否与在两台主机上启动的容器匹配。
提取wsdl并验证文件前面没有bom或其他数据。


# jar xf /lib/exampleclient-1.0-SNAPSHOT.jar example.wsdl

# head -n 1 example.wsdl | hexdump -C

00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 22 31  |<?xml version="1|
00000010  2e 30 22 20 65 6e 63 6f  64 69 6e 67 3d 22 75 74  |.0" encoding="ut|
00000020  66 2d 38 22 3f 3e 0d 0a                           |f-8"?>..|
``` `xmmlint example.wsdl` 不会引起任何抱怨。
tcp转储容器以验证它在启动期间没有发出任何网络请求。
我们都已经穷途末路想弄清楚这里发生了什么。有没有人知道是什么原因造成的,或者我们可以进一步调查什么?
完整堆栈跟踪:

Exception in thread "main" 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.(ServiceImpl.java:129)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
at javax.xml.ws.Service.(Service.java:77)
at com.example.api.exampleApi.(exampleApi.java:49)
at com.company.Api.(Api.java:27)
at com.company.payout.Main.main(Main.java:43)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:87)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
... 6 more
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/s:schema[1]): faultCode=PARSER_ERROR: Problem parsing 'file:/'.: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:830)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:654)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:610)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:320)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2338)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:255)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:165)
at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:85)
... 8 more
Caused by: org.xml.sax.SAXParseExceptionpublicId: file:/; systemId: file:/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188)
... 17 more


### 编辑:额外的东西

在同一个区域中建立另一个节点host3
服务启动得很好。
“host2一定闹鬼了”
从k8s集群中删除host2,删除并重新创建一个。
服务以完全相同的方式失败。
“必须诅咒host2。”
同样,这是第三个集群。所有这些都能正常运行30个微服务。所有集群通过ansible和rke提供,所有服务通过jenkins和helm部署。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题