1
votes

I'm starting a new project, and decided to try neo4j with springboot data neo4j and OGM. Everything is working just fine, but in my development env, the spring-boot-devtools is not helping much.

Every time that I change a java class, the Automatic restart triggers and then any query that I run throws a ClassCastException like

java.lang.ClassCastException: br.com.ncisaude.gr.dominio.usuario.Usuario cannot be cast to br.com.ncisaude.gr.dominio.usuario.Usuario
    at com.sun.proxy.$Proxy133.findByEmail(Unknown Source)...

Obviously it is a classloader issue, because the classes are just the same.

I believe that neo4j OGM or spring-data-neo4j use serialization for caching or something like that and this is causing this Exception, but im not realy sure.

Someone knows a workarround for this? if it is cache related, there is any way to disable those cache?

I dont know if I should send an issue to neo4j ogm or spring-boot-neo4j, any insights on this?

I'm running spring boot version 1.5.3 with bolt driver 2.1.2. My configuration has nothing specific, its just the default springboot setup with neo4j.

@Configuration
@EnableSpringConfigured
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
@EnableScheduling
@EntityScan("br.com.ncisaude.gr.dominio")
public class SpringConfig {


    @Bean
    @Profile("dev")
    public org.neo4j.ogm.config.Configuration getConfiguration() {
        org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();
        AutoIndexConfiguration autoIndexConfiguration = config.autoIndexConfiguration();
        // Modo assert remove e cria todas as constraints
        autoIndexConfiguration.setAutoIndex("assert");
        DriverConfiguration driverConfiguration = config.driverConfiguration();
        driverConfiguration.setURI("bolt://localhost");
        driverConfiguration.setCredentials("neo4j", "******");
        return config;
    }
}

Thanks in Advance

[]s

1

1 Answers

0
votes

Please see my reply to this issue here: https://github.com/neo4j/neo4j-ogm/issues/374