duydo/elasticsearch-analysis-vietnamese

Lỗi Could not find plugin class [org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin]

vituthanh opened this issue · 8 comments

Chào các anh, em cài plugin elasticsearch-analysis-vietnamese với file jar, sau khi cài plugin xong thì start elasticsearch hiện lỗi như này.

[2023-04-15T12:27:19,674][INFO ][o.e.n.Node ] [DESKTOP-55JDMM9] version[7.17.1], pid[11928], build[default/zip/e5acb99f822233d62d6444ce45a4543dc1c8059a/2022-02-23T22:20:54.153567231Z], OS[Windows 10/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/11.0.17/11.0.17+10-LTS-269]
[2023-04-15T12:27:19,684][INFO ][o.e.n.Node ] [DESKTOP-55JDMM9] JVM home [C:\Program Files\Java\jdk-11.0.17], using bundled JDK [false]
[2023-04-15T12:27:19,685][INFO ][o.e.n.Node ] [DESKTOP-55JDMM9] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.io.tmpdir=C:\Users\vitut\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms1024m, -Xmx1024m, -XX:MaxDirectMemorySize=536870912, -Delasticsearch, -Des.path.home=D:\Software\elasticsearch-7.17.1, -Des.path.conf=D:\Software\elasticsearch-7.17.1\config, -Des.distribution.flavor=default, -Des.distribution.type=zip, -Des.bundled_jdk=true]
[2023-04-15T12:27:24,201][ERROR][o.e.b.Bootstrap ] [DESKTOP-55JDMM9] Exception
org.elasticsearch.ElasticsearchException: Could not find plugin class [org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin]
at org.elasticsearch.plugins.PluginsService.loadPluginClass(PluginsService.java:779) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:738) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:533) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:170) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:411) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) [elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) [elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) [elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.1.jar:7.17.1]
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:476) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:904) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:398) ~[?:?]
at org.elasticsearch.plugins.PluginsService.loadPluginClass(PluginsService.java:777) ~[elasticsearch-7.17.1.jar:7.17.1]
... 15 more
[2023-04-15T12:27:24,209][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [DESKTOP-55JDMM9] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: ElasticsearchException[Could not find plugin class [org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin]]; nested: ClassNotFoundException[org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.1.jar:7.17.1]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.1.jar:7.17.1]
Caused by: org.elasticsearch.ElasticsearchException: Could not find plugin class [org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin]
at org.elasticsearch.plugins.PluginsService.loadPluginClass(PluginsService.java:779) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:738) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:533) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:170) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:411) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.17.1.jar:7.17.1]
... 6 more
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.plugin.analysis.vi.AnalysisVietnamesePlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:476) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:904) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:398) ~[?:?]
at org.elasticsearch.plugins.PluginsService.loadPluginClass(PluginsService.java:777) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:738) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:533) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:170) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:411) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.1.jar:7.17.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.17.1.jar:7.17.1]
... 6 more

duydo commented

@vituthanh Update code mới về build lại nhé.

Em xóa cái test thì build ok r anh

Cho mình hỏi bạn build từ branch nào vậy, mình dùng branch 7.x build ok nhưng cài vào ES vẫn lỗi như trên.

@vituthanh bạn dùng ES 7.17.1 phải không

Mình build từ master thì lỗi không build được, nếu được bạn cho mình xin file build với, cảm ơn bạn nhiều nha

duydo commented

Build thì cần có dict vi ở máy, bạn vào xóa những gì liên quan đến test đi

@vituthanh Khi build coccoc-tokenizer thì đã có dicts luôn rồi nên sau khi build xong cần verify lại đã build thành công chưa nhé. Xem README trong nhánh master có phần verify tokenizer.

git clone https://github.com/duydo/coccoc-tokenizer.git
cd coccoc-tokenizer && mkdir build && cd build
cmake -DBUILD_JAVA=1 ..
make install
# Link the coccoc shared lib to /usr/lib
sudo ln -sf /usr/local/lib/libcoccoc_tokenizer_jni.* /usr/lib/

Verify

/usr/local/bin/tokenizer "Cộng hòa Xã hội chủ nghĩa Việt Nam"
# Output: cộng hòa	xã hội	chủ nghĩa	việt nam

khi mình chạy /usr/local/bin/tokenizer "Cộng hòa Xã hội chủ nghĩa Việt Nam"
Mình bị báo lỗi "Error openning file, alphabetic"
Lỗi này fix sao vậy anh @duydo