getsandbox / worker-cli

Sandbox Worker is the core processing component of the Sandbox product
https://getsandbox.com
230 stars 62 forks source link

NoClassDefFoundError from fat jar #47

Closed stringy05 closed 3 years ago

stringy05 commented 3 years ago

Fat jar isn't fat enough?

Running a trivial mock fails to load javax.activation.MimetypesFileTypeMap

mock:

Sandbox.define('/consent', 'GET', function(req, res){
    return res.json(200, {"hello" : "there"})
});
$ java -jar worker-cli_worker-cli-latest.jar --watch
Sandbox ready (build: v? runtime: VERSION_3) --  Running on port: 8080, metadata on port: disabled, reading from path: 'C:\Users\brock\Development\ecm\mocks', took: 3874ms
** Error processing request for GET /consents - Invalid route

>> HTTP GET /consent  (Matched route '/consent')
>> Headers: {Accept=*/*, content-length=0, Host=localhost:8080, User-Agent=curl/7.73.0}
>> No body found
Exception in catch-all
java.lang.NoClassDefFoundError: javax/activation/MimetypesFileTypeMap
        at com.sandbox.worker.core.js.models.WorkerHttpRequest.<clinit>(WorkerHttpRequest.java:50)
        at com.sandbox.worker.core.services.RuntimeRequestConverter.fromInstanceHttpRequest(RuntimeRequestConverter.java:11)
        at com.sandbox.worker.core.js.ProcessRequestExecutor.doExecute(ProcessRequestExecutor.java:69)
        at com.sandbox.worker.core.js.ProcessRequestExecutor.doExecute(ProcessRequestExecutor.java:27)
        at com.sandbox.worker.core.js.AbstractJSExecutor.execute(AbstractJSExecutor.java:16)
        at com.sandbox.worker.core.server.WorkerRequestRunnable.doRun(WorkerRequestRunnable.java:46)
        at com.sandbox.worker.core.js.models.WorkerRunnable.call(WorkerRunnable.java:32)
        at com.sandbox.worker.core.js.models.WorkerRunnable.call(WorkerRunnable.java:9)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.activation.MimetypesFileTypeMap
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 12 common frames omitted
Error processing request - Caught error
nhoughto commented 3 years ago

Gotta run it on Java 8.

stringy05 commented 3 years ago

No school like the old school eh?

On Fri, 16 Jul 2021 at 15:04, nhoughto @.***> wrote:

Gotta run it on Java 8.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/getsandbox/worker-cli/issues/47#issuecomment-881179109, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVLDQE2K3EJE6A7ZTKD6HLTX64UHANCNFSM5AO2MKVA .