*java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.rdf.model.ModelFactory
*

so it tried to initialize and failed. It is there and found.

There are some old looking dependencies in the POM

org.eclipse.lyo.oslc4j.core:oslc4j-jena-providerfor example depends on Jena 3.6.0
httpclient is v4.1.1  / jena uses 4.5.10
slf4j is 1.6.6 - Jena uses 1.7.26

and others.

I'd start by looking at the dependency resolution for the project and see what dependency:tree shgows.

Didn't the stacktrace have details?

JENA-1537 is about not depending on Xerces anymore. If it is still on the dependencies, it shouldn't matter.  Jena 3.13 will ignore it for the datatype support - it may get packed up for general XML parsing.

    Andy

On 11/10/2019 15:10, PERRAULT Julien (EXT) wrote:

Hello,

As part of a version upgrade of a plugin for Jira (based on Ericsson's OSLC project - https://github.com/Ericsson/jira-oslc-plugin), I am experiencing problems related to Jena.

The functional plugin used packages from « com.hp.hpl.jena.* » in version 2.7.1. We wanted to move to the new repository (org.apache.jena.*).

Here is the piece of code that is problematic:

if (responseCode == 200) {

try {

InputStream is = resp.getEntity().getContent();

Model rdfModel = null;

            rdfModel = ModelFactory.createDefaultModel(); //Bug here !

rdfModel.read(is, null);

RootServices rs = newRootServices();

finalString ns = "http://jazz.net/xmlns/prod/jazz/jfs/1.0/";;

rs.setOAuthAccessTokenURL(OSLCUtils.getProperty(rdfModel, ns, "oauthAccessTokenUrl"));

rs.setOAuthDomain(OSLCUtils.getProperty(rdfModel, ns, "oauthDomain"));

rs.setOAuthRequestConsumerKeyURL(OSLCUtils.getProperty(rdfModel, ns, "oauthRequestConsumerKeyUrl"));

rs.setOAuthRequestTokenURL(OSLCUtils.getProperty(rdfModel, ns, "oauthRequestTokenUrl"));

rs.setOAuthUserAuthorizationURL(OSLCUtils.getProperty(rdfModel, ns, "oauthUserAuthorizationUrl"));

return rs;

          }

catch (Exception ex) {

log.error(CURRENT_CLASS + "." + currentMethod + " Exception: " + ex.getMessage());

ex.printStackTrace();

            responseCode = 500;

            responsePhrase = "Error in parsing response data!\\nSource isn't root services or malformed!";

          }

        }

During our development, with the latest version (3.13.0 and in all versions > 3.6) we observed a blocking bug when executing the following function:.

rdfModel = ModelFactory.createDefaultModel(); // Bug here !

The following error message is displayed:

*« java.lang.NoClassDefFoundError: Could not initialize class org.apache.jena.rdf.model.ModelFactory »*

[

at com.ericsson.jira.oslc.oslcclient.Client.getRootServicesDetails(Client.java:140) [?:?]

                at com.ericsson.jira.oslc.servlet.RootServicesManagementServlet.doPost(RootServicesManagementServlet.java:164) [?:?]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [servlet-api.jar:?]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:?]

                at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:37) [atlassian-plugins-servlet-5.2.1.jar:?]

[next lines are omitted]

]

As a result we tried with older versions like 3.6 and the bug no longer appeared. The following line of the program is executed which highlights a bug fixed since 3.8: "XMLParser" (https://issues.apache.org/jira/browse/JENA-1537).

The error code « java.lang.NoClassDefFoundError » is known and related to the absence during the execution of the class.

I checked the presence of the «org.apache.jena.rdf.model.ModelFactory » class in the compiled jar. Moreover, I am surprised to see that Java sends us an error code when the class only has static methods.

Have you ever encountered this bug or do you have any areas of study?

I suspected a Maven compilation problem but my research did not succeed. As an attachment, I have included the project's pom.xml.

Thank you in advance for the time you will devote to my problem

Have a good day to you,

Julien Perrault

Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'attention exclusive de ses destinataires. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur par e-mail. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. Les communications sur Internet n'etant pas securisees, l'expediteur informe qu'il ne peut accepter aucune responsabilite quant au contenu de ce message.

This mail message and attachments (the "message") are solely intended for the addressees.
It is confidential in nature .
If you receive this message in error, please delete it and immediately notify the sender by e-mail. Any use other than its intended purpose, dissemination or disclosure, either whole or partial, is prohibited except if formal approval is granted. As communication on the Internet is not secure, the sender does not accept responsibility for the content of this message.

Reply via email to