Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-22739

Email template insert violate unique key and hence stops tomcat restart

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Blocker
    • Resolution: Incorporated
    • Affects Version/s: 2.9.0
    • Fix Version/s: None
    • Component/s: Email Template Service
    • Labels:
      None

      Description

      The is with Sakai 2.9.0rc1 fresh download and without any configuration file.

      I can successfully start Tomcat for the first time, but after I stopped it and tried to restart, the restart failed due to the email template inset problem. See the stacktrace below:

      2012-10-03 11:58:13,212 WARN main org.hibernate.util.JDBCExceptionReporter - SQL Error: -104, SQLState: 23000
      2012-10-03 11:58:13,212 ERROR main org.hibernate.util.JDBCExceptionReporter - Violation of unique constraint SYS_CT_107: duplicate value(s) for column(s) TEMPLATE_KEY,TEMPLATE_LOCALE in statement [insert into EMAIL_TEMPLATE_ITEM (ID, LAST_MODIFIED, OWNER, SUBJECT, emailfrom, MESSAGE, HTMLMESSAGE, TEMPLATE_KEY, TEMPLATE_LOCALE, defaultType, VERSION) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
      2012-10-03 11:58:13,216 ERROR main org.sakaiproject.util.NoisierDefaultListableBeanFactory - Failed to preinstantiate the singleton named org.sakaiproject.poll.logic.ExternalLogic. Destroying all Spring beans.
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.sakaiproject.poll.logic.ExternalLogic' defined in file [/Users/zqian/apache-tomcat-5.5.30/components/polls-pack/WEB-INF/components.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Key: polls.notifyDeletedOption and locale: default in use already
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.sakaiproject.util.NoisierDefaultListableBeanFactory.getBean(NoisierDefaultListableBeanFactory.java:112)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.sakaiproject.util.NoisierDefaultListableBeanFactory.preInstantiateSingletons(NoisierDefaultListableBeanFactory.java:73)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      at org.sakaiproject.component.impl.SpringCompMgr.init(SpringCompMgr.java:160)
      at org.sakaiproject.component.cover.ComponentManager.getInstance(ComponentManager.java:98)
      at org.sakaiproject.component.impl.ContextLoader.loadParentContext(ContextLoader.java:107)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:195)
      at org.sakaiproject.component.impl.ContextLoader.initWebApplicationContext(ContextLoader.java:64)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at org.sakaiproject.util.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:56)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:634)
      at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:561)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:496)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1203)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
      Caused by: java.lang.IllegalArgumentException: Key: polls.notifyDeletedOption and locale: default in use already
      at org.sakaiproject.emailtemplateservice.service.impl.EmailTemplateServiceImpl.saveTemplate(EmailTemplateServiceImpl.java:249)
      at org.sakaiproject.poll.logic.impl.ExternalLogicImpl.xmlToTemplate(ExternalLogicImpl.java:556)
      at org.sakaiproject.poll.logic.impl.ExternalLogicImpl.loadMailTemplate(ExternalLogicImpl.java:513)
      at org.sakaiproject.poll.logic.impl.ExternalLogicImpl.init(ExternalLogicImpl.java:232)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
      ... 44 more
      Caused by: org.springframework.dao.DataIntegrityViolationException: could not insert: [org.sakaiproject.emailtemplateservice.model.EmailTemplate]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.sakaiproject.emailtemplateservice.model.EmailTemplate]
      at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:636)
      at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
      at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
      at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)
      at org.sakaiproject.genericdao.hibernate.HibernateGenericDao.baseCreate(HibernateGenericDao.java:352)
      at org.sakaiproject.genericdao.hibernate.HibernateGenericDao.create(HibernateGenericDao.java:627)
      at org.sakaiproject.genericdao.hibernate.HibernateGenericDao.save(HibernateGenericDao.java:668)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy4.save(Unknown Source)
      at org.sakaiproject.emailtemplateservice.service.impl.EmailTemplateServiceImpl.saveTemplate(EmailTemplateServiceImpl.java:246)
      ... 54 more
      Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [org.sakaiproject.emailtemplateservice.model.EmailTemplate]
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2153)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2633)
      at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:51)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
      at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
      at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:536)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:524)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:520)
      at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:697)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
      ... 71 more
      Caused by: java.sql.SQLException: Violation of unique constraint SYS_CT_107: duplicate value(s) for column(s) TEMPLATE_KEY,TEMPLATE_LOCALE in statement [insert into EMAIL_TEMPLATE_ITEM (ID, LAST_MODIFIED, OWNER, SUBJECT, emailfrom, MESSAGE, HTMLMESSAGE, TEMPLATE_KEY, TEMPLATE_LOCALE, defaultType, VERSION) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
      at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
      ... 88 more
      java.lang.Exception: traceback
      at org.sakaiproject.util.NoisierDefaultListableBeanFactory.destroySingletons(NoisierDefaultListableBeanFactory.java:94)
      at org.sakaiproject.util.NoisierDefaultListableBeanFactory.preInstantiateSingletons(NoisierDefaultListableBeanFactory.java:83)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      at org.sakaiproject.component.impl.SpringCompMgr.init(SpringCompMgr.java:160)
      at org.sakaiproject.component.cover.ComponentManager.getInstance(ComponentManager.java:98)
      at org.sakaiproject.component.impl.ContextLoader.loadParentContext(ContextLoader.java:107)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:195)
      at org.sakaiproject.component.impl.ContextLoader.initWebApplicationContext(ContextLoader.java:64)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at org.sakaiproject.util.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:56)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:634)
      at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:561)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:496)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1203)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  dhorwitz David Horwitz
                  Reporter:
                  zqian Zhen Qian
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration