gpt4 book ai didi

java - 如何用kubernetes和soap解决我的问题。客户端无法访问服务器

转载 作者:行者123 更新时间:2023-12-02 12:26:52 26 4
gpt4 key购买 nike

我在相同 namespace 的kubernetes群集上有一个客户端和一个服务器。
我尝试使用以下代码访问服务器:

    public GetDataResponse getData() throws JsonProcessingException {
GetDataResponseXML response = (GetDataResponseXML) getWebServiceTemplate()
.marshalSendAndReceive(REQUEST_PARAMETER, new SoapActionCallback(""));
log.info("Get response data: " + Mapper.objectMapper.writeValueAsString(response));
return mapper.dataResponseXMLToJPAEntity(response);
}
我使用DNS连接到端点
http://<serviceOfServer>.<namespace>.svc.cluster.local/data
但是我总是得到这个输出:
2020-06-25 07:44:36.128 ERROR 7 --- [   scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task
java.lang.NullPointerException: null
at org.springframework.ws.transport.http.AbstractHttpWebServiceMessageSender.supports(AbstractHttpWebServiceMessageSender.java:63) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.support.WebServiceAccessor.createConnection(WebServiceAccessor.java:107) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:551) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) ~[spring-ws-core-3.0.7.RELEASE.jar!/:na]
at com.my.adapter.client.SOAPClient.getData(SOAPClient.java:40) ~[classes!/:0.0.1-SNAPSHOT]
at com.my.adapter.scheduler.Scheduler.consumeScheduler(Scheduler.java:33) ~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
我有此网络策略,所以np不能成为原因
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-all-egress
spec:
podSelector: {}
egress:
- {}
ingress:
- {}
policyTypes:
- Egress
- Ingress

如果我将端口转发到服务器或服务,则可以使用本地客户端访问它。所以应该没关系。
我绝对不知道为什么我会得到一个nullpointer异常。
有任何想法吗?
非常感谢您的帮助!

最佳答案

我有解决方案。我不知道为什么我的DNS不起作用,但是当我仅通过服务调用它时

http://<serviceOfServer>:<port>
有用.....

关于java - 如何用kubernetes和soap解决我的问题。客户端无法访问服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62570770/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com