1

I am getting this error on Spring Boot:

2018-03-13 13:39:26.663  WARN 6980 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory

I know it's a error on the ORM. But I want to know which one. I have many entities. Probably one mapping is wrong. Which one?

Edit - Current logback.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration packagingData="true">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n%ex{full, DISPLAY_EX_EVAL}
            </pattern>
        </encoder>
    </appender>
    <root level="debug">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

Edit2:

Tried to downgrade logback on .pom

<properties>
    <logback.version>1.1.3</logback.version>
</properties>

No luck. Does not seem an issue with logback.

8
  • 1
    To know the reason of this error, you need to read the complete stack trace of the exception. But you chose not to post it, thus shooting yourself in the foot. Commented Mar 13, 2018 at 16:43
  • It does not output it. That's the problem.. Commented Mar 13, 2018 at 16:44
  • You need to set the log level of org.hibernate package to debug - depends on your logging configuration. Are you using logback? You can try putting 'logging.level.org.hibernate=debug' in your application.properties Commented Mar 13, 2018 at 16:46
  • I am using logback. setting logging.level.org.hibernate=DEBUG outputted a lot, except the exception. Commented Mar 13, 2018 at 16:59
  • So the exception is not coming from that package. can you try org/springframework/boot/autoconfigure=debug Commented Mar 13, 2018 at 17:00

1 Answer 1

1

According to logback's documentation "%ex" should be used to output full stacktraces. Configuration should be similar to:

 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%msg%n%ex{full, DISPLAY_EX_EVAL}</pattern>
    </encoder>
  </appender>
Sign up to request clarification or add additional context in comments.

6 Comments

tried it, no luck.. seems hibernate is not sending the exception
@ThiagoSayão - have you tried adding the org.hibernate package to logback config or just move to older logback version if you think the issue is in logback?
I have set the root to debug, so It should work. Also tried to downgrade logback. Does not seem an issue with logback.
Thru Intellij Idea run dashboard.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.