0

I am trying to get spring boot 1.5.7 to work with Hibernate with Hikari CP. I am getting this in the logs:

 0-Apr-2018 14:07:59.544 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
 30-Apr-2018 14:07:59.545 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/web] startup failed due to previous errors
 30-Apr-2018 14:07:59.550 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [web] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
 30-Apr-2018 14:07:59.550 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [web] appears to have started a thread named [pool-1-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java .util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1081 java  util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
30-Apr-2018 14:07:59.550 WARNING [localhost-startStop-1]  org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [web] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

This repeats about 5 times, which I think is no coincidence is the minimum connections I tell Hikari to start with. here is the relevant application.properties section:

 # -- Hibernate / JPA
 spring.datasource.type=com.zaxxer.hikari.HikariDataSource
 spring.datasource.url=jdbc:mysql://xxxx:3306/gridunity?useSSL=false
 spring.datasource.username=xxxxx
 spring.datasource.password=xxxx
 spring.datasource.hikari.connection-timeout=60000
 spring.datasource.hikari.maximum-pool-size=5

  spring.jpa.hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
 spring.jpa.properties.hibernate.id.new_generator_mappings = false
 spring.jpa.properties.hibernate.format_sql = false
 spring.jpa.properties.hibernate.ejb.naming_strategy=FooBar
 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
  spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext

here is the relevant POM parts:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.7.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<dependencies> 
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
        </exclusion>
    </exclusions>       
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-websocket</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-messaging</artifactId>
    </dependency>   
    <dependency>
        <groupId>com.zaxxer</groupId>
        <artifactId>HikariCP</artifactId>
    </dependency>       

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>

Now I tested the DB URL, name and password through MySql so I know that's not it.

Any Ideas?

** EDIT ** to @Raja.

There is one line that says Hikara started:

2018-04-30 14:36:53,560 INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Started.


 2018-04-30 14:36:59,911 INFO  o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
 2018-04-30 14:36:59,912 INFO  o.s.j.e.a.AnnotationMBeanExporter - Bean with name 'dataSource' has been autodetected for JMX exposure  
 2018-04-30 14:36:59,915 INFO  o.s.j.e.a.AnnotationMBeanExporter - Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
 2018-04-30 14:36:59,918 INFO  o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 2147483647
 2018-04-30 14:36:59,919 INFO  o.s.m.s.b.SimpleBrokerMessageHandler - Starting...
 2018-04-30 14:36:59,919 INFO  o.s.m.s.b.SimpleBrokerMessageHandler - BrokerAvailabilityEvent[available=true, SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]]
 2018-04-30 14:36:59,919 INFO  o.s.m.s.b.SimpleBrokerMessageHandler - Started.
 2018-04-30 14:37:00,192 INFO  o.h.h.i.QueryTranslatorFactoryInitiator - HHH000397: Using ASTQueryTranslatorFactory
 2018-04-30 14:37:26,526 DEBUG c.g.web.ConnectionsConfiguration - Field acls cached
 2018-04-30 14:37:26,610 INFO  com.xxx.web.Application - Started Application in 35.556 seconds (JVM running for 36.992)
mmaceachran
  • 3,178
  • 7
  • 53
  • 102
  • The stacktrace of the actual error should be few lines above this snippet you have posted... Could check once again from the top of the log.? – Raja Anbazhagan Apr 30 '18 at 21:07
  • Addded for you. But they seem (to me) that the beans are loading fine. – mmaceachran Apr 30 '18 at 21:27
  • the first line of the log says `One or more listeners failed to start` There should be a stacktrace somewhere in the catalina.out or the application log file. – Raja Anbazhagan May 01 '18 at 05:50
  • It does not necessarily be because of a bean. It could be because of reasons like incorrect directory permissions or the port where the tomcat wants to listen is occupied. – Raja Anbazhagan May 01 '18 at 05:51
  • The lines with `WARNING` are unrelated, something else is preventing the startup. Although the additional logging provided states it did actually start, so does it really not start? Also what are you trying to do launch a standalone Spring Boot application or deploy it to a running Tomcat instance? For starters remove the `spring.jpa.hibernate.connection.provider_class` setting (you are injecting an externally managed `DataSource` so don't use this). Also you can remove the `spring.datasource.type` and I doubt that `FooBar` is a valid `spring.jpa.properties.hibernate.ejb.naming_strategy` – M. Deinum May 01 '18 at 06:37
  • M it does not start. I tried everything you have sugested and nothing at all has changed. The middle of the the log is all Spring mapping, so It's starting up just fine. As soon as it tries to start, if shuts down and that's what I think are causing the errors. – mmaceachran May 01 '18 at 16:38
  • I wonderif it has anything to do with the connections as is due to something else entirely. – mmaceachran May 01 '18 at 16:39

0 Answers0