Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16559

Missing PersistenceException cause message in refresh failure warn log

    XMLWordPrintable

    Details

    • Last commented by a User:
      true

      Description

      Logging a BeanCreationException containing a PersistenceException doesn't log the PersistenceException's cause (a MappingException in my case).

      Log prints:

      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

      but the important message is missing (extracted from manual debug):

      org.hibernate.MappingException: Could not determine type for: pse.shop.component.ShopComponent, at table: shop_template_component, for columns: [org.hibernate.mapping.Column(component)]

      From my investigation, the issue is in NestedExceptionUtls.java, line 52:

      sb.append("nested exception is ").append(cause);

      where cause is an instance of PersistenceException, but PersistenceException.toString() doesn't contain the cause string.

      This issue adds development overhead requiring manual debug to extract the exception message.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            cdalxndr cda
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 31 weeks, 2 days ago