soulwing / tnm4j

A simplified SNMP API for Java, based on Jürgen Schönwälder's Tnm extension for Tcl.
GNU General Public License v3.0
41 stars 18 forks source link

java.lang.nosuchmethoderror While using in Apache NiFi #27

Open faisal-ksolves opened 1 year ago

faisal-ksolves commented 1 year ago

I am using this library in my Apache NiFi project, to perform a walk operation but it shows the following error java.lang.NoSuchMethodError: 'void net.percederberg.mibble.asn1.Asn1Parser.reset(java.io.Reader, net.percederberg.grammatica.parser.Analyzer)' at net.percederberg.mibble.MibLoader$MibSource.parseMib(MibLoader.java:970) at net.percederberg.mibble.MibLoader.loadQueue(MibLoader.java:724) at net.percederberg.mibble.MibLoader.load(MibLoader.java:550) at net.percederberg.mibble.MibLoader.load(MibLoader.java:451) at org.soulwing.snmp.provider.mibble.CachingMibRepository.load(CachingMibRepository.java:79) at org.soulwing.snmp.provider.mibble.MibbleMib.load(MibbleMib.java:226) can you help me to resolves it. Thanks in Advance.

ceharris commented 1 year ago

Are you using the same versions of the Mibble dependencies as those listed in the top level pom.xml?

faisal-ksolves commented 1 year ago

here is my complete pom.xml which is using tnm4j 1.2.0 in Apache NiFi ` <?xml version="1.0" encoding="UTF-8"?>

4.0.0 com.pnm pnm 1.0 nifi-PNMtest-processors jar org.soulwing.snmp tnm4j 1.2.0 org.apache.nifi nifi-api org.apache.nifi nifi-utils 1.20.0 org.apache.nifi nifi-mock 1.20.0 test org.slf4j slf4j-simple test org.junit.jupiter junit-jupiter-api test org.junit.jupiter junit-jupiter-engine test `
ceharris commented 1 year ago

What version of Java are you using at runtime?

faisal-ksolves commented 1 year ago

Java version 1.8

On Tue, 25 Jul, 2023, 9:36 pm Carl Harris, @.***> wrote:

What version of Java are you using at runtime?

— Reply to this email directly, view it on GitHub https://github.com/soulwing/tnm4j/issues/27#issuecomment-1650124942, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2P3LPYN545G6IZLXJZ6OALXR7VIJANCNFSM6AAAAAA2PT5ROQ . You are receiving this because you authored the thread.Message ID: @.***>

ceharris commented 1 year ago

Are you able to run the examples, particularly Example05_TableRetrievalUsingWalk, as described in the README?

faisal-ksolves commented 1 year ago

It is working fine in normal Java project, but when Im using it with Apache NIFi it shows the above error. You can create a sample NIFi project to test it. It will explain you the best.

On Wed, 26 Jul, 2023, 1:06 am Carl Harris, @.***> wrote:

Are you able to run the examples, particularly Example05_TableRetrievalUsingWalk, as described in the README?

— Reply to this email directly, view it on GitHub https://github.com/soulwing/tnm4j/issues/27#issuecomment-1650421291, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2P3LP7KZMG446AABOKFNHTXSAN2DANCNFSM6AAAAAA2PT5ROQ . You are receiving this because you authored the thread.Message ID: @.***>

ceharris commented 1 year ago

I think that if you run mvn dependency:tree in your project, you'll find that one of Apache NiFi dependencies is pulling in a different version of the Mibble dependencies than what is listed in the pom.xml for Tnm4j. You can probably configure an exclusion in your project's pom.xml to keep that from happening.

If you don't know how to interpret the output from mvn dependency:tree, I may be able to help with that.

faisal-ksolves commented 1 year ago

i try the mvn dependency:tree command and it shows the following data [INFO] com.pnm:nifi-PNMtest-nar:nar:1.0 [INFO] +- com.pnm:nifi-PNMtest-processors:jar:1.0:compile [INFO] | +- org.soulwing.snmp:tnm4j:jar:1.2.0:compile [INFO] | | +- org.snmp4j:snmp4j:jar:2.8.12:compile [INFO] | | +- net.percederberg.mibble:mibble:jar:2.9.3:compile [INFO] | | | - net.percederberg.grammatica:grammatica:jar:1.5:compile [INFO] | | +- net.percederberg.mibble:mibble-mibs:jar:2.9.3:runtime [INFO] | | - org.slf4j:log4j-over-slf4j:jar:2.0.6:provided [INFO] | - org.apache.nifi:nifi-utils:jar:1.20.0:compile [INFO] | - org.apache.nifi:nifi-api:jar:1.20.0:provided [INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.9.1:test [INFO] | +- org.opentest4j:opentest4j:jar:1.2.0:test [INFO] | +- org.junit.platform:junit-platform-commons:jar:1.9.1:test [INFO] | - org.apiguardian:apiguardian-api:jar:1.1.2:test [INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.9.1:test [INFO] | - org.junit.platform:junit-platform-engine:jar:1.9.1:test [INFO] +- org.junit.vintage:junit-vintage-engine:jar:5.9.1:test [INFO] | - junit:junit:jar:4.13.2:test [INFO] | - org.hamcrest:hamcrest-core:jar:1.3:test [INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.9.1:test [INFO] +- org.mockito:mockito-core:jar:3.12.4:test [INFO] | +- net.bytebuddy:byte-buddy:jar:1.11.13:test [INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.11.13:test [INFO] | - org.objenesis:objenesis:jar:3.2:test [INFO] +- org.mockito:mockito-junit-jupiter:jar:3.12.4:test [INFO] +- org.slf4j:slf4j-simple:jar:2.0.6:test [INFO] | - org.slf4j:slf4j-api:jar:2.0.6:provided [INFO] - org.codehaus.groovy:groovy-test:jar:3.0.14:test [INFO] - org.codehaus.groovy:groovy:jar:3.0.14:test

but surely there is no conflict. can you help me.

Thanks

ceharris commented 1 year ago

No conflict with the dependencies such as you've configured them, so I suggest you take a very close look at the runtime environment in which you're using Apache NiFi. That NoSuchMethodError indicates that there's an incompatible version of the net.percederberg.mibble.asn1.Asn1Parser class on the runtime class path.

I've offered as much help as I can offer at this point.