【问题标题】:Spring configuration: Unable to locate Spring NamespaceHandlerSpring 配置:找不到 Spring NamespaceHandler
【发布时间】:2015-12-23 05:46:13
【问题描述】:

配置问题:找不到 XML 模式命名空间的 Spring NamespaceHandler [http://www.springframework.org/schema/tx] 违规资源:ServletContext 资源 [/WEB-INF/spring-servlet.xml]

【问题讨论】:

  • 您能否更具体地谈谈您的问题,我不知道为什么它是要堆叠的标签?
  • 您可以添加更多信息吗?
  • 这是一个 Maven 应用程序,在配置中我得到错误
  • 先生,我是这里的新用户,所以对您的网站感到困惑,我不知道这里的标签是什么,如果我无法发布我的 qutn 所以 jst 标记到那个
  • 您是否查看过以下内容...stackoverflow.com/questions/7188719/…

标签: java spring


【解决方案1】:

在 gradle 中你可以使用 shadowJar 插件来解决这个问题。我用于编译 fat jar 的 build.gradle 文件:

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'application'

mainClassName = 'ru.antowka.Initializer'

buildscript {
    repositories { jcenter() }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
    }
}

jar {
    manifest {
        attributes 'Main-Class': mainClassName
    }
}

shadowJar {
    mergeServiceFiles('META-INF/spring.*')
}

// JDK 8
sourceCompatibility = 1.8
targetCompatibility = 1.8

compileJava.options.encoding = 'UTF-8'

repositories {

    maven {
        url 'http://repo.spring.io/snapshot'
    }

    mavenLocal()
    mavenCentral()
    jcenter()
}

dependencies {
    compile 'org.jsoup:jsoup:1.8.3'
    compile 'org.springframework:spring-context:4.2.2.BUILD-SNAPSHOT'
    compile 'log4j:log4j:1.2.17'
    compile 'org.quartz-scheduler:quartz:1.8.6'
    compile 'org.springframework:spring-support:2.0.8'
    compile 'org.springframework:spring-tx:2.5.4'
    compile 'org.springframework:spring-orm:4.1.7.RELEASE'
    compile 'org.hibernate:hibernate-core:4.3.10.Final'
    compile 'org.postgresql:postgresql:9.4-1201-jdbc41'
    compile 'org.apache.commons:commons-dbcp2:2.1'

    testCompile 'org.springframework:spring-test:4.2.0.RELEASE'
    testCompile 'org.mockito:mockito-core:1.+'
    testCompile 'junit:junit:4.12'
}

【讨论】:

    猜你喜欢
    • 2015-12-01
    • 1970-01-01
    • 2020-01-02
    • 2015-11-17
    • 1970-01-01
    • 2018-04-28
    • 2019-08-30
    • 2017-05-15
    • 2013-02-13
    相关资源
    最近更新 更多