HibernateSystemException - Unknown entity class
Symptoms
An error containing "org.springframework.orm.hibernate.HibernateSystemException: Unknown entity class:" such as the following appears in the atlassian-confluence.log
:
org.springframework.orm.hibernate.HibernateSystemException: Unknown entity class: com.atlassian.confluence.user.persistence.dao.ConfluenceRememberMeToken; nested exception is net.sf.hibernate.MappingException: Unknown entity class: com.atlassian.confluence.user.persistence.dao.ConfluenceRememberMeToken
Caused by: net.sf.hibernate.MappingException: Unknown entity class: com.atlassian.confluence.user.persistence.dao.ConfluenceRememberMeToken
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2716)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2723)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:772)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)
at org.springframework.orm.hibernate.HibernateTemplate$9.doInHibernate(HibernateTemplate.java:568)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
at org.springframework.orm.hibernate.HibernateTemplate.save(HibernateTemplate.java:565)
at com.atlassian.confluence.user.rememberme.DefaultConfluenceRememberMeTokenDao.save(DefaultConfluenceRememberMeTokenDao.java:65)
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)
Diagnosis
Check whether there are customisations to databaseSubsystemContext.xml
.
- Is there a
WEB-INF/classes/databaseSubsystemContext.xml
file? - Are there alterations to the
databaseSubsystemContext.xml
file within theconfluence.jar
file.
Cause
The databaseSubsystemContext.xml feeds the list of entity mappings to Hibernate. If this has been customised and not updated at upgrade-time, then it will be missing any new entity mappings that are resolved. So in 3.4 this means the ConfluenceRememberMeToken, but in future/earlier versions it will mean other entities.
Resolution
- Fix the databaseSubystemContext.xml. Either:
- If there are no deliberate modifications to databaseSubsystemContext.xml, remove the file.
- If there are deliberate modifications, then unzip databaseSubsystemContext.xml out of confluence.jar and re-apply the modifications
- Add
-Datlassian.forceSchemaUpdate=true
to Confluence's system properties. This will create any tables that were missed because of the missing entity mapping. - Restart Confluence
- Check that extra tables are added and then remove the
-Datlassian.forceSchemaUpdate=true
flag.