microstream icon indicating copy to clipboard operation
microstream copied to clipboard

Rest Interface Issue Using Quarkus

Open jeportc82 opened this issue 2 years ago • 2 comments

Environment Details

  • MicroStream Version: 08.01.01-MS-GA
  • JDK version: 17
  • OS: Mac os
  • Used frameworks: Quarkus 3.3.1

Describe the bug

REST Interface does not start.

I'm getting the following error.

Exception in thread "Thread-130" java.lang.NoClassDefFoundError: javax/servlet/Filter

        at spark.embeddedserver.EmbeddedServers.initialize(EmbeddedServers.java:41)
        at spark.Service.lambda$init$2(Service.java:618)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
        at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
        ... 3 more 

To Reproduce

Add the following maven dependencies

    <dependency>
      <groupId>one.microstream</groupId>
      <artifactId>microstream-quarkus3-extension</artifactId>
      <version>08.01.01-MS-GA</version>
    </dependency>
    <dependency>
        <groupId>one.microstream</groupId>
        <artifactId>microstream-storage-restservice-sparkjava</artifactId>
        <version>08.01.01-MS-GA</version>
    </dependency>

and then execute the following code to start the service

StorageRestService service = StorageRestServiceResolver.resolve(storage);
service.start();

Expected behavior

Rest Interface must be available in the default por 4567.

jeportc82 avatar Sep 01 '23 13:09 jeportc82

The NoClassDefFoundError is most likely caused by the missing java EE dependencies required by our rest service implementation. Quarkus already uses the newer Jarkata EE.

Our ‘microstream-storage-restservice-sparkjava’ was implemented to run within plain java applications. Therefore, it brings its own rest framework and webserver (sparkjava). If you like to use the rest-api with Quarkus I’d suggest not using our implementation. Instead, you may consider implementing the required rest api directly using Quarkus only. Doing so should be quite trivial. Please see https://github.com/microstream-one/microstream/discussions/549 for more details.

hg-ms avatar Sep 04 '23 07:09 hg-ms

@jeportc82 it was super easy to implement the REST endpoints "in house" as described in #549 With Quarkus the REST part is super easy and the only thing you will have to do is plug in 2-3 lines of code calling the micsotream adapter

guykatz avatar Sep 14 '23 07:09 guykatz