Am trying to run load the classifier/model(english.muc.7class.distsim.crf.ser) from the Stanford NER project.This file is in RAR format in the classifiers folder in project.But am getting the following error:
Error loading classifier from jar file (most likely you are not
running this code from a jar file or the named classifier is not
stored in the jar file)
I have checked the path.Its correct.Also check with the gz extension.But not getting the result.I had run the same code few months back in jdk 1.6.Now am compiling same using jdk 1.5.
The classifier is stored in the folder and also am not running the code from JAR file.
Also tried extracting and giving that file name.But still the same error.
Please guide me.
Related
War is corrupted and getting an error of Unable to load MetDemo.war: Invalid file - not a PKZip file
when tried to expand it.
If I try to make an WAR by removing some contents then its working fine and deployed in server.
but if i tried to create an WAR with 1 GB content and WAR is getting corrupted .
Also tried updating the WAR plugin to the recent version but no luck
Is there is any size limit for generating the WAR.
hey hi I have written code and i tried running the jar but i got an exception saying that jar file cannot be opened and i even changed the file permissions and path is also set right but it is still showing me error saying that jar file cannot be opened.
Please suggest some solutions.
that is the error i got and even i have gone through the wordcount example also but could not get any answer.
Is your jar file in local file system or hdfs? The jar file should be in local file system.
I just got started with CoreNLP version 3.6.0. I've downloaded this version from this website. Using the commandline pipeline, I've been able to perform the standard pipeline annotators but ran into a problem with the truecase annotator:
Here's a copy of the terminal output:
loadClassifier=edu/stanford/nlp/models/truecase/truecasing.fast.caseless.qn.ser.gz
mixedCaseMapFile=edu/stanford/nlp/models/truecase/MixDisambiguation.list
classBias=INIT_UPPER:-0.7,UPPER:-0.7,O:0
Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: java.io.IOException: Unable to open "edu/stanford/nlp/models/truecase/truecasing.fast.caseless.qn.ser.gz" as class path, filename or URL
at edu.stanford.nlp.ie.AbstractSequenceClassifier.loadClassifierNoExceptions(AbstractSequenceClassifier.java:1499)
at edu.stanford.nlp.pipeline.TrueCaseAnnotator.(TrueCaseAnnotator.java:58)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.trueCase(AnnotatorImplementations.java:199)
at edu.stanford.nlp.pipeline.AnnotatorFactories$10.create(AnnotatorFactories.java:435)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:85)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:375)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:139)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.(StanfordCoreNLP.java:135)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1222)
Any ideas?
We tried to make the default models jar a bit smaller and decided to not include this model by default. But it is still contained in the English models jar which you can download from release history page.
After you downloaded the jar, make sure to put it in your classpath before you run CoreNLP. The English models jar should also contain everything in stanford-corenlp-3.6.0-models.jar, so you won't need both of them in your classpath.
I've been trying to figure out how execute my Map/Reduce job for almost 2 days now. I keep getting a ClassNotFound exception.
I've installed a Hadoop cluster in Ubuntu using Cloudera CDH4.3.0. The .java file (DemoJob.java which is not inside any package) is inside a folder called inputs and all required jar files are inside inputs/lib.
I followed http://www.cloudera.com/content/cloudera-content/cloudera-docs/HadoopTutorial/CDH4/Hadoop-Tutorial/ht_topic_5_2.html for reference.
I compile the .java file using:
javac -cp "inputs/lib/hadoop-common.jar:inputs/lib/hadoop-map-reduce-core.jar" -d Demo inputs/DemoJob.java
(In the link, it says -cp should be "/usr/lib/hadoop/:/usr/lib/hadoop/client-0.20/". But I don't have those folders in my system at all)
Create jar file using:
jar cvf Demo.jar Demo
Move 2 input files to HDFS
(Now this is where I'm confused. Do I need to move the jar file to HDFS as well? It doesn't say so in the link. But if it is not in HDFS, then how does the hadoop jar .. command work? I mean how does it combine the jar file which is in Linux system and the input files which are in HDFS?)
I run my code using:
hadoop jar Demo.jar DemoJob /Inputs/Text1.txt /Inputs/Text2.txt /Outputs
I keep getting ClassNotFoundException : DemoJob.
Somebody please help.
The class not found exception only means that some class wasn't found when class DemoJob was loaded. The missing class could have been a class referenced (imported, for example) by DemoJob. I think the problem is that you don't have the /usr/lib/hadoop/:/usr/lib/hadoop/client-0.20/ folders (classes) in your class path. It's the classes that should be there but aren't that probably are triggering the class not found exception.
Finally figured out what the problem was. Instead of creating a jar file from a folder, I directly created the jar file from the .class files using jar -cvf Demo.jar *.class
This resolved the ClassNotFound error. But I don't understand why it was not working earlier. Even when I created the jar file from a folder, I did mention the folder name when executing the class file as:hadoop jar Demo.jar Demo.DemoJob /Inputs/Text1.txt /Inputs/Text2.txt /Outputs
I was having an issue of reading CMYK JPEG images , and have used below url as reference for solving the issue.
http://www.randelshofer.ch/blog/2011/08/reading-cmyk-jpeg-images-with-java-imageio/
I have given the configuration org.monte.media.jpeg.CMYKJPEGImageReaderSpi in the file javax.imageio.spi.ImageReaderSpi under path /META-INF/services/javax.imageio.spi.ImageReaderSpi.
This works perfectly inside eclipse and the image reader is loaded successfully.
This file is not loading when deployed , i can find the folder and the file in the generated war file in my desired jar file inside lib folder, i guess i need to add it to java classpath.
Please help me to add to classpath or if there is any other issue with it.
You need to add this file as a static resource to your build lifecycle.
For Ant or Gradle you just need to write a simple copy task (Ant task, Gradle task), for Maven you can use Maven Resources Plugin.
After that your file should appears in your app package.