Hi Steinar,

I'm wondering why you need to write a java driver.

Is there something that the standalone server command line won't do for you? You can give a whole Jetty config file but "--port=4000" seems to do what you want.

A cmd script to run a service then makes running your setup easy - it's a common way to setup services on Windows (and Linux).

Or run the WAR in Tomcat because running tomcat as a service on windows is well documented with lots of help on StackOverflow and elsewhere.

Or repackage a custom setup in a WAR file (that's what they are for after all).


Fuseki needs to find the content for the UI. In standalone server form, the webpages are outside the jar and the code needs to find them. In war file form, the web pages are in the war file. In a war file, FUSEKI_HOME is not needed - createWebApp isn't called.

If FUSEKI_HOME is null, then it looks in "webapp" and "src/main/webapp" (more for develoopment mode) but setting environment variable FUSEKI_HOME is better.

        Andy

(who does not run Fuseki as a Windows service)

On 31/01/16 18:18, Steinar Bang wrote:
Hi,

I am trying to use the windows-service-installer maven plugin to create
a windows installer that will install a windows service that will run
Jena Fuseki.
  https://github.com/alexkasko/windows-service-installer

My DaemonLauncher for Jena Fuseki, is here:
  
https://github.com/steinarb/fusekiservice/blob/master/src/main/java/no/priv/bang/fuseki/fusekiservice/FusekiService.java

I have written a JUnit test that attempts to start and stop the service
(just to see if I can make it run at all).
  
https://github.com/steinarb/fusekiservice/blob/master/src/test/java/no/priv/bang/fuseki/fusekiservice/FusekiServiceTest.java

The JUnit test currently fails with the following console output:
  [2016-01-31 18:21:38] FusekiService INFO  FUSEKI_HOME: null
  [2016-01-31 18:21:38] Server     ERROR Can't find resourceBase (tried webapp 
and src/main/webapp)
  [2016-01-31 18:21:38] Server     ERROR Failed to start

So my question is: what am I missing from the FusekiService.startDaemon() 
method?

I have been stealing code from here (mainly):
  
https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java

The reason I haven tried using FusekiCmd, is that I would like to have
         JettyFuseki.instance.start();
in the startDaemon() method, and
         JettyFuseki.instance.join();
in the stopDaemon() method (unless I've misunderstood how they are
supposed to work...?)

The failing code, is in
  
https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/jetty/JettyFuseki.java
in the JettyFuseki.createWebApp() method.

The code in createWebapp() looks like it expects a directory, with
WEB-INF/web.xml residing in that directory (ie. WEB-INF a subdirectly of
the webapp directory), so I have been toying with the idea of
downloading and unpacking the fuseki webapp in a directory and give that
directory.

But even if I could make that work in a JUnit test, I have no idea of
how to accomplish the same thing in a windows service installed by an
installer created by the windows-service-installer maven plugin...

And the ready packaged jena fuseki starts and runs from a single .jar,
so unpacking something shouldn't be necessary.

So how should I proceed with this?  Is this doable?

Thanks!


- Steinar


Reply via email to