novuhq / novu-java

Java SDK for Novu - The open-source notification infrastructure for engineers. 🚀
MIT License
26 stars 22 forks source link

Does not support quarkus #34

Closed darkmtrance closed 6 months ago

darkmtrance commented 12 months ago

I tested the library in a Java project with Quarkus, which failed due to dependency on Spring Framework libraries.

mayorJAY commented 12 months ago

Hi @darkmtrance can you share more information? What errors are you getting?

darkmtrance commented 11 months ago

{ "exception": { "refId": 1, "exceptionType": "org.jboss.resteasy.spi.UnhandledException", "message": "java.lang.NoClassDefFoundError: org/springframework/web/client/RestTemplate", "frames": [ { "class": "org.jboss.resteasy.core.ExceptionHandler", "method": "handleApplicationException", "line": 107 }, { "class": "org.jboss.resteasy.core.ExceptionHandler", "method": "handleException", "line": 344 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "writeException", "line": 205 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 452 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$invoke$4", "line": 240 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$preprocess$0", "line": 154 }, { "class": "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext", "method": "filter", "line": 321 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "preprocess", "line": 157 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 229 }, { "class": "io.quarkus.resteasy.runtime.standalone.RequestDispatcher", "method": "service", "line": 82 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler", "method": "dispatch", "line": 147 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1", "method": "run", "line": 93 }, { "class": "io.quarkus.vertx.core.runtime.VertxCoreRecorder$14", "method": "runWith", "line": 576 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$Task", "method": "run", "line": 2513 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$ThreadBody", "method": "run", "line": 1538 }, { "class": "org.jboss.threads.DelegatingRunnable", "method": "run", "line": 29 }, { "class": "org.jboss.threads.ThreadLocalResettingRunnable", "method": "run", "line": 29 }, { "class": "io.netty.util.concurrent.FastThreadLocalRunnable", "method": "run", "line": 30 }, { "class": "java.lang.Thread", "method": "run", "line": 833 } ], "causedBy": { "exception": { "refId": 2, "exceptionType": "java.lang.NoClassDefFoundError", "message": "org/springframework/web/client/RestTemplate", "frames": [ { "class": "co.novu.common.rest.RestHandler", "method": "<init>", "line": 19 }, { "class": "co.novu.common.base.Novu", "method": "<init>", "line": 131 }, { "class": "com.matomaylla.invoice.controller.ProductoController", "method": "getSelect2Data", "line": 246 }, { "class": "jdk.internal.reflect.NativeMethodAccessorImpl", "method": "invoke0" }, { "class": "jdk.internal.reflect.NativeMethodAccessorImpl", "method": "invoke", "line": 77 }, { "class": "jdk.internal.reflect.DelegatingMethodAccessorImpl", "method": "invoke", "line": 43 }, { "class": "java.lang.reflect.Method", "method": "invoke", "line": 568 }, { "class": "org.jboss.resteasy.core.MethodInjectorImpl", "method": "invoke", "line": 154 }, { "class": "org.jboss.resteasy.core.MethodInjectorImpl", "method": "invoke", "line": 118 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "internalInvokeOnTarget", "line": 560 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invokeOnTargetAfterFilter", "line": 452 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "lambda$invokeOnTarget$2", "line": 413 }, { "class": "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext", "method": "filter", "line": 321 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invokeOnTarget", "line": 415 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 378 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 356 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 70 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 429 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$invoke$4", "line": 240 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$preprocess$0", "line": 154 }, { "class": "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext", "method": "filter", "line": 321 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "preprocess", "line": 157 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 229 }, { "class": "io.quarkus.resteasy.runtime.standalone.RequestDispatcher", "method": "service", "line": 82 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler", "method": "dispatch", "line": 147 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1", "method": "run", "line": 93 }, { "class": "io.quarkus.vertx.core.runtime.VertxCoreRecorder$14", "method": "runWith", "line": 576 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$Task", "method": "run", "line": 2513 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$ThreadBody", "method": "run", "line": 1538 }, { "class": "org.jboss.threads.DelegatingRunnable", "method": "run", "line": 29 }, { "class": "org.jboss.threads.ThreadLocalResettingRunnable", "method": "run", "line": 29 }, { "class": "io.netty.util.concurrent.FastThreadLocalRunnable", "method": "run", "line": 30 }, { "class": "java.lang.Thread", "method": "run", "line": 833 } ], "causedBy": { "exception": { "refId": 3, "exceptionType": "java.lang.ClassNotFoundException", "message": "org.springframework.web.client.RestTemplate", "frames": [ { "class": "jdk.internal.loader.BuiltinClassLoader", "method": "loadClass", "line": 641 }, { "class": "jdk.internal.loader.ClassLoaders$AppClassLoader", "method": "loadClass", "line": 188 }, { "class": "java.lang.ClassLoader", "method": "loadClass", "line": 520 }, { "class": "io.quarkus.bootstrap.classloading.QuarkusClassLoader", "method": "loadClass", "line": 516 }, { "class": "io.quarkus.bootstrap.classloading.QuarkusClassLoader", "method": "loadClass", "line": 466 }, { "class": "co.novu.common.rest.RestHandler", "method": "<init>", "line": 19 }, { "class": "co.novu.common.base.Novu", "method": "<init>", "line": 131 }, { "class": "com.matomaylla.invoice.controller.ProductoController", "method": "getSelect2Data", "line": 246 }, { "class": "jdk.internal.reflect.NativeMethodAccessorImpl", "method": "invoke0" }, { "class": "jdk.internal.reflect.NativeMethodAccessorImpl", "method": "invoke", "line": 77 }, { "class": "jdk.internal.reflect.DelegatingMethodAccessorImpl", "method": "invoke", "line": 43 }, { "class": "java.lang.reflect.Method", "method": "invoke", "line": 568 }, { "class": "org.jboss.resteasy.core.MethodInjectorImpl", "method": "invoke", "line": 154 }, { "class": "org.jboss.resteasy.core.MethodInjectorImpl", "method": "invoke", "line": 118 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "internalInvokeOnTarget", "line": 560 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invokeOnTargetAfterFilter", "line": 452 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "lambda$invokeOnTarget$2", "line": 413 }, { "class": "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext", "method": "filter", "line": 321 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invokeOnTarget", "line": 415 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 378 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 356 }, { "class": "org.jboss.resteasy.core.ResourceMethodInvoker", "method": "invoke", "line": 70 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 429 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$invoke$4", "line": 240 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "lambda$preprocess$0", "line": 154 }, { "class": "org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext", "method": "filter", "line": 321 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "preprocess", "line": 157 }, { "class": "org.jboss.resteasy.core.SynchronousDispatcher", "method": "invoke", "line": 229 }, { "class": "io.quarkus.resteasy.runtime.standalone.RequestDispatcher", "method": "service", "line": 82 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler", "method": "dispatch", "line": 147 }, { "class": "io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1", "method": "run", "line": 93 }, { "class": "io.quarkus.vertx.core.runtime.VertxCoreRecorder$14", "method": "runWith", "line": 576 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$Task", "method": "run", "line": 2513 }, { "class": "org.jboss.threads.EnhancedQueueExecutor$ThreadBody", "method": "run", "line": 1538 }, { "class": "org.jboss.threads.DelegatingRunnable", "method": "run", "line": 29 }, { "class": "org.jboss.threads.ThreadLocalResettingRunnable", "method": "run", "line": 29 }, { "class": "io.netty.util.concurrent.FastThreadLocalRunnable", "method": "run", "line": 30 }, { "class": "java.lang.Thread", "method": "run", "line": 833 } ] } } } } } }

I believe that springboot's resttemplate is not supported by quarkus. I created my own restclient in quarkus and everything is fine.

mayorJAY commented 11 months ago

I think we may have to migrate from RestTemplate to a library that is not framework dependent like OkHttp or Retrofit

mayorJAY commented 11 months ago

Hi @darkmtrance, if you don't mind, we would like to have a conversation with you regarding this issue. Please feel free to join the discord server via this link https://discord.novu.co/ and buzz me, my username is MayorJay

mayorJAY commented 6 months ago

Fixed in this release https://github.com/novuhq/novu-java/releases/tag/v1.5.0 This SDK now supports all Java frameworks