eclipse cxf wsdl2java_Apache CXF客户端在Eclipse中加载良好,但独立的jar在WSDLServiceFactory中引发NullpointerException...

我的目标是使用mvn程序集创建一个在具有所有依赖项的独立jar中运行的Web Service客户端:

我使用CXF代码生成器wsdl2java生成了客户端,并创建了一个名为NetBanxAutostatementService的@WebServiceClient。

对于依赖我

2.5.2

org.apache.cxf

cxf-rt-frontend-jaxws

${cxf.version}

runtime

org.apache.cxf

cxf-rt-transports-http

${cxf.version}

runtime

拼命地我什至试图添加更多的“东西”

org.apache.cxf

cxf-rt-core

2.5.2

runtime

org.apache.cxf

cxf

2.5.2

pom

runtime

问题:每次我尝试运行“ java -jar target / Netbanx-0.0.1-SNAPSHOT-jar-with-

dependencies.jar”

INFO [main] (Netbanx.java:97) - autostatement_wsdlLocation:https://www.test.netbanx.com/cgi-bin/autostatement_wsdl

Exception in thread "main" java.lang.NullPointerException

at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:92)

at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)

at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:148)

at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:91)

at javax.xml.ws.Service.(Service.java:56)

at com.netbanx.autostatement.NetBanxAutostatementService. (NetBanxAutostatementService.java:39)

at my.project.netbanx.Netbanx.(Netbanx.java:98)

at my.project.netbanx.Netbanx.main(Netbanx.java:130)

这在调用WebServiceClient autostatementService = new

NetBanxAutostatementService(autostatement_wsdlLocation)的行中发生;我通过日志行知道我没有将autostatement_wsdlLocation传递为null

Java代码:

URL autostatement_wsdlLocation = null;

URL payment_wsdlLocation = null;

try {

autostatement_wsdlLocation = new URL(properties.getProperty("autostatement_wsdlLocation"));

payment_wsdlLocation = new URL(properties.getProperty("payment_wsdlLocation"));

} catch (MalformedURLException e) {

logger.error("MalformedURLException",e);

}

/**

* Load the Netbanx's webservices AutostatementService and PaymentService

*/

try {

logger.info("autostatement_wsdlLocation:"+autostatement_wsdlLocation.toString());

autostatementService = new NetBanxAutostatementService(autostatement_wsdlLocation); //it is here I get the NullPointerException error

logger.info("payment_wsdlLocation:"+payment_wsdlLocation.toString());

paymentService = new NetBanxPaymentService(payment_wsdlLocation);

webServiceStarted = true;

} catch(javax.xml.ws.WebServiceException wsException ){

String error = "Cannot create NetBanx web service please make sure this host can reach:" + autostatement_wsdlLocation +" and " + payment_wsdlLocation;

logger.error(error);

logger.error("WebServiceException",wsException);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值