我试图设置Dropwizard hello world应用程序并遇到问题。这是堆栈跟踪:
objc[30585]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x1021cc4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1031fd4e0). One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.NullPointerException
at com.fasterxml.jackson.databind.node.TreeTraversingParser.<init>(TreeTraversingParser.java:71)
at com.fasterxml.jackson.databind.node.TreeTraversingParser.<init>(TreeTraversingParser.java:65)
at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:125)
at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:77)
at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:114)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:63)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:72)
at com.example.HelloWorldApplication$.main(HelloWorldApplication.scala:18)
at com.example.HelloWorldApplication.main(HelloWorldApplication.scala)
这是我的申请:
package com.example
import io.dropwizard.Application
import io.dropwizard.setup.Bootstrap
import io.dropwizard.setup.Environment
class HelloWorldApplication extends Application[HelloWorldConfiguration] {
override def run(configuration: HelloWorldConfiguration, environment: Environment): Unit = {
val helloWorld = new HelloWorldResource()
environment.jersey().register(helloWorld)
}
override def initialize(bootstrap: Bootstrap[HelloWorldConfiguration]): Unit = {}
}
object HelloWorldApplication {
def main(args: Array[String]) = {
new HelloWorldApplication().run(args)
}
}
我使用IntelliJ中的这些参数运行应用程序:server src/main/resources/config.yml
任何调试和正确设置的提示都会有所帮助。
答案 0 :(得分:0)
转到Project Structure&gt;生成Scala项目中的jar文件。工件和添加项目jar。