Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of Spring Neo4j startup warnings?

I am using Spring Data Neo4j with Springboot, and the application works.

However, I have a raft of warnings on startup that I'd like to get rid of if possible.

2019-09-08 14:15:20.788  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.fatalEnabled
2019-09-08 14:15:20.789  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.errorEnabled
2019-09-08 14:15:20.790  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.infoEnabled
2019-09-08 14:15:20.790  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.debugEnabled
2019-09-08 14:15:20.790  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.traceEnabled
2019-09-08 14:15:20.791  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.apache.commons.logging.Log.warnEnabled
2019-09-08 14:15:20.796  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.parent
2019-09-08 14:15:20.796  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.environment
2019-09-08 14:15:20.797  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.classLoader
2019-09-08 14:15:20.797  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.displayName
2019-09-08 14:15:20.797  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.startupDate
2019-09-08 14:15:20.798  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.beanDefinitionCount
2019-09-08 14:15:20.798  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.autowireCapableBeanFactory
2019-09-08 14:15:20.798  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.beanDefinitionNames
2019-09-08 14:15:20.799  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.parentBeanFactory
2019-09-08 14:15:20.799  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.id
2019-09-08 14:15:20.799  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.context.ApplicationContext.applicationName
2019-09-08 14:15:20.801  INFO 10121 --- [  restartedMain] o.s.d.neo4j.mapping.Neo4jMappingContext  : No class information found in OGM meta-data for class org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration so treating as simple type for SD Commons
2019-09-08 14:15:20.802  INFO 10121 --- [  restartedMain] o.s.d.neo4j.mapping.Neo4jMappingContext  : No class information found in OGM meta-data for class org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder so treating as simple type for SD Commons
2019-09-08 14:15:20.805  INFO 10121 --- [  restartedMain] o.s.d.neo4j.mapping.Neo4jMappingContext  : No class information found in OGM meta-data for class org.springframework.security.config.annotation.web.builders.HttpSecurity so treating as simple type for SD Commons
2019-09-08 14:15:20.850  INFO 10121 --- [  restartedMain] o.s.d.neo4j.mapping.Neo4jMappingContext  : No class information found in OGM meta-data for class java.util.ArrayList so treating as simple type for SD Commons
2019-09-08 14:15:20.896  INFO 10121 --- [  restartedMain] o.s.d.neo4j.mapping.Neo4jMappingContext  : No class information found in OGM meta-data for class org.springframework.http.HttpHeaders so treating as simple type for SD Commons
2019-09-08 14:15:20.929  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.core.env.Environment.defaultProfiles
2019-09-08 14:15:20.929  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: org.springframework.core.env.Environment.activeProfiles
2019-09-08 14:15:20.932  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.initParameterNames
2019-09-08 14:15:20.932  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.virtualServerName
2019-09-08 14:15:20.932  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.classLoader
2019-09-08 14:15:20.932  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.filterRegistrations
2019-09-08 14:15:20.933  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.servletNames
2019-09-08 14:15:20.933  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.sessionTrackingModes
2019-09-08 14:15:20.933  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.contextPath
2019-09-08 14:15:20.933  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.defaultSessionTrackingModes
2019-09-08 14:15:20.934  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.majorVersion
2019-09-08 14:15:20.934  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.effectiveMinorVersion
2019-09-08 14:15:20.934  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.sessionCookieConfig
2019-09-08 14:15:20.934  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.effectiveSessionTrackingModes
2019-09-08 14:15:20.934  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.attributeNames
2019-09-08 14:15:20.935  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.serverInfo
2019-09-08 14:15:20.935  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.servletRegistrations
2019-09-08 14:15:20.935  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.jspConfigDescriptor
2019-09-08 14:15:20.935  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.servlets
2019-09-08 14:15:20.936  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.requestCharacterEncoding
2019-09-08 14:15:20.936  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.responseCharacterEncoding
2019-09-08 14:15:20.936  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.sessionTimeout
2019-09-08 14:15:20.936  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.minorVersion
2019-09-08 14:15:20.937  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.servletContextName
2019-09-08 14:15:20.937  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.ServletContext.effectiveMajorVersion
2019-09-08 14:15:20.938  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.FilterConfig.initParameterNames
2019-09-08 14:15:20.938  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.FilterConfig.servletContext
2019-09-08 14:15:20.939  WARN 10121 --- [  restartedMain] o.s.d.n.mapping.Neo4jPersistentProperty  : Owning ClassInfo is null for property: javax.servlet.FilterConfig.filterName

What is making it so unhappy?

like image 603
GreenAsJade Avatar asked Sep 08 '19 04:09

GreenAsJade


2 Answers

I ran into the same issue and after 2 days, I finally figured it out...

My pom.xml looks like this:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-neo4j</artifactId>
        <version>2.2.2.RELEASE</version> <!--$NO-MVN-MAN-VER$-->
    </dependency>

Then typically you'll have the username and password in your application properties:

spring.data.neo4j.open-in-view=false
spring.data.neo4j.uri=bolt://localhost
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=xxx

You'll also have your enable call:

@EnableNeo4jRepositories

It seems that the Neo4j code is scanning all classes in your app by default, but you can override this behavior:

  1. Create a config class and move your EnableNeo4jRepositories to there
  2. Specify your repo base package
  3. Specify your model base package

Now the Neo4j code knows to only scan the repo & model packages. Here is my config class for the Movie dataset:

@Configuration
@EnableNeo4jRepositories(basePackages="org.xx.yy.movies.repositories")
public class MoviesDataSourceConfig {

    @Bean
    public org.neo4j.ogm.config.Configuration getConfiguration() {
        org.neo4j.ogm.config.Configuration config = new Builder()
                .uri("bolt://username:password@localhost:7687").
                build();
        return config;
    }

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

    @Bean
    public SessionFactory sessionFactory() {
        return new SessionFactory(getConfiguration(), "org.xx.yy.movies.models");
    }
}

Note that you need to specify the username and password in the uri... this is still POC code, but I'm going to just pull them out of the spring.data.neo4j properties for productionalizing.

No more warning messages!

like image 195
SledgeHammer Avatar answered Sep 21 '22 11:09

SledgeHammer


Had same problem (SpringBoot 2.2.2 with dependency spring-boot-starter-data-neo4j). Got rid of the warning and narrowed scanning of entity/model classes by adding both annotations to the main @SpringBootApplication annotated application class:

@EnableNeo4jRepositories("my.project.reposoitory")
@EntityScan("my.project.model")

Avoids the need for a separate @Config class / overriding SpringBoot auto config. See the docs.

Update: Bumped the Spring Boot version to 2.2.4.RELEASE as I was having problems returning any data from my Neo4jRepository declarative methods. Suspect this is tx related, will raise a defect.

like image 23
Tom Bunting Avatar answered Sep 19 '22 11:09

Tom Bunting