Spring Security SAML扩展java.lang.AbstractMethodError

时间:2015-06-11 16:12:46

标签: spring spring-boot spring-saml

您好,我正在尝试将SAML扩展程序集成到我的项目中,并且在构建它时遇到以下异常,我正在使用 Spring 4.1.5

  

java.lang.AbstractMethodError:   javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava /郎/字符串; Z)V     在   org.opensaml.xml.parse.BasicParserPool.setFeatures(BasicParserPool.java:559)   〜[xmltooling-1.4.1.jar:na] at   org.opensaml.xml.parse.BasicParserPool.initializePool(BasicParserPool.java:507)   〜[xmltooling-1.4.1.jar:na] at   org.opensaml.xml.parse.BasicParserPool。(BasicParserPool.java:141)   〜[xmltooling-1.4.1.jar:na] at   org.opensaml.xml.XMLConfigurator。(XMLConfigurator.java:88)   〜[xmltooling-1.4.1.jar:1.4.1] at   org.opensaml.xml.XMLConfigurator。(XMLConfigurator.java:74)   〜[xmltooling-1.4.1.jar:1.4.1] at   org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:199)   〜[opensaml-2.6.1.jar:1.0.1.RELEASE] at   org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:186)   〜[opensaml-2.6.1.jar:1.0.1.RELEASE] at   org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:92)   〜[opensaml-2.6.1.jar:1.0.1.RELEASE] at   org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)   〜[spring-security-saml2-core-1.0.1.RELEASE.jar:1.0.1.RELEASE] at   org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)   〜[spring-security-saml2-core-1.0.1.RELEASE.jar:1.0.1.RELEASE] at   org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)   〜[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177)   〜[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)   〜[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)   〜[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)   〜[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.boot.SpringApplication.run(SpringApplication.java:320)   〜[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:101)   [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at   org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:68)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:86)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:72)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:170)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:110)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:200)[spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner $ 1.runReflectiveCall(SpringJUnit4ClassRunner.java:259)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)   [junit-4.11.jar:na] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:261)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:219)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:238)   [junit-4.11.jar:na] at   org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:63)   [junit-4.11.jar:na] at   org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)   [junit-4.11.jar:na] at   org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:53)   [junit-4.11.jar:na] at   org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:229)   [junit-4.11.jar:na] at   org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.junit.runners.ParentRunner.run(ParentRunner.java:309)   [junit-4.11.jar:na] at   org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)   [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE] at   org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)   [surefire-junit4-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)   [surefire-junit4-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)   [surefire-junit4-2.12.4.jar:2.12.4] at   sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)   〜[na:1.8.0_31] at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)   〜[na:1.8.0_31] at   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   〜[na:1.8.0_31] at java.lang.reflect.Method.invoke(Method.java:483)   〜[na:1.8.0_31] at   org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)   [surefire-api-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.booter.ProviderFactory $ ProviderProxy.invoke(ProviderFactory.java:165)   [surefire-booter-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)   [surefire-booter-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)   [surefire-booter-2.12.4.jar:2.12.4] at   org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)   [万无一失-足球运动员-2.12.4.jar:2.12.4]

2 个答案:

答案 0 :(得分:1)

如果在将saml扩展调整为spring项目时可能需要处理此异常,请确保已将以下库添加到maven

    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.10.0</version>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.1</version>
    </dependency>

答案 1 :(得分:0)

我还发现我需要在xom依赖项之前放置xerces和xalan依赖项。 pom.xml中有一个xom依赖项,它将xerces和xalan jar的旧版本添加到类路径中,而不是在pom.xml中调用的较新版本(如上所述)。