Skip to content
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

jena and maven -- build error #16

Closed
pnrobinson opened this issue Jan 8, 2018 · 5 comments
Closed

jena and maven -- build error #16

pnrobinson opened this issue Jan 8, 2018 · 5 comments

Comments

@pnrobinson
Copy link
Member

No description provided.

@kingmanzhang
Copy link
Member

@ielis @pnrobinson
I forgot what this ticket was originally for, but I encountered a strange error to me with Jena. I can build Jar successfully, and the app works from the IDE. But Jena fails to create hpo for us. The error is in this class:
https://github.com/monarch-initiative/loinc2hpo/blob/develop/loinc2hpogui/src/main/java/org/monarchinitiative/loinc2hpo/io/OntologyModelBuilderForJena.java

It starts Line 33, but fails to complete it:
[Thread-8] TRACE (OntologyModelBuilderForJena.java:27) - enter function to build ontology model for Sparql query
[Thread-8] DEBUG (JenaSystem.java:212) - Jena initialization
[Thread-8] DEBUG (SystemTDB.java:334) - System architecture: 64 bit

---Then this thread fails and goes to JavaFx thread, triggering thread failure listener.

What do you think is happening?

@kingmanzhang
Copy link
Member

Vida has helped me to pinpoint to the error line. It has nothing to do with thread, but how Jena works. I will do more research on this.

@kingmanzhang
Copy link
Member

kingmanzhang commented Feb 24, 2018

New suspicion is that Jena is working incorrectly in jar.

From Jar, calling Jena (to build HPO model) terminates here:

[Thread-6] TRACE (OntologyModelBuilderForJena.java:29) - enter function to build ontology model for Sparql query
[Thread-6] DEBUG (JenaSystem.java:212) - Jena initialization
[Thread-6] DEBUG (SystemTDB.java:334) - System architecture: 64 bit

From IDE:

[Thread-6] TRACE (OntologyModelBuilderForJena.java:29) - enter function to build ontology model for Sparql query
[Thread-6] DEBUG (JenaSystem.java:212) - Jena initialization
[Thread-6] TRACE (SystemUtils.java:37) - Using thread classloader
[Thread-6] DEBUG (FileManager.java:158) - Add location: LocatorFile
[Thread-6] DEBUG (FileManager.java:158) - Add location: ClassLoaderLocator
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:location-mapping.rdf
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:location-mapping.rdf
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:location-mapping.n3
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:location-mapping.n3
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:location-mapping.ttl
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:location-mapping.ttl
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:etc/location-mapping.rdf
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:etc/location-mapping.rdf
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:etc/location-mapping.n3
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:etc/location-mapping.n3
[Thread-6] TRACE (LocatorFile.java:112) - Not found: file:etc/location-mapping.ttl
[Thread-6] TRACE (LocatorClassLoader.java:67) - Failed to open: file:etc/location-mapping.ttl
[Thread-6] DEBUG (LocationMapper.java:152) - Failed to find configuration: file:location-mapping.rdf;file:location-mapping.n3;file:location-mapping.ttl;file:etc/location-mapping.rdf;file:etc/location-mapping.n3;file:etc/location-mapping.ttl
[Thread-6] DEBUG (FileManager.java:158) - Add location: LocatorFile
[Thread-6] DEBUG (FileManager.java:158) - Add location: LocatorURL
[Thread-6] DEBUG (FileManager.java:158) - Add location: ClassLoaderLocator
[Thread-6] TRACE (LocatorFile.java:159) - Not found: location-mapping.ttl
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: location-mapping.ttl
[Thread-6] TRACE (LocatorFile.java:159) - Not found: location-mapping.rdf
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: location-mapping.rdf
[Thread-6] TRACE (LocatorFile.java:159) - Not found: location-mapping.n3
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: location-mapping.n3
[Thread-6] TRACE (LocatorFile.java:159) - Not found: etc/location-mapping.rdf
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: etc/location-mapping.rdf
[Thread-6] TRACE (LocatorFile.java:159) - Not found: etc/location-mapping.n3
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: etc/location-mapping.n3
[Thread-6] TRACE (LocatorFile.java:159) - Not found: etc/location-mapping.ttl
[Thread-6] TRACE (LocatorClassLoader.java:65) - Failed to open: etc/location-mapping.ttl
[Thread-6] DEBUG (JenaIOEnvironment.java:180) - Failed to find configuration: location-mapping.ttl;location-mapping.rdf;location-mapping.n3;etc/location-mapping.rdf;etc/location-mapping.n3;etc/location-mapping.ttl
[Thread-6] DEBUG (SystemTDB.java:334) - System architecture: 64 bit

So It appears Jena fails to execute many codes...
Let's discuss this on Monday @pnrobinson

@pnrobinson
Copy link
Member Author

Hi Aaron -- I do not think those Jena warnings are critical, I am seeing something like them with another program that uses Jena, and the level is TRACE or DEBUG only. If you put a logger.trace right after the line in question, do you see it? Also, try the debugger, get it to go into the function. We can discuss on Monday!

@kingmanzhang
Copy link
Member

kingmanzhang commented Feb 26, 2018

@pnrobinson
Okay, we finally have a fix. Here is the solution:

  1. Apparently we need to explicitly tell Jar how we want to initiate Jena. So write a class that implements Jena interface JenaSubsystemLifecycle
  2. Add a plugin to pom file
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <configuration>
        <shadedArtifactAttached>false</shadedArtifactAttached>
        <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
        </transformers>

    </configuration>
</plugin>
  1. In Java resource folder, create a file under META-INF-services named "org.apache.jena.system.JenaSubsystemLifecycle", within the file put in the class created in step 1.

Now it should work, although I'm still quite confused of all the stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants