Konrad Höffner - 2011-09-15

I have an application A that uses application B that uses JWNL .
As B is referenced via Maven, B is packed in a jarfile including the wordnet dictionary.
As JWNL seems to use files instead of resources, it cannot open it's dictionary anymore,
because I get Exceptions such as:

java.io.FileNotFoundException: src/main/resources/tbsl/dict/index.verb (No such file or directory)

Now is there a way to change B so that it still works from inside the jarfile?

The full exception:
net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.FileBackedDictionary
Generating SPARQL query templates…
at net.didion.jwnl.util.factory.Element.install(Element.java:34)
at net.didion.jwnl.JWNL.initialize(JWNL.java:157)
at org.dllearner.algorithm.tbsl.nlp.WordNet.<init>(WordNet.java:20)
at org.dllearner.algorithm.tbsl.templator.Templator.<init>(Templator.java:72)
at org.dllearner.algorithm.tbsl.learning.SPARQLTemplateBasedLearner.<init>(SPARQLTemplateBasedLearner.java:125)
at org.dllearner.algorithm.tbsl.learning.SPARQLTemplateBasedLearner.<init>(SPARQLTemplateBasedLearner.java:111)
at org.autosparql.server.search.TBSLSearch.<init>(TBSLSearch.java:37)
at org.autosparql.server.search.TBSLSearchTest.testGetExamples(TBSLSearchTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
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:50)
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: net.didion.jwnl.JWNLException: The properties file must specify a dictionary path
at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:34)
at net.didion.jwnl.dictionary.FileBackedDictionary.install(FileBackedDictionary.java:100)
at net.didion.jwnl.util.factory.Element.install(Element.java:32)
… 29 more
Caused by: net.didion.jwnl.JWNLException: Could not create a file manager of type class net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:71)
at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:32)
… 31 more
Caused by: java.io.FileNotFoundException: src/main/resources/tbsl/dict/index.verb (No such file or directory)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:233)
at net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile.openFile(PrincetonRandomAccessDictionaryFile.java:76)
at net.didion.jwnl.dictionary.file.AbstractDictionaryFile.open(AbstractDictionaryFile.java:58)
at net.didion.jwnl.dictionary.file.DictionaryCatalog.open(DictionaryCatalog.java:46)
at net.didion.jwnl.dictionary.file.DictionaryCatalogSet.open(DictionaryCatalogSet.java:34)
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.<init>(FileManagerImpl.java:54)
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:69)
… 32 more