2016-07-29 6 views
0

Neo4jデータベースを含むSpring MVC(4.2.0.RELEASE)を使用してJava Rest Serviceを開発しています。したがって、Spring Data Neo4j(4.1.1.RELEASE)が使用されます。SpringデータNeo4j複数のバージョンをtomcatにデプロイするときのNullPointerException

@Configuration 
@ComponentScan(basePackages = { "com.xxx.yyy" }) 
@EnableNeo4jRepositories(basePackages = "com.xxx.yyy.dao.repo") 
@EnableTransactionManagement 
public class Neo4jConfig extends Neo4jConfiguration { 

    @Autowired 
    private ApplicationProperties properties; 

    @Bean 
    public SessionFactory getSessionFactory() { 
     return new SessionFactory(getConfiguration(), "com.xxx.yyy.dao.beans"); 
    } 

    @Bean 
    public Neo4jOperations neo4jTemplate() throws Exception { 
     return new Neo4jTemplate(getSession()); 
    } 

    @Bean 
    public org.neo4j.ogm.config.Configuration getConfiguration() { 
     org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration(); 

     config.driverConfiguration().setDriverClassName(this.properties.getNeo4jDriver()) 
       .setURI(this.properties.getNeo4jEndpoint()) 
       .setCredentials(this.properties.getNeo4jUser(), this.properties.getNeo4jPassword()); 

     return config; 
    } 

    @Bean 
    @Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) 
    public Session getSession() throws Exception { 
     return super.getSession(); 
    } 

} 

アプリケーションを本番環境にTomcat7に配備されています。

SDNの構成は次のようになります。

ゼロダウンタイムの展開では、複数のバージョンを展開するためにtomcatのバージョンフラグを使用したいと思います。私がそうするならば、アプリケーションはorg.neo4j.ogm.context.RestModelMapperNullPointerExceptionのためにもう働かない。

スタックトレース:

java.lang.NullPointerException 
    at org.neo4j.ogm.context.RestModelMapper.mapEntity(RestModelMapper.java:153) ~[neo4j-ogm-core-2.0.1.jar:?] 
    at org.neo4j.ogm.context.RestModelMapper.map(RestModelMapper.java:76) ~[neo4j-ogm-core-2.0.1.jar:?] 
    at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:94) ~[neo4j-ogm-core-2.0.1.jar:?] 
    at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:73) ~[neo4j-ogm-core-2.0.1.jar:?] 
    at org.neo4j.ogm.session.Neo4jSession.query(Neo4jSession.java:313) ~[neo4j-ogm-core-2.0.1.jar:?] 

この問題は、私はTomcat上で、バージョンフラグを使用する場合にのみ発生します。 anybobyはここで何が問題なのか知っていますか?

答えて

0

最後に、OGM HTTPドライバのバージョンとSpring Data Neo4jの依存関係を変更することで、この問題を解決しました。これにより

<dependency> 
    <groupId>org.springframework.data</groupId> 
    <artifactId>spring-data-neo4j</artifactId> 
    <version>4.1.4.RELEASE</version> 
</dependency> 

<dependency> 
    <groupId>org.neo4j</groupId> 
    <artifactId>neo4j-ogm-http-driver</artifactId> 
    <version>2.0.5</version> 
</dependency> 

Tomcatのバージョンフラグhttps://tomcat.apache.org/tomcat-7.0-doc/config/context.htmlと展開が今働いている設定。

関連する問題