Hi,
I am trying to use Stanford NER and Stanford POS tagger in one
application. I am getting IncompatibleClassChangeError when I try to run
POS tagger method.
I have jar files of both NER and POS tagger in the class path. If I remove
jar of NER from my classpath then this error is not coming. I guess there
are some classes common in NER jar and POS jar and java is not able to
determine which class to be used at runtime.
Following is the stacktrace :
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.init(MaxentTagger.java:407)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:699)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:673)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:280)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:260)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.runTagger(MaxentTagger.java:1305)
at
edu.stanford.nlp.tagger.maxent.MaxentTagger.main(MaxentTagger.java:1499)
at
com.tcs.srl.stanford.POSWrapper.executePOSTagger(POSWrapper.java:39)
at
com.tcs.srl.stanford.test.POSWrapperTester.ExecutePOSTagger(POSWrapperTester.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
have no clue why this error is coming. Can anyone please help?
If you need more details then please let me know.
I saw some mails on this mailing list and found out that few people have
faced this problem. I have downloaded and tried to use CoreNLP but when I
add all the jar files that came with CoreNLP to project, I get
java.io.InvalidClassException error. Following is the stacktrace:
at
edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifierNoExceptions(
AbstractSequenceClassifier.java:1224)
at
edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifierNoExceptions(
AbstractSequenceClassifier.java:1175)
at edu.stanford.nlp.ie.crf.CRFClassifier.main(
CRFClassifier.java:2293)
at com.tcs.srl.stanford.NERWrapper.ExecuteNER(NERWrapper.java:105)
at com.tcs.srl.stanford.test.NERWrapperTester.executeNER(
NERWrapperTester.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(
ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184
)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:197)
Caused by: java.io.InvalidClassException: edu.stanford.nlp.util.Index;
local class incompatible: stream classdesc serialVersionUID =
5398562825928375260, local class serialVersionUID = 533612384823468898
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at edu.stanford.nlp.ie.crf.CRFClassifier.loadClassifier(
CRFClassifier.java:2138)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(
AbstractSequenceClassifier.java:1093)
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifier(
AbstractSequenceClassifier.java:1210)
at
edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifierNoExceptions(
AbstractSequenceClassifier.java:1221)
Please help to use NER and POS tagger in single project.
Thanks and Regards,
Chandrashekhar Dilip Kotekar
Tata Consultancy Services
Cell:- 9766632117
Mailto: shekhar.kotekar at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/java-nlp-user/attachments/20110513/83f07180/attachment.html>