Uploaded image for project: 'Spring Data Neo4j'
  1. Spring Data Neo4j
  2. DATAGRAPH-125

Application Context not loading when <neo4j:config storeDirectory="target/testdb" /> included

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.M1
    • Fix Version/s: None
    • Component/s: CORE
    • Labels:
      None
    • Environment:
      Windows 7 64, JDK 1.6_29, STS 2.8.0, Spring 3.1 RC1, spring-data-neo4j 2.0.0.M1

      Description

      The application Context

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:context="http://www.springframework.org/schema/context"
      	xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
      	xmlns:p="http://www.springframework.org/schema/p"
      	xmlns:tx="http://www.springframework.org/schema/tx"
      	xsi:schemaLocation="
      		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
      		http://www.springframework.org/schema/data/neo4j http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd
      		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
      
      	<context:annotation-config />
      	<context:spring-configured />
      
      	<neo4j:config storeDirectory="target/testdb" />
      	<neo4j:repositories base-package="ch.twinf.smodata.repositories" />
      	
      	<tx:annotation-driven mode="aspectj" />
      	
      </beans>
      

      throws the exception

      ERROR: org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframewor[email protected]d896a4c] to prepare test instance [[email protected]]
      java.lang.IllegalStateException: Failed to load ApplicationContext
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.IllegalStateException: Singleton 'conversionService' isn't currently in creation
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.afterSingletonCreation(DefaultSingletonBeanRegistry.java:312)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:239)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:903)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
      	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      	at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
      	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
      	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
      	... 24 more
      

      I use the test

      @RunWith(SpringJUnit4ClassRunner.class)
      @ContextConfiguration(locations = "classpath:/META-INF/spring/appCtx.xml")
      public class AppCtxTest {
      
      	@Autowired
      	private ApplicationContext appCtx;
      	
      	@Test
      	public void appCtx() {
      		assertThat(appCtx, notNullValue());
      	}
      
      }
      

      My POM is

      <project
      	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      	
      	<modelVersion>4.0.0</modelVersion>
      
      	<groupId>ch.twinf</groupId>
      	<artifactId>smodata</artifactId>
      	<version>0.0.1-SNAPSHOT</version>
      	<packaging>jar</packaging>
      
      	<name>smodata</name>
      
      	<properties>
      
      		<java.version>1.6</java.version>
      		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      
      		<spring.version>3.1.0.RC1</spring.version>
      		<security.version>3.1.0.RC3</security.version>
      		<spring-data-neo4j.version>2.0.0.M1</spring-data-neo4j.version>
      
      		<aspectj.version>1.6.12.M2</aspectj.version>
      		<slf4j.version>1.6.1</slf4j.version>
      		
      	</properties>
      
      	<dependencies>
      
      		<!-- logging -->
      		<dependency>
      			<groupId>org.slf4j</groupId>
      			<artifactId>slf4j-api</artifactId>
      			<version>${slf4j.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.slf4j</groupId>
      			<artifactId>jcl-over-slf4j</artifactId>
      			<version>${slf4j.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.slf4j</groupId>
      			<artifactId>slf4j-log4j12</artifactId>
      			<version>${slf4j.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>log4j</groupId>
      			<artifactId>log4j</artifactId>
      			<version>1.2.16</version>
      		</dependency>
      		<dependency>
      			<groupId>org.aspectj</groupId>
      			<artifactId>aspectjrt</artifactId>
      			<version>${aspectj.version}</version>
      		</dependency>
      
      		<!-- Spring -->
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-core</artifactId>
      			<version>${spring.version}</version>
      			<exclusions>
      				<exclusion>
      					<groupId>commons-logging</groupId>
      					<artifactId>commons-logging</artifactId>
      				</exclusion>
      			</exclusions>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-aspects</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-tx</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-orm</artifactId>
      			<version>${spring.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.springframework</groupId>
      			<artifactId>spring-test</artifactId>
      			<version>${spring.version}</version>
      			<scope>test</scope>
      			<exclusions>
      				<exclusion>
      					<groupId>commons-logging</groupId>
      					<artifactId>commons-logging</artifactId>
      				</exclusion>
      			</exclusions>
      		</dependency>
      		
      		<!-- Spring data neo4j -->
      		<dependency>
      			<groupId>org.springframework.data</groupId>
      			<artifactId>spring-data-neo4j-aspects</artifactId>
      			<version>${spring-data-neo4j.version}</version>
      		</dependency>
      
      		<!-- testing -->
      		<dependency>
      			<groupId>junit</groupId>
      			<artifactId>junit</artifactId>
      			<version>4.8.2</version>
      			<scope>test</scope>
      		</dependency>
      
      	</dependencies>
      
      	<repositories>
      
      		<repository>
      			<id>spring-maven-release</id>
      			<name>Spring Maven Release Repository</name>
      			<url>http://maven.springframework.org/release</url>
      		</repository>
      		<repository>
      			<id>spring-maven-milestone</id>
      			<name>Spring Maven Milestone Repository</name>
      			<url>http://maven.springframework.org/milestone</url>
      		</repository>
      		<repository>
      			<id>spring-maven-snapshot</id>
      			<name>Spring Maven Milestone Repository</name>
      			<url>http://maven.springframework.org/snapshot</url>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
      		</repository>
      
      		<repository>
      			<id>JBoss Repo</id>
      			<name>JBoss Maven Release Repository</name>
      			<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
      		</repository>
      	
      		<repository>
      			<id>neo4j-release-repository</id>
      			<name>Neo4j Maven 2 release repository</name>
      			<url>http://m2.neo4j.org/releases</url>
      			<releases>
      				<enabled>true</enabled>
      			</releases>
      			<snapshots>
      				<enabled>false</enabled>
      			</snapshots>
      		</repository>
      		<repository>
      			<id>neo4j-snapshot-repository</id>
      			<name>Neo4j Maven 2 snapshot repository</name>
      			<url>http://m2.neo4j.org/snapshots</url>
      			<releases>
      				<enabled>false</enabled>
      			</releases>
      			<snapshots>
      				<enabled>true</enabled>
      			</snapshots>
      		</repository>
      
      	</repositories>
      
      	<pluginRepositories>
      
      		<pluginRepository>
      			<id>spring-maven-release</id>
      			<name>Spring Maven Release Repository</name>
      			<url>http://maven.springframework.org/release</url>
      		</pluginRepository>
      		<pluginRepository>
      			<id>spring-maven-milestone</id>
      			<name>Spring Maven Milestone Repository</name>
      			<url>http://maven.springframework.org/milestone</url>
      		</pluginRepository>
      
      	</pluginRepositories>
      
      	<build>
      
      		<plugins>
      
      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-compiler-plugin</artifactId>
      				<version>2.3.2</version>
      				<configuration>
      					<source>${java.version}</source>
      					<target>${java.version}</target>
      					<encoding>UTF-8</encoding>
      				</configuration>
      			</plugin>
      
      			<plugin>
      				<groupId>org.codehaus.mojo</groupId>
      				<artifactId>aspectj-maven-plugin</artifactId>
      				<version>1.4</version>
      				<dependencies>
      					<dependency>
      						<groupId>org.aspectj</groupId>
      						<artifactId>aspectjrt</artifactId>
      						<version>${aspectj.version}</version>
      					</dependency>
      					<dependency>
      						<groupId>org.aspectj</groupId>
      						<artifactId>aspectjtools</artifactId>
      						<version>${aspectj.version}</version>
      					</dependency>
      				</dependencies>
      				<executions>
      					<execution>
      						<goals>
      							<goal>compile</goal>
      							<goal>test-compile</goal>
      						</goals>
      					</execution>
      				</executions>
      				<configuration>
      					<outxml>true</outxml>
      					<aspectLibraries>
      						<aspectLibrary>
      							<groupId>org.springframework</groupId>
      							<artifactId>spring-aspects</artifactId>
      						</aspectLibrary>
      						<aspectLibrary>
      							<groupId>org.springframework.data</groupId>
      							<artifactId>spring-data-neo4j-aspects</artifactId>
      						</aspectLibrary>
      					</aspectLibraries>
      					<source>${java.version}</source>
      					<target>${java.version}</target>
      				</configuration>
      			</plugin>
      
      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-eclipse-plugin</artifactId>
      				<version>2.7</version>  <!-- Note 2.8 does not work with AspectJ aspect path -->
      				<configuration>
      					<downloadSources>true</downloadSources>
      					<downloadJavadocs>false</downloadJavadocs>
      					<wtpversion>2.0</wtpversion>
      					<additionalBuildcommands>
      						<buildCommand>
      							<name>org.eclipse.ajdt.core.ajbuilder</name>
      							<arguments>
      								<aspectPath>org.springframework.aspects</aspectPath>
      							</arguments>
      						</buildCommand>
      						<buildCommand>
      							<name>org.springframework.ide.eclipse.core.springbuilder</name>
      						</buildCommand>
      					</additionalBuildcommands>
      					<additionalProjectnatures>
      						<projectnature>org.eclipse.ajdt.ui.ajnature</projectnature>
      						<projectnature>com.springsource.sts.roo.core.nature</projectnature>
      						<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
      					</additionalProjectnatures>
      				</configuration>
      			</plugin>
      
      		</plugins>
      
      	</build>
      
      </project>
      

        Attachments

          Activity

            People

            • Assignee:
              mhunger Michael Hunger
              Reporter:
              twuersch Thomas Würsch
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: