vncorenlp / VnCoreNLP

A Vietnamese natural language processing toolkit (NAACL 2018)
Other
587 stars 145 forks source link

JVM exception occurred: vn/pipeline/VnCoreNLP java.lang.NoClassDefFoundError #43

Closed Tryhard-tohave-a-happylife closed 1 year ago

Tryhard-tohave-a-happylife commented 1 year ago

I followed all steps in the instruction for python users and i got the problem like this when i tried to create the model:

/usr/local/lib/python3.7/dist-packages/py_vncorenlp/vncorenlp.py in init(self, max_heap_size, annotators, save_dir) 52 jnius_config.set_classpath(save_dir + "/VnCoreNLP-1.1.1.jar") 53 from jnius import autoclass ---> 54 javaclass_vncorenlp = autoclass('vn.pipeline.VnCoreNLP') 55 self.javaclass_String = autoclass('java.lang.String') 56 self.annotators = annotators /usr/local/lib/python3.7/dist-packages/jnius/reflect.py in autoclass(clsname, include_protected, include_private) 209 210 # c = Class.forName(clsname) --> 211 c = find_javaclass(clsname) 212 if c is None: 213 raise Exception('Java class {0} not found'.format(c)) jnius/jnius_export_func.pxi in jnius.find_javaclass() jnius/jnius_utils.pxi in jnius.check_exception() JavaException: JVM exception occurred: vn/pipeline/VnCoreNLP java.lang.NoClassDefFoundError

How could i handle this problem ? Thanks

ndcuong91 commented 1 year ago

So do I I haven't find any solutions yet

datquocnguyen commented 1 year ago

Please provide more details, also, did you install the prerequisite Java 1.8+ ?

ledaiviet commented 1 year ago

@Tryhard-tohave-a-happylife @ndcuong91 I have the same problems with you guys, but may be you do not notice that we need to use the absolute path in save_dir. For example:

py_vncorenlp.download_model(save_dir='/mnt/d/Admin_user/Model/vncorenlp')

When you do not use the absolute path like:

py_vncorenlp.download_model(save_dir='../Model/vncorenlp')

you will get errors because in vncorenlp.py the jnius_config set path in 'save_dir+VnCoreNLP-1.1.1.jar', in this case this is the '../Model/vncorenlp/VnCoreNLP-1.1.1.jar' as the path for getting the class, but the os can not found that path so no class will be found

ndcuong91 commented 1 year ago

@ledaiviet It works. Thank you so much!

vantanco commented 7 months ago

For me it is different, because my dir have space so it regconise as Text%20Text