WSDServiceFactory中的空指针异常-Apache CXF库 [英] Null Pointer Exception in WSDServiceFactory - Apache CXF libs

查看:366
本文介绍了WSDServiceFactory中的空指针异常-Apache CXF库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码有问题. WSDL文件由apache cxf的wsdl2java解析.现在,我试图与Web服务建立连接,但仍然出现空指针异常.

I have an problem with my code. The WSDL file was parsed by wsdl2java from apache cxf. Now I'm trying to get connection with web service but still I'm getting null pointer exception.

Exception in thread "main" java.lang.NullPointerException
        at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
        at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
        at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
        at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:97)
        at javax.xml.ws.Service.<init>(Service.java:56)...

URL地址指向我下载WSDL文件的位置.为了构建jar,我将Maven与以下依赖项一起使用:

The url address is pointing to place from where I have downloaded the WSDL file. For building jar I'm using Maven with dependencies such as:

  • jaxws-api
  • cxf-rt-transports-http
  • cxf-rt-frontend-jaxws
  • cxf-rt-bindings-soap

带有deps的jar由maven-assembly-plugin

jar with deps is created by maven-assembly-plugin

请确保wsdl文件在那里,因为它是从那里下载的.

For sure the wsdl file exists there because it have been downloaded from there.

有什么建议吗?感谢您的帮助.

Any suggestions? Thanks for any help.

顺便说一句.这不是重复的问题,我找到的任何解决方案都不适合我.

BTW. It's not duplicated question any of solution which I have found does not work for me.

推荐答案

我在 gradle 中使用 shadowJar 遇到了同一问题.解决方案是在META-INF/cxf/目录中显式合并 bus-extensions.txt 服务文件:

I ran into the same issue using shadowJar in gradle. The solution is to explicitly merge bus-extensions.txt service files in the META-INF/cxf/ directory:

shadowJar {
  archiveName = 'application.jar'
  mergeServiceFiles{
    path='META-INF/cxf'
  }
}

这篇关于WSDServiceFactory中的空指针异常-Apache CXF库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆