uswitch / binj

Clojure library for accessing the Bing Ads API
Eclipse Public License 1.0
0 stars 2 forks source link

Binj can not be used in an uberjar #2

Open christianblunden opened 9 years ago

christianblunden commented 9 years ago

This seems to be an underlying problem with the Apache Camel jars, when bundling into an uberjar. http://camel.apache.org/how-do-i-use-a-big-uber-jar.html

Usage results in the following error:

Caused by: 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 org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493) 
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:343) 
    ... 47 common frames omitted
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)

This problem is described in the following Stack Overflow posts: http://stackoverflow.com/questions/24430342/error-on-using-camel-cxf-no-binding-factory-http-schemas-xmlsoap-org-soap http://stackoverflow.com/questions/6831954/how-to-package-an-apache-cxf-application-into-a-monolithic-jar-with-the-maven-s

Solution seems to use Maven Shade plugin, which can be referenced in the project.clj as described here: https://github.com/technomancy/leiningen/issues/1460

I gave this a try, but it is beyond by Java/Maven powers unfortunately...

elisehuard commented 6 years ago

had half a day to play with this and made very slight progress, using

  :uberjar-merge-with {"META-INF/cxf/bus-extensions.txt" [slurp str spit]}

in the project.clj (loosely based on https://stackoverflow.com/questions/24430342/error-on-using-camel-cxf-no-binding-factory-http-schemas-xmlsoap-org-soap Now get a NullPointerException, and no more time to spend, but if someone wants to pick this up ...

christianblunden commented 6 years ago

Ah thanks Elise.. I'll take a look

christianblunden commented 6 years ago

With the pull request above which uses the latest SDK and the maven shade plugin + using the technique provided by Elise... Binj can now be used within uberjar.

Thanks @elisehuard

However I did make breaking changes ;)