首页 > 解决方案 > http java调用出错了

问题描述

我在 Weblogic 12 上有一个 java 应用程序,我在 REST 中对 SAP 服务器进行 https 调用(GET e 基本身份验证),一切正常工作 30/45 分钟,但在我有“503:服务不可用”之后。如果我从浏览器调用此服务,它总是有效的。

HttpURLConnection  conn = (HttpURLConnection) new URL( url.toString()).openConnection();
    conn.setRequestProperty("Authorization", "Basic " + authUserEnc);
    ... //read the response stream
    conn.disconnect();

这是错误

java.io.FileNotFoundException: Response: '503: Service Unavailable' for url: 'https://fwp-as3.enelint.global:44331/sap/opu/odata/sap/ZFIOI_O1_Q006_SRV/ZFIOI_O1_Q006(ZVAR_VDMCUI_OI_M='0000022077',ZVAR_VDMCUI_OI_MTo='0000022077')/Results?saml2=disabled'
        at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:829)
        at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:42)
        at it.exprivia.bexboard.service.impl.VendorServiceImpl.getData(VendorServiceImpl.java:125)
        at it.exprivia.bexboard.controller.GrafxController.getVendorGrafxById(GrafxController.java:166)
        at sun.reflect.GeneratedMethodAccessor211.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:202)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
        at ...

标签: javaweblogic12c

解决方案


推荐阅读