metafacture / metafacture-core

Core package of the Metafacture tool suite for metadata processing.
https://metafacture.org
Apache License 2.0
71 stars 34 forks source link

Error message in Git Bash #370

Closed UBmakla closed 3 years ago

UBmakla commented 3 years ago

log4j:ERROR Could not parse url [...] java.io.FileNotFoundException:

dr0i commented 3 years ago

Could you provide some more information? What did you execute?

UBmakla commented 3 years ago

I tried to edit a file with Metafacture 5.2.0 (first time using the new version) $ /c/Users[...]metafactureCore520/flux.sh lobid2eisirTest.xml.flux then I get the error message, my colleague as well. I hope this information helps.

dr0i commented 3 years ago

Could you paste the content of your lobid2eisirTest.xml.flux? I suspect some file referenced there is not found.

UBmakla commented 3 years ago

Here it is, but it worked with version 5.1.2.

default morphDir = ""; default namespacesFile = "lobid2eisir.namespaces.properties";

default sourceFile = "lobid2eisirTest.inputAlma.xml"; default targetFile = "lobid2eisirTest.output.xml";

default morphFile1 = morphDir + "lobid2eisirTest.morph1-Alma.xml"; default morphFile2 = morphDir + "lobid2eisirTest.morph2-Alma.xml";

sourceFile | open-file | decode-xml | handle-generic-xml("record") | morph(morphFile1) | morph(morphFile2) | stream-to-xml(roottag="EISIR:data", recordtag="EISIR:record", namespaceFile=namespacesFile) | write(targetFile);

dr0i commented 3 years ago

Ok, hm, not sure what's wrong. You don't have a URL or filename given as error? Do you only get "Could not parse url [...] java.io.FileNotFoundException:", i.e. an [...] ? At the moment I don't have an idea why this should work with 5.1.2 but not with 5.2. Where does the sourceFile etc. reside? It is also crucial from where you execute the flux.sh. If you want to be independent of the place of execution you should not use morphDir but FLUX_DIR (a predefined variable) instead and place all needed files relative to the path where the flux.sh reside:

Paths are always relative to the directory within which the flux command is executed. To address files relative to the location of the executed flux file, use the predefined FLUX_DIR variable.

(https://github.com/metafacture/metafacture-core/wiki/Flux-user-guide#writing-flux-files)

fsteeg commented 3 years ago

default morphDir = "";

Could this be caused by a missing morphDir variable that needs to be passed when running flux.sh (see https://github.com/metafacture/metafacture-core/wiki/Flux-user-guide#provide-arguments)? Are the morph files in the same location as the flux file? Then you could try default morphDir = FLUX_DIR; instead of the line above.

UBmakla commented 3 years ago

Perhaps the complete error message (and also the message that it worked with Metafacture 5.1.2) helps

mmanklas@UB-ZB-t32 MINGW64 ~/Desktop/Homeoffice/Metafacture/Beispiele-Tests/TestMetafacture5.2
$ /c/Users/mmanklas/Desktop/Homeoffice/Metafacture/metafactureCore512/flux.sh lobid2eisirTest.xml.flux

mmanklas@UB-ZB-t32 MINGW64 ~/Desktop/Homeoffice/Metafacture/Beispiele-Tests/TestMetafacture5.2
$ /c/Users/mmanklas/Desktop/Homeoffice/Metafacture/metafactureCore520/flux.sh lobid2eisirTest.xml.flux
log4j:ERROR Could not parse url [file:////c/Users/mmanklas/Desktop/Homeoffice/Metafacture/metafactureCore520/config/log4j.xml].
java.io.FileNotFoundException: \\c\Users\mmanklas\Desktop\Homeoffice\Metafacture\metafactureCore520\config\log4j.xml (Der Netzwerkpfad wurde nicht gefunden)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:765)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:871)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:778)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.slf4j.impl.Log4jLoggerFactory.<init>(Log4jLoggerFactory.java:66)
        at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
        at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:45)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
        at org.metafacture.metamorph.Metamorph.<clinit>(Metamorph.java:104)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.metafacture.commons.reflection.ConfigurableClass.newInstance(ConfigurableClass.java:101)
        at org.metafacture.commons.reflection.ObjectFactory.newInstance(ObjectFactory.java:67)
        at org.metafacture.flux.parser.FluxProgramm.createElement(FluxProgramm.java:70)
        at org.metafacture.flux.parser.FluxProgramm.addElement(FluxProgramm.java:81)
        at org.metafacture.flux.parser.FlowBuilder.pipe(FlowBuilder.java:736)
        at org.metafacture.flux.parser.FlowBuilder.flowtail(FlowBuilder.java:514)
        at org.metafacture.flux.parser.FlowBuilder.flow(FlowBuilder.java:226)
        at org.metafacture.flux.parser.FlowBuilder.flux(FlowBuilder.java:122)
        at org.metafacture.flux.FluxCompiler.compileFlow(FluxCompiler.java:54)
        at org.metafacture.flux.FluxCompiler.compile(FluxCompiler.java:42)
        at org.metafacture.runner.Flux.main(Flux.java:79)
dr0i commented 3 years ago

It seems that config/log4j.xml is missing resp. not accessible, while I can confirm that it is part of the distribution (and the main branch). Can you try https://github.com/metafacture/metafacture-core/#getting-started step-by-step and " 4. Run one of the example scripts:" ? Please report if this works for you. Your problem may originate from using an NFS mount (or at least something similar, a non-local hard disk).

UBmakla commented 3 years ago

config/log4j.xml is available und looks like in 5.1.2. I tried the steps in https://github.com/metafacture/metafacture-core/#getting-started, the example works but not my case described above, same error message.

UBmakla commented 3 years ago

After our jitsi meeting yesterday I tried what we discussed. Results and good news: the process runs despite the error message, the output file looks fine. In my Linux VM the process runs without an error message, same in Windows cmd.

dr0i commented 3 years ago

OK - great! I found some notes in the internet about problems regarding files on Windows with "git bash" so I assume you just ran into such an incident. Going to close this issue with the remark that "git bash" is not recommended when using metafacture and that it's better to use other alternatives like those you've mentioned. Closing.