Neo4j Spring Boot Actuator health and Unsupported authentication token, scheme 'none' is only allowed when auth is disabled

Actuator health endpoint in my Spring boot application shows:

"org.neo4j.driver.exceptions.AuthenticationException: Unsupported authentication token, scheme 'none' is only allowed when auth is disabled."

Neo4j is running, application is working properly. How to properly configure Spring Boot and Actuator to authenticate with Neo4j?

Could you please specify which versions are you using?
The question is based on the fact that there is a Spring Boot auto-configuration provided by Spring Boot 2.4+ but also a Spring Boot Java Driver starter provided by us for Spring Boot versions < 2.4.

Sorry for the late reply. I just noticed your answer.

Spring Boot 2.5.1, Neo4j 4.3

Could you check against the (very simple) example, I have created for differences?

In general there will be only one Java driver bean in the whole application context and used by Spring Data Neo4j AND the actuator.

1 Like

Thanks!

As I may see, the difference that you are configuring Neo4j via application.properties.

But in my application I also use LiquiGraph for migrations and my config looks like:

@Configuration
@EnableNeo4jRepositories(basePackages = "com.example.domain.repository.neo4j", transactionManagerRef = "neo4jTransactionManager")
@EnableTransactionManagement
public class Neo4jConfig {

    @Value("${neo4j.bolt.server.database.uri}")
    private String boltServerDatabaseUri;

    @Value("${neo4j.username}")
    private String username;

    @Value("${neo4j.password}")
    private String password;

    @Bean("neo4jTransactionManager")
    public Neo4jTransactionManager transactionManager() {
        return new Neo4jTransactionManager(sessionFactory());
    }

    @Bean
    public SessionFactory sessionFactory() {
        return new SessionFactory(configuration(), "com.decisionwanted.domain.model.neo4j");
    }

    @Bean
    @DependsOn("liquigraph")
    public org.neo4j.ogm.config.Configuration configuration() {

        // @formatter:off
        return new org.neo4j.ogm.config.Configuration.Builder()
                .autoIndex("validate")
                .credentials(username, password)
                .uri(boltServerDatabaseUri)
                .build();
        // @formatter:on
    }

    @Bean
    @ConfigurationProperties(
            prefix = "liquigraph",
            ignoreUnknownFields = false
    )
    public LiquigraphProperties liquigraphProperties() {
        return new LiquigraphProperties();
    }

    @Bean
    public SpringLiquigraph liquigraph(ResourceLoader loader, LiquigraphProperties properties) {
        String jdbcServerDatabaseUri = properties.getUrl();

        final HikariConfig config = new HikariConfig();
        config.setJdbcUrl(jdbcServerDatabaseUri);
        config.setUsername(properties.getUser());
        config.setPassword(properties.getPassword());
        DataSource dataSource = new HikariDataSource(config);

        SpringChangelogLoader changelogLoader = new SpringChangelogLoader(loader);
        return new SpringLiquigraph(dataSource, changelogLoader, properties.getChangeLog(), properties.getExecutionContexts());
    }

}

You are using Neo4j-OGM here. This is surprising because when using Spring Boot 2.4+ and the Spring Data Neo4j starter, you would get Spring Data Neo4j 6 which is completely independent from Neo4j-OGM.
I suspect that the Spring Data Neo4j (6) related driver got never configured.

yeah... I use SDN5 because failed so far to migrate to SDN6. This is my tech dept for some time in future

Ok, in this case, you would also have to provide a org.neo4j.driver.Driver bean manually.

@Bean
public Driver driver(org.neo4j.ogm.config.Configuration configuration) {....}

The auto configuration will, given that a proper Driver is provided, skip the automatic creation part and solely rely on this driver.

Thanks for your answer!

Thanks, this helped me. Only difference is I am configuring via application.yml and had to add driver between neo4j and authentication:

org:
  neo4j:
    driver:
      uri: bolt://localhost:7687
      pool:
        metrics-enabled: true
      authentication:
        username: neo4j
        password: ---