-
Notifications
You must be signed in to change notification settings - Fork 35
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
Comments
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 Process finished with exit code 1 |
We actually did find a work-around for this issue. In the class
containing our 'main' function, we added:
static {
try {
CrfSuiteLoader.load();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
I can't say I really understand why it works, but it does seem to.
…On Mon, Jul 30, 2018 at 3:03 PM Deep Sidhpura ***@***.***> wrote:
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
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AScFP30bh_0BjTFHnnKAW7YDldMjAheLks5uL4K8gaJpZM4VeFQJ>
.
|
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 ! |
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 ! |
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)
The text was updated successfully, but these errors were encountered: