Andy,

where do you put JenaSystem.init() in unit tests, for example?

Using 3.16.0-SNAPSHOT, I've changed the test code a little and started
getting this - though only when I attempt to debug the ConstraintTest
class:

com.atomgraph.spinrdf.constraints.ConstraintTest  Time elapsed: 0.419
sec  <<< ERROR!
java.lang.NoClassDefFoundError:
org/apache/jena/sparql/engine/main/StageGenerator
at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29)
at org.apache.jena.sys.JenaSystem.lambda$init$2(JenaSystem.java:117)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.apache.jena.sys.JenaSystem.forEach(JenaSystem.java:192)
at org.apache.jena.sys.JenaSystem.forEach(JenaSystem.java:169)
at org.apache.jena.sys.JenaSystem.init(JenaSystem.java:115)
at 
com.atomgraph.spinrdf.constraints.ConstraintTest.<clinit>(ConstraintTest.java:51)

The call is in a static initializer:

public class ConstraintTest
{

    static
    {
        JenaSystem.init();
    }

Or is this unrelated to the JenaSystem.init()?

POM:

        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>apache-jena-libs</artifactId>
            <version>3.16.0-SNAPSHOT</version>
            <type>pom</type>
        </dependency>

On Mon, Jun 29, 2020 at 11:40 PM Martynas Jusevičius
<[email protected]> wrote:
>
> On Mon, Jun 29, 2020 at 6:34 PM Andy Seaborne <[email protected]> wrote:
> >
> >
> >
> > On 29/06/2020 14:47, Martynas Jusevičius wrote:
> > > Hi,
> > >
> > > I've got a class that is initialized with Jena's registered languages:
> >
> > And how/when is that called?
> >
> > I presume you don't use Jena initialization mechanism.
> >
> > https://jena.apache.org/documentation/notes/system-initialization
>
> You're right, I've missed that. JenaSystem.init() wasn't being called.
>
> > One thing as a general measure: call "JenaSystem.init()" early in statup
> > before requests come in.
>
> Yes. I was wondering where that could be in a webapp. But then I found
> the FusekiServerEnvironmentInit (ServletContextListener) and
> implemented the same and now it looks like the problem went away.
> https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java

Reply via email to