Hamilton-dfp opened a new issue, #2106:
URL: https://github.com/apache/jena/issues/2106

   ### Version
   
   4.10
   
   ### What happened?
   
   Hey, folks. I'm having issues getting a FusekAutoModule to load. I'm 
reporting this as a defect because I believe I've followed the 
[documentation](https://jena.apache.org/documentation/fuseki2/fuseki-modules.html#automatically-loaded)
 and the 
[example](https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFusekiMain_3_FusekiModule.java#L56)
 correctly, but I will admit to being unfamiliar to ServiceLoaders, so it's 
possible I'm missing something obvious.
   
   Steps to reproduce:
   
   1. Test Module:
   ```
   package ai.test.fuseki;
   
   import org.apache.jena.fuseki.main.FusekiServer;
   import org.apache.jena.fuseki.main.sys.FusekiAutoModule;
   
   public class HelloFuseki implements FusekiAutoModule {
   
       public HelloFuseki() {}
   
       @Override
       public String name() {
           return "HelloFuseki";
       }
   
       @Override
       public void serverAfterStarting(FusekiServer server) {
           System.out.println("*********************************** Hello 
Fuseki");
       }
   }
   ```
   2. In my resources directory I added `META-INF/services` folder and a file 
named `org.apache.jena.fuseki.main.sys.FusekiAutoModule` with a single line:
   ```
   ai.test.fuseki.HelloFuseki
   ```
   3. Compiled jar. See attached (renamed `.jar` to `.zip` for upload purposes 
only)
   4. Added compiled jar to `run/extra` directory in my extracted service, as 
described in 
[fuseki-service](https://github.com/apache/jena/blob/0aa670f077baae18810946a607fb862f11afab58/jena-fuseki2/apache-jena-fuseki/fuseki-server#L128).
   5. Started application with `sh fuseki-server`
   
   Expected Results:
   I should see the output String `*********************************** Hello 
Fuseki` in my terminal output.
   
   Actual Results:
   I see no indication that my module was loaded and do not see the expected 
output.
   
   Additional Notes:
   * Before creating an FusekiAutoModule and attempting to load with a 
ServiceLoader, I first created a FusekiModule and started a server 
programmatically. This gave me the expected results.
   * Because the 
[example](https://github.com/apache/jena/blob/main/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFusekiMain_3_FusekiModule.java#L56)
 mentions it, and because the 
[FusekiServiceLoaderModules](https://github.com/apache/jena/blob/0aa670f077baae18810946a607fb862f11afab58/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/sys/FusekiAutoModules.java#L148)
 seems to be trying to use FusekiModule, I also tried implementing 
`FusekiModule` and changing the name of the `META-INF/services` file to 
`org.apache.jena.fuseki.main.sys.FusekiModule`. Alas, no dice.
   
   Anything I might be missing, or anywhere else I can look? I can work around 
this by just creating the server programmatically, but would prefer not to if I 
don't need to.
   
   
[helloFuseki-0.0.1.zip](https://github.com/apache/jena/files/13506899/helloFuseki-0.0.1.zip)
   
   ### Relevant output and stacktrace
   
   ```shell
   17:31:08 INFO  Server          :: Apache Jena Fuseki 4.10.0
   17:31:08 INFO  Config          :: 
FUSEKI_HOME=/Users/user/jena/apache-jena-fuseki-4.10.0/.
   17:31:08 INFO  Config          :: 
FUSEKI_BASE=/Users/user/jena/apache-jena-fuseki-4.10.0/run
   17:31:08 INFO  Config          :: Shiro file: 
file:///Users/user/jena/apache-jena-fuseki-4.10.0/run/shiro.ini
   17:31:08 INFO  Config          :: Load configuration: 
file:///Users/user/jena/apache-jena-fuseki-4.10.0/run/configuration/my-test.ttl
   17:31:08 INFO  Server          :: Configuration file: 
/Users/user/jena/apache-jena-fuseki-4.10.0/run/config.ttl
   17:31:08 INFO  Server          :: Path = /my-test
   17:31:08 INFO  Server          ::   Memory: 4.0 GiB
   17:31:08 INFO  Server          ::   Java:   17.0.8
   17:31:08 INFO  Server          ::   OS:     Mac OS X 13.2.1 aarch64
   17:31:08 INFO  Server          ::   PID:    6255
   17:31:08 INFO  Server          :: Started 2023/11/29 17:31:08 MST on port 
3030
   ```
   
   
   ### Are you interested in making a pull request?
   
   Maybe


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to