2017-07-10 4 views
1

Spring Boot Developer開発ツールをこのようなビルドに追加するとすぐにIntelliJ 2017.1.5で起動できないSpring Bootアプリケーションがあります。 spring-boot-devtoolsすべては私が(IntelliJのでGradleのプロジェクトをリフレッシュした後に)アプリケーションを起動し、それらを追加するとすぐに、細かいですNoClassDefFoundErrorで失敗しなければSpring Boot Developerツールを使用している場合、IntelliJがSpring Boot/Developerアプリケーションを起動できない

dependencies { 
    compile("org.springframework.boot:spring-boot-starter-web") 
    compile("org.apache.httpcomponents:httpclient:4.5.3") 
    compile("com.fasterxml.jackson.core:jackson-databind:2.8.8.1") 
    compile("commons-validator:commons-validator:1.6") 

    // This line breaks IntelliJ compatibility: 
    optional("org.springframework.boot:spring-boot-devtools") 

    optional("org.springframework.boot:spring-boot-configuration-processor") 
    testCompile("org.springframework.boot:spring-boot-starter-test") 
    testCompile("junit:junit:4.12") 
} 

は:

Error: A JNI error has occurred, please check your installation and try again 
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/web/client/RestTemplateBuilder 
    at java.lang.Class.getDeclaredMethods0(Native Method) 
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) 
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048) 
    at java.lang.Class.getMethod0(Class.java:3018) 
    at java.lang.Class.getMethod(Class.java:1784) 
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) 
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) 
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.client.RestTemplateBuilder 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 7 more 

私はかなりそれはIntだと確信しているelliJの問題です。これは、同じアプリケーションがSpringブート開発ツールを有効にしてEclipseで正常に動作するためです。

これを修正する方法はありますか?

+0

http://stackoverflow.com/a/42588061/104891を参照してください。 – CrazyCoder

+0

@CrazyCoder:ありがとうございます。しかし、私はIntelliJ 2017.1.5を使っています...(元の質問にそれを含めてください)。また、Spring Bootデベロッパーツールをビルドに追加するだけです。だから私はあなたがリンクしているものよりも具体的な問題だと思う。 – anothernode

+0

https://youtrack.jetbrains.com/issue/IDEA-174993が該当するかどうかを確認してください。 – CrazyCoder

答えて

1

私はにspring-boot-devtoolsへの依存関係を変更することでこの問題を解決することができました:

runtime("org.springframework.boot:spring-boot-devtools") 

代わりの

optional("org.springframework.boot:spring-boot-devtools") 
関連する問題