[SNMP4J] NoSuchMethodError in TestAgent

Frank Fock fock at agentpp.com
Wed Feb 5 18:04:41 CET 2014


Please believe me, the trouble is caused by the transient dependency.
You can suppress transient dependencies by using the "exclude" element
for your SNMP4J-Agent dependency which has to exclude the transient
SNMP4J 2.2.3 dependency.

Best regards,
Frank

Am 05.02.2014 10:34, schrieb Dysli Metref Etienne:
> On 05/02/2014 15:15, Frank Fock wrote:
>> Here is the problem. Maven (at least it is not Maven - that is true)
>> does mess up your classpath, because SNMP4J-Agent 2.1.0 was built
>> against SNMP4J 2.2.3 and thus, you get v2.2.3 in your classpath if
>> you add a dependency to SNMP4J-Agent 2.1.0 to your dependencies in
>> your application's pom.xml.
>>
>> If you then also add SNMP4J 2.2.4, you have two different versions at the
>> same time.
> With the following dependencies, Maven never fetches
> org.snmp4j:snmp4j:jar:2.2.3.
>
> <dependency>
>    <groupId>org.snmp4j</groupId>
>    <artifactId>snmp4j</artifactId>
>    <version>2.2.4</version>
>    <scope>compile</scope>
> </dependency>
> <dependency>
>    <groupId>org.snmp4j</groupId>
>    <artifactId>snmp4j-agent</artifactId>
>    <version>2.1.0</version>
>    <scope>compile</scope>
> </dependency>
>
> So how do you explain this?
>
> $ mvn dependency:tree -Dverbose
> [INFO] Scanning for projects...
> ------------------------------------------------------------------------
> [INFO] Building SNMP4J_NoSuchMethodError_demo 1.0.0-SNAPSHOT
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
> SNMP4J_NoSuchMethodError_demo ---
> [INFO] edysli:SNMP4J_NoSuchMethodError_demo:jar:1.0.0-SNAPSHOT
> [INFO] +- junit:junit:jar:4.11:test
> [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
> [INFO] +- org.snmp4j:snmp4j:jar:2.2.4:compile
> [INFO] |  \- log4j:log4j:jar:1.2.14:compile
> [INFO] \- org.snmp4j:snmp4j-agent:jar:2.1.0:compile
> [INFO]    +- (log4j:log4j:jar:1.2.14:compile - omitted for duplicate)
> [INFO]    \- (org.snmp4j:snmp4j:jar:2.2.3:compile - omitted for conflict
> with 2.2.4)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> ------------------------------------------------------------------------
> [INFO] Total time: 3.964s
> [INFO] Finished at: Wed Feb 05 17:28:45 SGT 2014
> [INFO] Final Memory: 9M/120M
> ------------------------------------------------------------------------
>
> Cheers,
>     Etienne
>
>
>
> This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
> E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
> Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list