I have seen a couple threads on this.
We are using Spring 3.1.3
We are also configuring everything in Java Based Configuration. @Configuration.
Here is our configuration classCode:Caused by: java.lang.NullPointerException: null at org.springframework.data.neo4j.support.DelegatingGraphDatabase.getIndex(DelegatingGraphDatabase.java:131) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.isAlreadyIndexed(TypeRepresentationStrategyFactory.java:63) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.chooseStrategy(TypeRepresentationStrategyFactory.java:56) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory.<init>(TypeRepresentationStrategyFactory.java:41) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.config.Neo4jConfiguration.typeRepresentationStrategyFactory(Neo4jConfiguration.java:143) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.config.Neo4jConfiguration.mappingInfrastructure(Neo4jConfiguration.java:102) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at org.springframework.data.neo4j.config.Neo4jConfiguration.neo4jTemplate(Neo4jConfiguration.java:128) ~[spring-data-neo4j-2.1.0.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_07] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_07] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_07] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_07] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160) ~[spring-beans-3.1.3.RELEASE.jar:3.1.3.RELEASE]
ThanksCode:@ComponentScan(useDefaultFilters = false, basePackages = {"com.blah.account"}, includeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = AccountServerApp.class) }, excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class) } ) @ImportResource(value = {"classpath*:META-INF/spring/applicationContext-security-account.xml," + "classpath*:META-INF/spring/applicationContext-graph.xml"}) @EnableTransactionManagement @EnableJpaRepositories(basePackages = {"com.blah.account.repository.jpa"}) @EnableNeo4jRepositories(basePackages = {"com.blah.account.repository.neo4j"}) @PropertySource({"classpath:META-INF/spring/neo4j.properties"}) public class BlahApplicationConfiguration extends Neo4jConfiguration { @Autowired Environment env; @Bean public PersistenceAnnotationBeanPostProcessor persistenceTranslator() { return new PersistenceAnnotationBeanPostProcessor(); } @Bean public DataSource dataSource() { EmbeddedDatabaseBuilder embeddedDatabaseBuilder = new EmbeddedDatabaseBuilder(); embeddedDatabaseBuilder.addScript("classpath:META-INF/sqlscripts/create-account-tables.sql"); return embeddedDatabaseBuilder.build(); } @Bean public EntityManagerFactory entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setDatabase(Database.HSQL); vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("com.hdpoker.account"); factory.setDataSource(dataSource()); factory.afterPropertiesSet(); return factory.getObject(); } @Bean public JpaDialect jpaDialect() { return new HibernateJpaDialect(); } @Bean public PlatformTransactionManager transactionManager() { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactory()); return txManager; } @Bean(destroyMethod = "shutdown") public GraphDatabaseService graphDatabaseService() { return new EmbeddedGraphDatabase(env.getProperty("neo4j.location")); } }
Mark


Reply With Quote