[SNMP4J] NoSuchMethodError in TestAgent

Frank Fock fock at agentpp.com
Wed Feb 12 07:23:07 CET 2014


Hi Etienne,

It seems that the class ed.demo.snmp4j.AgentTest had been compiled with a
different SNMP4J version than 2.2.4. But even then I agree that the behavior
is weired because the signature of the method has not changed for a very 
long
time.

Fortunately, you can (and should) now use SNMP4J-Agent 2.1.1 together with
SNMP4J 2.2.5.

Best regards,
Frank

Am 12.02.2014 04:27, schrieb Dysli Metref Etienne:
> On 06/02/2014 01:04, Frank Fock wrote:
>> 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.
> Hi Frank,
>
> I tried that as well and I still get the same NoSuchMethodError.
>
> <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>
>    <exclusions>
>      <exclusion>
>        <groupId>org.snmp4j</groupId>
>        <artifactId>snmp4j</artifactId>
>      </exclusion>
>    </exclusions>
> </dependency>
>
> Here is some output from mvn -X clean test:
>
> [DEBUG] boot(compact) classpath:  surefire-booter-2.15.jar
> surefire-api-2.15.jar  test-classes  classes  junit-4.11.jar
> hamcrest-core-1.3.jar  snmp4j-2.2.4.jar  log4j-1.2.14.jar
> snmp4j-agent-2.1.0.jar  surefire-junit4-2.15.jar
> Running ed.demo.snmp4j.AgentTest
> 0 [main] DEBUG org.snmp4j.security.Salt  - Initialized Salt to
> 69e9832653398af6.
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.025
> sec <<< FAILURE! - in ed.demo.snmp4j.AgentTest
> tryTestAgent(ed.demo.snmp4j.AgentTest)  Time elapsed: 18.931 sec  <<< ERROR!
> java.lang.NoSuchMethodError:
> org.snmp4j.security.SecurityProtocols.addDefaultProtocols()V
>    at org.snmp4j.agent.BaseAgent.initMessageDispatcher(BaseAgent.java:384)
>    at org.snmp4j.agent.BaseAgent.init(BaseAgent.java:145)
>    at org.snmp4j.agent.test.TestAgent.main(TestAgent.java:458)
>    at ed.demo.snmp4j.AgentTest.tryTestAgent(AgentTest.java:11)
>
> As you can see above, the classpath contains only one version of SNMP4J.
> How do you run SNMP4J-Agent 2.1.0 with SNMP4J 2.2.4?
>
>    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