Another approach to working around this issue is to make a change to your
topology's POM:   relocate any conflicting dependencies within your own
jar, using the mvn shade plugin's relocation configuration.  A la:
https://github.com/apache/storm/blob/v0.9.4/storm-core/pom.xml#L296-325
(That's the actual change within storm which did the relocation -- I
suppose json-simple should be added to the relocated dependencies for
storm-core)

- Erik

On Wed, May 6, 2015 at 8:52 AM, Ferran Muñoz <[email protected]> wrote:

> Thanks Jeff.
> Yes this is correct. Replacing the jar with a newer version works.
>
> ---------- Missatge reenviat ----------
> From: Jeff Maass <[email protected]>
> To: "[email protected]" <[email protected]>
> Cc:
> Date: Wed, 6 May 2015 15:24:34 +0000
> Subject: Re: Conflict with json-simple
> HeartSaVioR:
>
> Is this correct?
>
> so, effectively, storm forces topology code to make use of the version of
> its libraries.
>
> In this instance, the developer’s topology wishes to make use of
> com.googlecode.json-simple version 1.1.1
> Storm version 0.9.4 uses com.googlecode.json-simple version 1.1
> Therefore, all topologies run on 0.9.4 are forced to use version 1.1 of
> com.googlecode.json-simple
>
> Storm version 0.9.4:
> http://mvnrepository.com/artifact/org.apache.storm/storm-core/0.9.4
>
> If we wanted to use a later version of com.googlecode.json-simple, we
> could go to the lib directory of our storm installation, and replace the
> lower version of the jar.  For instance, in my
> installation, /opt/apache-storm-0.9.4/lib, the jar is json-simple-1.1.jar.
> I would delete json-simple-1.1.jar and replace it with
> json-simple-1.1.1.jar.  At that point, all I would need to do is kill the
> worker in any topologies requiring com.googlecode.json-simple version 1.1.1
> ( If they had not already died due to an un-hanlded exception ).  The
> supervisor would then restart the worker, which would pick up the new,
> 1.1.1 jar.
>
> This will only work if the com.google.code.json-simple library, 1.1.1 is
> backwards compatible with the com.google.cod.json-simple 1.1 library.
>
>
> From: 임정택 <[email protected]>
> Reply-To: "[email protected]" <[email protected]>
> Date: 2015,Wednesday, May 6 at 09:44
> To: "[email protected]" <[email protected]>
> Subject: Re: Conflict with json-simple
>
> Hi.
>
> Unfortunately, Storm adds all jars in <storm root>/lib directory to
> classpath first.
> Recently Storm relocates some libraries to reduce dependency conflict
> (please see http://storm.apache.org/2014/11/25/storm093-released.html)
> but json-simple is not in.
>
> You can try replacing json-simple-1.1.jar to json-simple-1.1.1.jar in your
> storm cluster's lib directory and restart cluster / submit your topology,
> but please note that it should be backward compatible to let Storm runs
> without issue.
>
> Bests.
> Jungtaek Lim (HeartSaVioR)
>
> 2015-05-06 18:30 GMT+09:00 Ferran Muñoz <[email protected]>:
>
>> Hi,
>>
>> I am using a library in a bolt of my topology that depends on json-simple
>> v1.1.1 because it uses the JSONObject constructor that accepts a
>> java.util.Map parameter.
>>
>> I have a conflict because Storm depends on json-simple v1.1. So, when I
>> run my topology I get the exception:
>>
>> java.lang.NoSuchMethodError: org.json.simple.JSONObject: method
>> <init>(Ljava/util/Map;)V not found
>>
>> How can I tackle with this?
>>
>> Thanks in advance and best regards,
>>
>> Ferran
>>
>
>
>
> --
> Name : 임 정택
> Blog : http://www.heartsavior.net / http://dev.heartsavior.net
> Twitter : http://twitter.com/heartsavior
> LinkedIn : http://www.linkedin.com/in/heartsavior
>
>

Reply via email to