You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Andy Seaborne <an...@apache.org> on 2016/02/02 13:21:52 UTC

Re: Trying to create a Jena Fuseki Windows Service installer (Was: Running Fuseki as a Daemon or Windows Service)

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
>


Re: Trying to create a Jena Fuseki Windows Service installer

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@public.gmane.org>:
>>>>> Andy Seaborne <an...@public.gmane.org>:
>> I'm wondering why you need to write a java driver.

> Not something I _need_ to do, just something I would like to try out.

> I stumbled over this maven plugin
>   https://github.com/alexkasko/windows-service-installer
> and thought "hey, an MSI that would install jena fuseki as a windows
> service, that would be kind of cool".

Well, I won't get an msi... running
 mvn windows-service-installer:installer
on https://github.com/steinarb/fusekiservice currently gets me this, in
the target directory:
  -rw-rw-rw-  1 sb None 92126065 02-07 09:06 fusekiservice-0.0.1-SNAPSHOT-installer.zip
  -rw-rw-rw-  1 sb None 24859992 02-07 09:06 install.jar

Double-clicking on the "install.jar" starts an IzPack installer of the
stuff in the zip file (which in its the current state doesn't include
the unpacked jena fuseki webapp, so the it won't actually run).

(Note: I haven't actually run the installer fully through yet. I think I
will use a VM for that, at least for the first couple of runs)

Re: Trying to create a Jena Fuseki Windows Service installer

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Andy Seaborne <an...@public.gmane.org>:

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

Not something I _need_ to do, just something I would like to try out.

I stumbled over this maven plugin
  https://github.com/alexkasko/windows-service-installer
and thought "hey, an MSI that would install jena fuseki as a windows
service, that would be kind of cool".

> 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.

An msi would give an easier installation procedure for windows
sysadmins.  Fewer parts in motion that can go wrong.