首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NoClassDefFoundError在Spring上的应用

NoClassDefFoundError在Spring上的应用
EN

Stack Overflow用户
提问于 2017-10-14 20:11:39
回答 1查看 1.8K关注 0票数 0

这个映像中出现了完全错误,因为我运行在云中的虚拟机上,这是通过视频提要访问的,所以我不能复制,paste.This是ubuntu的一个新安装程序,在这里我只安装了JDK,没有什么是不知道的,如果其他设置需要执行https://imgur.com/a/egJ3d的话。

它是一个弹簧引导应用程序。我的build.gradle

代码语言:javascript
复制
group 'com.haughon.daniel'
version '1.0-SNAPSHOT'



buildscript {
repositories{
    mavenCentral()
}
dependencies {
    classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE'
}
}

// Apply the Spring Boot plugin
apply plugin: 'spring-boot'

 // Apply the Java plugin (expects src/main/java to be source folder)
 apply plugin: 'java'
apply plugin: 'idea'

 // Specify the location where our dependencies will be found
repositories {
mavenCentral()
}
jar {
   manifest {
    attributes 'Main-Class': 'haughton.dvdstore.Application'
    attributes 'addClasspath': 'true'

}
}

 // Specify dependencies
  dependencies {

compile 'org.hashids:hashids:1.0.1'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework:spring-orm:4.3.7.RELEASE'
compile 'org.hibernate:hibernate-core:5.2.9.Final'
compile 'org.hibernate:hibernate-entitymanager:5.0.6.Final'
compile 'org.apache.tomcat:tomcat-dbcp:8.0.30'
compile 'org.springframework.boot:spring-boot-starter-security'
compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4')
//compile 'org.thymeleaf.extras:thymeleaf-extras-springsecurity:3.0.2.RELEASE'
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.11.1.RELEASE'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.8'

runtime 'com.h2database:h2'
runtime 'javax.transaction:jta:1.1'
runtime 'org.aspectj:aspectjweaver:1.8.7'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}  
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-15 02:50:43

这是因为依赖项没有包含在一个jar文件中。

使用./gradlew clean build

请看这篇文章:

java.lang.NoClassDefFoundError: when trying to run jar

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46748902

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档