Announcement Announcement Module
Collapse
No announcement yet.
Spring LDAP ClassNotFoundException EmptyResultDataAccessException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring LDAP ClassNotFoundException EmptyResultDataAccessException

    With regards to Spring and spring-ldap I am using Spring 3.0 with the following properties and dependencies.

    Code:
    <properties>
            <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
            <org.springldap.version>1.3.1.RELEASE</org.springldap.version>
    </properties>
    Code:
    <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-core</artifactId>
                <version>${org.springldap.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-core-tiger</artifactId>
                <version>${org.springldap.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-odm</artifactId>
                <version>${org.springldap.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-ldif-core</artifactId>
                <version>${org.springldap.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-ldif-batch</artifactId>
                <version>${org.springldap.version}</version>
    </dependency>
    When I try to Autowire the ldapTemplate as follows:

    Code:
    @Autowired
    @Qualifier("ldapTemplate")
    private LdapTemplate ldapTemplate;
    And using this pom context xml:

    Code:
    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
          <property name="url" value="${boomerang.ldap.url}" />
          <property name="base" value="${boomerang.ldap.base}" />
    </bean>
    
    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
          <constructor-arg ref="contextSource" />
    </bean>
    
    I get the following exception:

    Code:
    java.lang.ClassNotFoundException: org.springframework.dao.EmptyResultDataAccessException
    This only happens when I run this on the command line. maven is setup to add the classpath to the manifest and everything else works fine. In other words it finds all the other classes and jars etc...

    I'm working in IDEA and I can reference and compile org.springframework.dao.EmptyResultDataAccessExcep tion. It is in my classpath as far as I can tell.

    Here's the manifest:

    Code:
    Manifest-Version: 1.0 
    Archiver-Version: Plexus Archiver
    Created-By: Apache Maven
    Built-By: matt
    Build-Jdk: 1.6.0_26
    Specification-Title: boomerang
    Specification-Version: 0.6.0-SNAPSHOT
    Implementation-Title: boomerang
    Implementation-Version: 0.6.0-SNAPSHOT
    Implementation-Vendor-Id: boomerang
    Main-Class: info.afilias.boomerang.command.BPingBootstrap
    Class-Path: /etc/boomerang/ junit-4.8.1.jar jmock-junit4-2.5.1.jar jmo 
     ck-2.5.1.jar hamcrest-core-1.1.jar hamcrest-library-1.1.jar junit-dep
     -4.4.jar commons-cli-1.2.jar postgresql-9.0-801.jdbc4.jar jcl-over-sl
     f4j-1.5.8.jar slf4j-api-1.5.8.jar slf4j-log4j12-1.5.8.jar log4j-1.2.1
     6.jar commons-io-2.1.jar commons-lang3-3.0.1.jar common-communication
     -1.2.1.11745.jar commons-logging-1.1.1.jar commons-logging-api-1.1.ja
     r spring-core-3.0.5.RELEASE.jar spring-asm-3.0.5.RELEASE.jar spring-c
     ontext-3.0.5.RELEASE.jar spring-aop-3.0.5.RELEASE.jar aopalliance-1.0
     .jar spring-beans-3.0.5.RELEASE.jar spring-expression-3.0.5.RELEASE.j
     ar spring-oxm-3.0.5.RELEASE.jar jaxb2-basics-runtime-0.6.3.jar jaxb2-
     value-constructor-3.0.jar jaxb-api-2.1.jar stax-api-1.0-2.jar activat
     ion-1.1.jar spring-ldap-core-1.3.1.RELEASE.jar commons-lang-2.5.jar s
     pring-tx-3.0.5.RELEASE.jar spring-ldap-core-tiger-1.3.1.RELEASE.jar s
     pring-ldap-odm-1.3.1.RELEASE.jar freemarker-2.3.9.jar commons-pool-1.
     5.4.jar spring-ldap-ldif-core-1.3.1.RELEASE.jar spring-ldap-ldif-batc
     h-1.3.1.RELEASE.jar spring-batch-core-2.0.3.RELEASE.jar spring-batch-
     infrastructure-2.0.3.RELEASE.jar xstream-1.3.jar xpp3_min-1.1.4c.jar 
     jettison-1.0.jar plexus-utils-1.1.jar


    When I run in IDEA everything works, when I run on the command line it does not work.

    Any thoughts would be appreciated.

    Thanks,
    Matt

  • #2
    I was able to solve this myself. I included spring-tx and commons-lang in my maven deps and it all works now. I'm not sure but I think the IDEA IDE was providing these somehow (?) - but now the code works everywhere. Also, it looks like spring-ldap requires commons-lang but it this isn't documented anywhere as far as I can tell.

    Comment

    Working...
    X