Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-5199

Crowd OpenID server startup logs DDL error from Hibernate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 3.7.0, 3.6.2
    • 3.2.1, 3.2.2, 3.3.0, 3.2.5, 3.4.0, 3.3.4, 3.5.0, 3.4.3, 3.4.4, 3.4.5, 3.5.1, 3.6.0
    • Database

      Since Crowd 3.2.1, logging configuration changes related Log4j has allowed Hibernate to log DDL errors while creating schema for Crowd OpenID.

      This doesn't affects any Crowd or OpenID operations, and is harmless, but still it borks in the logs for post Crowd 3.2.1 startups.

      It exists in versions prior to Crowd 3.2.1 as well but would not be logged, hence not visible.

      Example of the DDL errors in logs would be something like this:

      2018-06-27 16:11:12,881 localhost-startStop-1 WARN [tool.schema.internal.ExceptionHandlerLoggedImpl] GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement2018-06-27 16:11:12,881 localhost-startStop-1 WARN [tool.schema.internal.ExceptionHandlerLoggedImpl] GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statementorg.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:525) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applyForeignKeys(AbstractSchemaMigrator.java:429) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:245) at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:110) at  
      org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726) at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:511) at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1688) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1533) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1842) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)Caused by: java.sql.SQLException: Constraint already exists: FKAD5HDVSJWPAH0OJNRAAQT2VQS in statement [    alter table SITEAPPROVAL       add constraint FKad5hdvsjwpah0ojnraaqt2vqs       foreign key (PROFILE_ID)       references PROFILE] at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source) at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:294) at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:294) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ... 50 more

       

      Workaround:

      1. Shutdown Crowd 
      2. Edit the following XML file inside Crowd's installation folder {CROWD_INSTALLATION_FOLDER}/crowd-openidserver-webapp/WEB-INF/classes/applicationContext-OpenIDBootstrap.xml
      1. Replace the following XML element 
          <util:properties id="hibernateProperties">
              <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
              <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
              <prop key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
              <prop key="hibernate.dialect">${hibernate.dialect}</prop>
              <prop key="hibernate.hbm2ddl.auto">update</prop>
              <!-- it can be useful to disable batching during debugging, as HSQLDB doesn't report the exact
              statement which fails in batch mode -->
              <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
          </util:properties>

      with this

      <util:properties id="hibernateProperties">
              <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
              <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
              <prop key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
              <prop key="hibernate.dialect">${hibernate.dialect}</prop>
              <prop key="hibernate.hbm2ddl.auto">update</prop>
              <prop key="hibernate.default_schema">public</prop>
              <!-- it can be useful to disable batching during debugging, as HSQLDB doesn't report the exact
              statement which fails in batch mode -->
              <prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
          </util:properties>
      
      

      Restart Crowd,and, check the startup logs, it shouldn't log the DDL errors.

              Unassigned Unassigned
              gagarwal@atlassian.com Gaurav Agarwal (Inactive)
              Votes:
              14 Vote for this issue
              Watchers:
              26 Start watching this issue

                Created:
                Updated:
                Resolved: