2017-07-10 24 views
2

をCXFのWebサービスクライアント(スカラ+ Javaの+ WSDL2Javaの)を作成する際にこれらの他の質問は、ソリューションのヒントが、私は仕事にこれを取得することができていない:
Could not resolve a binding for http://schemas.xmlsoap.org/wsdl/soap/
ServiceConstructionException when creating a CXF web service client
How to package an Apache CXF application into a monolithic JAR with the Maven "shade" pluginServiceConstructionException

java -Xdebug -jar myapp.jarでアプリケーションを起動すると、アプリケーションがSOAP呼び出しを行うときにServiceConstructionException: Could not resolve a binding for nullと表示されます。アプリケーションとSOAP呼び出しは、IntelliJでアプリケーションを起動するとうまく動作します。ここでは、エラーを再現する最小限の例です:再現するhttps://github.com/stianlagstad/mainclass-and-jxf-problems-demo

ステップ:
- gradle clean build && java -Xdebug -jar build/libs/mainclass-and-jxf-problems-demo.jar
- http://localhost:4242/endpoint/に移動し、エラーに

を参照してください誰も私が私が作るためにしなければならないその変化を把握助けることができますSOAP呼び出しは動作しますか?私はMETA-INFを除外しないようにbuild.gradleを編集した場合は、私が代わりにこのエラーが発生します(すなわち、代わりにconfigurations.compile.collect { it.isDirectory() ? it : zipTree(it).matching{exclude{it.path.contains('META-INF')}} }configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }を持つ)

編集は、より多くの情報を提供するError: Could not find or load main class com.shadowjarcxfproblem.JettyLauncher(jarファイルなどのアプリを起動します)。しかし、IntelliJでアプリを起動すると、SOAP呼び出しも同様に機能します。

CXFエラーのスタックトレース:これら二つを読んで、私は最終的に働く何かにつまずい異なるものの束を試した後

org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:352) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144) 
    at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) 
    at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157) 
    at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) 
    at com.shadowjarcxfproblem.SoapServiceFactory.create(SoapServiceFactory.java:36) 
    at com.shadowjarcxfproblem.service.CalculatorServiceComponent$CalculatorServiceImpl.<init>(CalculatorService.scala:17) 
... 
Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered. 
    at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:93) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:339) 
    ... 75 more 

答えて

0

!このタスクでのGradle shadowjarプラグインを使用して
How to package an Apache CXF application into a monolithic JAR with the Maven "shade" plugin
https://discuss.gradle.org/t/how-do-i-use-the-gradle-shadow-plugin-to-merge-spring-handlers-and-spring-schemas-files-of-multiple-spring-jar-dependencies/6713/6

が問題を解決:

import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer 
shadowJar { 
    // Make sure the cxf service files are handled correctly so that the SOAP services work. 
    // Ref https://stackoverflow.com/questions/45005287/serviceconstructionexception-when-creating-a-cxf-web-service-client-scalajava 
    transform(ServiceFileTransformer) { 
     path = 'META-INF/cxf' 
     include 'bus-extensions.txt' 
    } 
} 
+0

こんにちは、私は同じ問題を取得しています、私は私のビルドファイルにコードスニペットの上に追加することを試みたが、動作していません、あなたはplsを助けることができますか? – Dipti

+0

再現可能なサンプルを作成してGitHubに置くと、私は助けてくれるかもしれません:) – L42

+0

私はliferay dxpワークスペースを持っています。あなたがliferayに慣れていれば私はリポジトリを共有できます。 – Dipti