-
Notifications
You must be signed in to change notification settings - Fork 22
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
Loading Resources from JAR fails in experiments.sts2013baseline.util.StopwordFilter #13
Comments
Comment #1 originally posted by dkpro on 2013-08-19T15:51:01.000Z: There is actually at least one more bug of the same type... Figured out it an easier work-around is to copy the data needed (datasets, goldstandards, stopwords) from the jar file into a separate folder and add it manually to the class path... Cheers Michael |
Comment #2 originally posted by dkpro on 2013-08-19T15:53:55.000Z: Yes, this will certainly work, too. Could you point out the other location, where the same error occurs, so that we can fix that, too? ps: And thanks for the patch. |
Comment #4 originally posted by dkpro on 2013-08-19T16:03:50.000Z: Next one was caused by sts2013baseline.util.Features2Arff.toArffFile(Features2Arff.java:49) Exception in thread "main" java.io.FileNotFoundException: class path resource [goldstandards/semeval-2012/train/STS.gs.ALL.txt] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/mschuhma/.m2/repository/de/tudarmstadt/ukp/similarity/dkpro/de.tudarmstadt.ukp.similarity.dkpro.data-asl/1.0.1/de.tudarmstadt.ukp.similarity.dkpro.data-asl-1.0.1.jar!/goldstandards/semeval-2012/train/STS.gs.ALL.txt |
Comment #5 originally posted by dkpro on 2013-08-20T15:06:59.000Z: I fixed the issue at those two locations. |
A Similar problem surfaced at sts2013baseline.util.Evaluator.java (Evaluator.java:311) Exception in thread "main" java.io.FileNotFoundException: class path resource [goldstandards/semeval-2012/train/STS.gs.MSRpar.txt] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/.m2/repository/dkpro/similarity/dkpro.similarity.uima.data-asl/2.1.0/dkpro.similarity.uima.data-asl-2.1.0.jar!/goldstandards/semeval-2012/train/STS.gs.MSRpar.txt |
I am not sure whether your issue has the same cause. Could you please post the line where you load the file "goldstandards/semeval-2012/train/STS.gs.MSRpar.txt"? |
I get the error at the 2nd line. |
Can you just use the file path directly? 'File file = new File("goldstandards/semeval-2012/train/STS.gs.MSRpar.txt")'? Resource is a class which provides functionality to load files from a jar in the classpath. (It should work though...) |
The file "STS.gs.MSRpar.txt" is in the jar dkpro.similarity.uima.data-asl (version 2.1.0). Running from the command line will not work because several other dependencies are required. If you the dependencies to a maven project it should work fine. |
Thanks. I had all the dependencies in the maven project. The pipeline was running fine until this point and it was reading couple of other files from the dkpro.similarity.uima.data-asl, just that it was not able to read this particular file. |
Ok, I'm running out of ideas. It would be good if you could debug it. It might be due to another version of the artifact, but I'm not sure about that. |
Could you please try to navigate to the jar in the exception |
Yes it is there in the location. Regards On Thu, Oct 22, 2015 at 8:56 AM, Torsten Zesch [email protected]
|
If it is there, I don't see why the exception you have reported should be thrown. |
So this looks like the calling code is expecting the resource to be located in the file system and tries using getFile() to get a File object representing the resource. However, since the resource is in a JAR, it cannot be addressed using a File object. This would work if the user has DKPro Similarity checked out in the local machine (in which case the resource would be in the Maven target folder on disk), but not if the user is using the resource through a Maven dependency. |
Right. Thanks Richard. So the quick word around is to check out all of dkpro-similarity. |
Thanks Richard and Torsten. Regards On Fri, Oct 23, 2015 at 3:59 PM, Torsten Zesch [email protected]
|
Original issue 13 created by dkpro on 2013-08-19T14:46:06.000Z:
What steps will reproduce the problem?
Run terminates with Exception:
Caused by: java.io.FileNotFoundException: class path resource [stopwords/stopwords_english_punctuation.txt] cannot be resolved to absolute file path because it does not reside in the file system:
jar:file:/home/someuser/.m2/repository/de/tudarmstadt/ukp/similarity/dkpro/de.tudarmstadt.ukp.similarity.dkpro.data-asl/1.0.1/de.tudarmstadt.ukp.similarity.dkpro.data-asl-1.0.1.jar!/stopwords/stopwords_english_punctuation.txt
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:204)
at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:52)
at de.tudarmstadt.ukp.similarity.experiments.sts2013baseline.util.StopwordFilter.initialize(StopwordFilter.java:75)
... 15 more
Suggested Bugfix:
Replace res.getFile(); with res.getInputStream(); in
de.tudarmstadt.ukp.similarity.experiments.sts2013baseline.util.StopwordFilter.initialize(StopwordFilter.java:75)
The text was updated successfully, but these errors were encountered: