问题描述
动态调用代码如下:String sfUrl = "http://219.134.187.154:8088/bsp-oip/ws/WarehouseService?wsdl";// 动态实例JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();final Client client = dcf.createClient(sfUrl);----此处报空指针异常// 设置超时单位为毫秒HTTPConduit http = (HTTPConduit) client.getConduit();http.getClient().setReceiveTimeout(3000);HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();httpClientPolicy.setConnectionTimeout(10000);// 连接超时(毫秒)httpClientPolicy.setAllowChunking(false);// 取消块编码httpClientPolicy.setReceiveTimeout(10000);// 响应超时(毫秒)http.setClient(httpClientPolicy);说明:此段代码部署在windows环境是没有问题的,部署在linux下就有问题,请各位指点,异常信息详见附件 问题补充:Caused by: java.lang.NullPointerExceptionat org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:189)at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:143)at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:138)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:599)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:367)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:235)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:228)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:183)at com.odbpo.ecsyswg.common.CallSFWebserviceClient.createSFWebservice(CallSFWebserviceClient.java:63)at com.odbpo.ecsyswg.common.CallSFWebserviceClient.getSFWebservice(CallSFWebserviceClient.java:42)at com.odbpo.ecsyswg.webservice.impl.WgOrderWServiceImpl.odbpoWgMerchantCatalogService(WgOrderWServiceImpl.java:517)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:616)at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)... 32 more
解决方案
你可以把地址输入linux环境下的浏览器里进行测试,看是否有数据还回,因为是同一个地址在不同环境中才造成的,所以可能是环境不同造成的。