Home>
Background

The web application is implemented in Java.
The framework used is Dropwizard.
Since the application was completed to some extent, I compiled it into a Jar file using Maven and executed the following command.

Execution command

java -jar testApplication.jar server config.yml

Settings file
logging:
  level: INFO
  loggers:
    io.example.application: DEBUG
database:
  driverClass: org.h2.Driver
  user: sa
  password: sa
  url: jdbc: h2: ./ target/matome;
An error has returned. (Error message)
INFO [2018-08-11 02: 24: 05,502] org.eclipse.jetty.util.log: Logging initialized @ 2543ms to org.eclipse.jetty.util.log.Slf4jLog
INFO [2018-08-11 02: 24: 05,721] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO [2018-08-11 02: 24: 05,723] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
INFO [2018-08-11 02: 24: 05,724] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: assets for path/assets/*
INFO [2018-08-11 02: 24: 06,112] io.dropwizard.server.ServerFactory: Starting testApplicatoin
INFO [2018-08-11 02: 24: 06,301] org.eclipse.jetty.setuid.SetUIDListener: Opened application @ 885e7ff {HTTP/1.1, [http/1.1]} {0.0.0.0:8080}
INFO [2018-08-11 02: 24: 06,301] org.eclipse.jetty.setuid.SetUIDListener: Opened admin @ 8bd86c8 {HTTP/1.1, [http/1.1]} {0.0.0.0:8081}
INFO [2018-08-11 02: 24: 06,304] org.eclipse.jetty.server.Server: jetty-9.4.z-SNAPSHOT, build timestamp: 2017-11-22T06: 27: 37 + 09: 00, git hash : 82b8fb23f757335bb3329d540ce37a2a2615f0a8
INFO [2018-08-11 02: 24: 07,032] org.eclipse.jetty.server.AbstractConnector: Started application @ 885e7ff {HTTP/1.1, [http/1.1]} {0.0.0.0:8080}
INFO [2018-08-11 02: 24: 07,034] org.eclipse.jetty.server.AbstractConnector: Started admin @ 8bd86c8 {HTTP/1.1, [http/1.1]} {0.0.0.0:8081}
java.lang.ExceptionInInitializerError
    at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject (SqlObject.java:71)
    at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand (SqlObjectBuilder.java:64)
    at org.skife.jdbi.v2.DBI.onDemand (DBI.java:415)
    at io.example.applition.testApplicatoin $3.lambda $configure $0 (testApplicatoin.java:84)
    at java.util.stream.ForEachOps $ForEachOp $OfRef.accept (ForEachOps.java:184)
    at java.util.stream.ReferencePipeline $2 $1.accept (ReferencePipeline.java:175)
    at java.util.Spliterators $ArraySpliterator.forEachRemaining (Spliterators.java:948)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
    at java.util.stream.ForEachOps $ForEachOp.evaluateSequential (ForEachOps.java:151)
    at java.util.stream.ForEachOps $ForEachOp $OfRef.evaluateSequential (ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach (ReferencePipeline.java:418)
    at io.example.applition.testApplicatoin.registerModules (testApplicatoin.java:115)
    at io.example.applition.testApplicatoin.access $000 (testApplicatoin.java:31)
    at io.example.applition.testApplicatoin $3.configure (testApplicatoin.java:81)
    at org.glassfish.hk2.utilities.binding.AbstractBinder.bind (AbstractBinder.java:187)
    at org.glassfish.jersey.model.internal.CommonConfig.configureBinders (CommonConfig.java:676)
    at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders (CommonConfig.java:641)at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders (ResourceConfig.java:829)
    at org.glassfish.jersey.server.ApplicationHandler.initialize (ApplicationHandler.java:453)
    at org.glassfish.jersey.server.ApplicationHandler.access $500 (ApplicationHandler.java:184)
    at org.glassfish.jersey.server.ApplicationHandler $3.call (ApplicationHandler.java:350)
    at org.glassfish.jersey.server.ApplicationHandler $3.call (ApplicationHandler.java:347)
    at org.glassfish.jersey.internal.Errors.process (Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process (Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException (Errors.java:255)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
    at org.glassfish.jersey.servlet.ServletContainer.init (ServletContainer.java:177)
    at org.glassfish.jersey.servlet.ServletContainer.init (ServletContainer.java:369)
    at javax.servlet.GenericServlet.init (GenericServlet.java:244)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet (ServletHolder.java:665)
    at org.eclipse.jetty.servlet.ServletHolder.initialize (ServletHolder.java:423)
    at org.eclipse.jetty.servlet.ServletHandler.initialize (ServletHandler.java:760)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:348)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:785)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:261)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:107)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)
    at com.codahale.metrics.jetty9.InstrumentedHandler.doStart (InstrumentedHandler.java:103)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:115)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:107)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart (GzipHandler.java:273)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:107)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:107)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)
    at org.eclipse.jetty.server.handler.StatisticsHandler.doStart (StatisticsHandler.java:252)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:133)
    at org.eclipse.jetty.server.Server.start (Server.java:418)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:107)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113)at org.eclipse.jetty.server.Server.doStart (Server.java:385)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
    at io.dropwizard.cli.ServerCommand.run (ServerCommand.java:53)
    at io.dropwizard.cli.EnvironmentCommand.run (EnvironmentCommand.java:44)
    at io.dropwizard.cli.ConfiguredCommand.run (ConfiguredCommand.java:85)
    at io.dropwizard.cli.Cli.run (Cli.java:75)
    at io.dropwizard.Application.run (Application.java:93)
    at io.example.applition.testApplicatoin.main (testApplicatoin.java:40)
Caused by: java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
    at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:49)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassVisitor (DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate (DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.generate (AbstractClassGenerator.java:329)
    at net.sf.cglib.core.AbstractClassGenerator $ClassLoaderData $3.apply (AbstractClassGenerator.java:93)
    at net.sf.cglib.core.AbstractClassGenerator $ClassLoaderData $3.apply (AbstractClassGenerator.java:91)
    at net.sf.cglib.core.internal.LoadingCache $2.call (LoadingCache.java:54)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at net.sf.cglib.core.internal.LoadingCache.createEntry (LoadingCache.java:61)
    at net.sf.cglib.core.internal.LoadingCache.get (LoadingCache.java:34)
    at net.sf.cglib.core.AbstractClassGenerator $ClassLoaderData.get (AbstractClassGenerator.java:116)
    at net.sf.cglib.core.AbstractClassGenerator.create (AbstractClassGenerator.java:291)
    at net.sf.cglib.core.KeyFactory $Generator.create (KeyFactory.java:221)
    at net.sf.cglib.core.KeyFactory.create (KeyFactory.java:174)
    at net.sf.cglib.core.KeyFactory.create (KeyFactory.java:153)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)
    ... 74 more
Tried
  • Debug error area
    ⇨ I don't understand the hierarchy deeply. (Refer to error message)
  • Environmental differences
    ⇨ It can be executed with "DropwizardTool" of Eclipse.
    ⇨ It can be executed in "Java application" of Eclipse.
    ⇨ The above error occurs when the command is executed on CMD of Windows (Windows10).
    ⇨ The above error occurs when executing a command on a Linux (Ubuntu 18.04 LTS) terminal.
I want to hear
  • What are the differences between the environment that runs in Eclipse and the environment that runs as a Jar file with commands? .
  • How can I get it to run? (It's too rough!)
  • Do you have any experience in this case?
Supplement

You can do anything like "Let's learn more!", "Think more", "Debug properly", etc. We look forward to your response.

  • Answer # 1

    There was a question about the same error at the link below and it was solved by downgrading cgilib.

    java-PowerMockRunner causes ExceptionInInitializerError when running trivial test-Stack Overflow

    How about examining the difference between the jar created with maven and the cgilib version of the eclipse runtime environment.

    If the version number is attached to the jar file name of cgilib in the jar file, you can check it with the following command.

    jar tf testApplication.jar

    For eclipse, you can see the jar file referenced by the application in the reference library in the project pane.

    [Supplement]

    Although the stack trace output to the log is long, it is only about the part that is meaningful to see the contents.

    java.lang.ExceptionInInitializerError
        at org.skife.jdbi.v2.sqlobject.SqlObject.buildSqlObject (SqlObject.java:71)
        at org.skife.jdbi.v2.sqlobject.SqlObjectBuilder.onDemand (SqlObjectBuilder.java:64)
        at org.skife.jdbi.v2.DBI.onDemand (DBI.java:415)
        at io.example.applition.testApplicatoin $3.lambda $configure $0 (testApplicatoin.java:84)
    ≪Omitted≫
    Caused by: java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
        at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:49)
        at net.sf.cglib.core.DefaultGeneratorStrategy.getClassVisitor (DefaultGeneratorStrategy.java:30)
    ≪Omitted≫
        at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)
        ... 74 more

    Database related processing call at line 84 oftestApplicatoin.java

    ExceptionInInitializerErroroccurs when callingSqlObject.buildSqlObject ()in the library

    Cause: There is a place where the Enhancer class is used in the above method, andIllegalArgumentExceptionOccurrence

  • Answer # 2

    ExceptionInInitializerErroris raised when an exception occurs in astaticinitializer. How about reading the source code in astaticinitializer?