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

loader constraint violation for ItemSequence #17

Open
johndowding opened this issue Jul 24, 2018 · 4 comments
Open

loader constraint violation for ItemSequence #17

johndowding opened this issue Jul 24, 2018 · 4 comments

Comments

@johndowding
Copy link

We have downloaded jcrfsuite, and we have no issues compiling and running the example programs. We are having a problem, though, when we try to combine jcrfsuite with our other Java code (to, for example, perform our own feature extraction and tag a single sentence). We get this error in dynamic class loading:

Exception in thread "main" java.lang.LinkageError: loader constraint violation: when resolving method "third_party.org.chokkan.crfsuite.crfsuiteJNI.ItemSequence_add(JLthird_party/org/chokkan/crfsuite/ItemSequence;JLthird_party/org/chokkan/crfsuite/Item;)V" the class loader (instance of jdk/internal/loader/ClassLoaders$AppClassLoader) of the current class, third_party/org/chokkan/crfsuite/ItemSequence, and the class loader (instance of jdk/internal/loader/ClassLoaders$PlatformClassLoader) for the method's defining class, third_party/org/chokkan/crfsuite/crfsuiteJNI, have different Class objects for the type third_party/org/chokkan/crfsuite/ItemSequence used in the signature
at third_party.org.chokkan.crfsuite.ItemSequence.add(ItemSequence.java:67)
at Tagger.generateFeatures(Tagger.java:67)
at Tagger.main(Tagger.java:115)

@deepsidhpura777
Copy link

I am getting a similar error with Item class' add() method. I am also trying to use my pre-trained model to tag a particular sequence.

Exception in thread "main" java.lang.LinkageError: loader constraint violation: when resolving method "third_party.org.chokkan.crfsuite.crfsuiteJNI.Item_add(JLthird_party/org/chokkan/crfsuite/Item;JLthird_party/org/chokkan/crfsuite/Attribute;)V" the class loader (instance of sun/misc/Launcher$AppClassLoader) of the current class, third_party/org/chokkan/crfsuite/Item, and the class loader (instance of sun/misc/Launcher$ExtClassLoader) for the method's defining class, third_party/org/chokkan/crfsuite/crfsuiteJNI, have different Class objects for the type third_party/org/chokkan/crfsuite/Item used in the signature
at third_party.org.chokkan.crfsuite.Item.add(Item.java:67)
at Inference.my_features(Inference.java:92)
at Inference.sent2feat(Inference.java:137)
at Inference.main(Inference.java:150)

Process finished with exit code 1

@johndowding
Copy link
Author

johndowding commented Jul 30, 2018 via email

@deepsidhpura777
Copy link

I added the static try catch block as you mentioned but I am still getting the same error. I am trying to use the Item object to add attributes for each word and ItemSequence to add each item. After that, I am passing the ItemSequence to Tagger.tag() method. Also, the CRFTagger class already has the same try catch block, so I don't know what exactly the error is? I really need help with this one ! Thanks !

@deepsidhpura777
Copy link

deepsidhpura777 commented Aug 8, 2018

I solved this problem by modifying CrfTagger.java with my own functions before doing a mvn clean install. It works for now but it would be convenient if we could directly access Item Class and ItemSeqeunce Class in our own java code, since it will tightly couple my functions with the library's functions, which I don't want !

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