NoClassDefFoundError for the classes of another plugin

(chenjinyuan87) #1

I'm developing a plugin which holds a synonym dic and a custom Query.
The custom query make advantage of the synonym dic to search synonyms at the same time.

And since synonyms are always acceptable words, i need to add them to the Chinese analyzer(ansj analyzer).
But i found it fails because of NoClassDefFoundError ?
I'm sure the analyzer plugin works.

(David Pilato) #2

Are you trying to call from your own plugin the smartcn analyzer plugin?

If so, this won't work because plugins are running in their own classloaders.
So you need to add in your own plugin all the Lucene needed deps for smartcn.

(chenjinyuan87) #3

Yes, that's my situation. (I use ansj analyzer not smartcn)
So it means i have to develop a plugin containing the following functionalities:
1: a Chinese analyzer
2: a custom query
3: a dic manager

I think such code is so ugly, is there any other solution?


(David Pilato) #4

So you can't call the code from one plugin to another.
I can't tell more without understanding the libs you are using but basically yes, wrap all needed dependencies within your plugin and you'll be good.

(chenjinyuan87) #5

Thank you.
I have to find another way to design the two plugins.

(system) #6