2015-01-14 2 views
3

저는 봄과 LDAP를 처음 사용합니다. 나는 스프링 부트와 아파치로 빠르게 시작하는 방법을 설명하는 멋진 예제를 발견했습니다. 필자는 제안 된 Gradle 구성을 사용하여이 예를 따랐습니다. The link. 나는 다음과 같은 오류가 발생 봄 부팅 ...스프링 LDAP 예제에는 지속성이 필요합니까?

 

Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation. 
 

를 시작하면 봄은 다른 게시물을 통해 검색에서 비록 지속성 번역기를 요청하는 이유는 클래스 패스 내에서 ORM은 (I 천국이 나타납니다 확실하지 않다 ORM JAR을로드하지 않았습니다. 봄 보안 부트 항목이 gradle에서 제거되면 예외가 발생하지 않습니다. 따라서 Spring은 JPA 구현과 번역자를 찾고 있습니다. 다른 사람이 링크에서 예를 들어 문제가 있습니다. 감사!

+0

아마도'PersistenceExceptionTranslationPostProcessor' 클래스를 포함하는 클래스 경로에'스프링 tx' 의존성이있다. 'PersistenceExceptionTranslator'의 설정을 트리거하는 클래스입니다. 'spring.dao.exceptiontranslation.enabled = false'를'application.properties' 파일에 추가함으로써 이것을 막을 수 있습니다. –

답변

6

spring-security-ldapspring-tx에 전이 종속성이 있으며 끌어 당기는 버전은 3.2.8.RELEASE입니다. 스프링 부트 1.2에는 4.1.x가 필요합니다. 이것은 종속성 관리가 뛰어남으로 인해 Maven에서 발생하지 않습니다.

spring-tx에 명시 적 종속성을 추가하여 문제를 해결할 수 있습니다. Spring Boot가 이것을 처리 할 때 버전을 지정할 필요가 없습니다. 당신이 질문에 링크 된 예를 기반으로하는이이처럼 보이는 의존성을 떠날 것이다 :

dependencies { 
    compile("org.springframework.boot:spring-boot-starter-web") 
    compile("org.springframework.boot:spring-boot-starter-security") 
    compile("org.springframework:spring-tx") 
    compile("org.springframework.security:spring-security-ldap:3.2.4.RELEASE") 
    compile("org.apache.directory.server:apacheds-server-jndi:1.5.5") 
    testCompile("junit:junit") 
} 
+0

org.apache.camel을 사용할 때와 같은 문제 : org.apache.camel과 결합 된 camel-spring : camel-core,하지만이 솔루션도 잘 작동합니다! :) – Tobias

관련 문제