Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

疑似冲突造成的bug:java.lang.NoSuchMethodError #4

Open
BigPig-LittleTail opened this issue May 20, 2019 · 1 comment
Open

疑似冲突造成的bug:java.lang.NoSuchMethodError #4

BigPig-LittleTail opened this issue May 20, 2019 · 1 comment

Comments

@BigPig-LittleTail
Copy link

我将完整的THUCTC的Demo项目作为moudle引入到自己的工程中,Demo在其自己的moudle中可以正常运行,但我将Demo的代码复制到自己的工程中时,会出现以下错误:

Exception in thread "main" java.lang.NoSuchMethodError: org.tartarus.snowball.Among.<init>(Ljava/lang/String;IILjava/lang/String;Lorg/tartarus/snowball/SnowballProgram;)V
	at org.tartarus.snowball.ext.porterStemmer.<clinit>(porterStemmer.java:18)
	at org.thunlp.language.english.EnglishWordSegment.<init>(EnglishWordSegment.java:28)
	at org.thunlp.language.english.BilingualBigramWordSegment.segment(BilingualBigramWordSegment.java:44)
	at org.thunlp.text.classifiers.LiblinearTextClassifier.classify(LiblinearTextClassifier.java:541)
	at org.thunlp.text.classifiers.BasicTextClassifier.classifyText(BasicTextClassifier.java:477)
	at hit.zhou.Classifacation.runLoadModelAndUse(Classifacation.java:65)
	at hit.zhou.Classifacation.main(Classifacation.java:13)

我在检索解决方案的时候发现了类似的其他开源项目中的问题:Stratio/cassandra-lucene-index#216 (comment)
他的解释是,高低版本的snowball冲突,并完成了修复。
我发现自己的工程中确实引入了高版本的snowball包,但是遗憾的是我并不能将它降低版本。高版本中的Amog类的构造方法发生了改变,造成了这个错误。
我花了几分钟的时间将org.thunlp中的代码改造了一下,实际上做的工作就是更改了一下类的命名。希望能够提醒代码的维护者和仍在使用代码的人。

@topstephen
Copy link

我也遇上了相同的问题,原因是自己项目中导入了Lucene的snowball ,解决方案 修改THUCTC工程中snowball 包路径,重新打成jar包,再引入自己工程即可。THX!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants