Problems

From DoKSwiki

Table of contents

LazyInitializationException

LazyInitializationException when adding or deleting a record or when exporting records

Symptoms

It's impossible to delete certain records or link a new one to an existing record. Also ant exportrecords generates the same errors, and possibly other actions as well. This is a stack trace of the problem occurring during ExportRecords:

ERROR [main] exportRecords - net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: SAut413ebf1701d3db730101fc967a4d105a, of class: doks.record.Record
ERROR [main] initialize - Failed to lazily initialize a collection
 net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: SAut413ebf17093f9ba2010943d12fa60f0e, of class: doks.record.Record
	at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38)
	at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1964)
	at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
	at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208)
	at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:130)
	at net.sf.hibernate.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:365)
	at net.sf.hibernate.collection.Set.readFrom(Set.java:233)
	at net.sf.hibernate.loader.Loader.readCollectionElement(Loader.java:384)
	at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:240)
	at net.sf.hibernate.loader.Loader.doQuery(Loader.java:285)
	at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
	at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:1020)
	at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:995)
	at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:83)
	at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:288)
	at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3315)
	at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
	at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
	at net.sf.hibernate.collection.Set.iterator(Set.java:130)
	at doks.importexport.XMLGenerator.exportRecords(XMLGenerator.java:137)
	at doks.importexport.XMLGenerator.exportRecords(XMLGenerator.java:150)
	at doks.importexport.XMLGenerator.exportRecords(XMLGenerator.java:150)
	at doks.importexport.XMLGenerator.exportRecords(XMLGenerator.java:150)
	at doks.importexport.ImportExportManager.exportRecords(ImportExportManager.java:208)
	at doks.facade.ImportExportFacadeImpl.___AW_$_AW_$exportRecords$_AW_$1$_AW_$doks_facade_ImportExportFacadeImpl(ImportExportFacadeImpl.java:56)
	at org.codehaus.aspectwerkz.joinpoint.management.___AW_JP_execution_doks_facade_ImportExportFacadeImpl_doks_facade_ImportExportFacadeImpl_63137060_doks.proceed(Unknown Source)
	at doks.framework.TransactionAspect.getTransaction(TransactionAspect.java:54)
	at org.codehaus.aspectwerkz.joinpoint.management.___AW_JP_execution_doks_facade_ImportExportFacadeImpl_doks_facade_ImportExportFacadeImpl_63137060_doks.proceed(Unknown Source)
	at org.codehaus.aspectwerkz.joinpoint.management.JoinPointManager.proceedWithExecutionJoinPoint(JoinPointManager.java:231)
	at doks.facade.ImportExportFacadeImpl.exportRecords(ImportExportFacadeImpl.java)
	at doks.data.ExportTask.main(ExportTask.java:35)

Cause

The database tables linking_fields and folder_records contained references to ID's of non existent records. This was caused by restoring a backup of these tables that was not synchronized with the current state of the rest of the database.

Solution

Find all offending records by running ant exportrecords, which logs the errors and ID's when it can not export a certain record. The log can be used to create a sql script to delete all the offending records from the linking_fields and folder_records tables, e.g.:

DELETE FROM `folder_records` where record_id='SKHK413ebf17093f9ba2010943c674cd03e2';
DELETE FROM `linking_fields` where id='SKHK413ebf17093f9ba2010943c674cd03e2';

LazyInitializationException on a User

Symptoms

An error in DoKS and a corresponding error in the log file similar to this:

FATAL [TP-Processor1] getRecordDTO - net.sf.hibernate.LazyInitializationException: Exception initializing proxy: [doks.user.User#User8aae81860c1a2881010c1a7a47800004]

Cause

A Record or FileSet or Folder or other object has a reference to a User record that does not exist anymore.

Solution

Make a database dump (for MySQL: mysqldump -u root -p [database name] > [path + filename of dump file])
Open it in a text editor and search for the offending User ID (e.g. User8aae81860c1a2881010c1a7a47800004)
When you found the offending records and the tables they are in you can change them directly in the database. Either by deleting the records (see above) or changing the value of the field containing the user ID. e.g. UPDATE `FileSet` SET owner=NULL where owner='User8aae81860c1a2881010c1a7a47800004';, UPDATE `Folder` SET owner=NULL where owner='User8aae81860c1a2881010c1a7a47800004';, UPDATE `Record` SET owner=NULL where owner='User8aae81860c1a2881010c1a7a47800004';)


Problem opening PDF files on an SSL configured doks site using Internet explorer

If you are experiencing problems opening PDF files on your doks site, mainly SSL configured sites then adding this code configuration in your tomcat configuration context.xml file will help:

<Valve className="org.apache.catalina.authenticator.NonLoginAuthenticator" disableProxyCaching="true" securePagesWithPragma="false" />