cancel
Showing results for 
Search instead for 
Did you mean: 

org.hibernate.AssertionFailure while bulk import.

atkiba
Champ in-the-making
Champ in-the-making
Hi!

This is the first time I use the forum so I don't know if this is the right place for this question. I've been looking around in the forum but I didn't find an answer. I'm using Alfresco Community 3.2 and I created a Java aplication which executes a Webscript for bulk import of files. This is working really slow but the main problem is that after 4 hours of execution the aplication stops and I get this log error:


19:03:14,894 ERROR [org.alfresco.web.scripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 05140319 Wrapped Exception (with status template): null id in org.alfresco.repo.domain.hibernate.ChildAssocImpl entry (don't flush the Session after an exception occurs)
org.alfresco.web.scripts.WebScriptException: 05140319 Wrapped Exception (with status template): null id in org.alfresco.repo.domain.hibernate.ChildAssocImpl entry (don't flush the Session after an exception occurs)
   at org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
   at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:165)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:357)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:407)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:424)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:288)
   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:262)
   at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
   at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
Caused by: org.hibernate.AssertionFailure: null id in org.alfresco.repo.domain.hibernate.ChildAssocImpl entry (don't flush the Session after an exception occurs)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:55)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:164)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
   at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.flushSession(DirtySessionMethodInterceptor.java:304)
   at org.alfresco.repo.domain.hibernate.SessionSizeResourceManager.manageResources(SessionSizeResourceManager.java:147)
   at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:196)
   at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy9.hasAspect(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
   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:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy9.hasAspect(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor222.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
   at $Proxy10.hasAspect(Unknown Source)
   at org.alfresco.repo.node.MLPropertyInterceptor.getPivotNodeRef(MLPropertyInterceptor.java:324)
   at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:164)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:203)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:203)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy9.getProperty(Unknown Source)
   at org.alfresco.repo.security.person.PersonServiceImpl.makeHomeFolderIfRequired(PersonServiceImpl.java:551)
   at org.alfresco.repo.security.person.PersonServiceImpl.getPersonOrNull(PersonServiceImpl.java:319)
   at org.alfresco.repo.security.person.PersonServiceImpl.personExists(PersonServiceImpl.java:298)
   at org.alfresco.repo.model.Repository.getPerson(Repository.java:274)
   at org.alfresco.repo.web.scripts.RepositoryContainer.addRepoParameters(RepositoryContainer.java:221)
   at org.alfresco.repo.web.scripts.RepositoryContainer.access$200(RepositoryContainer.java:80)
   at org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:195)
   at org.alfresco.repo.web.scripts.RepositoryContainer$1.execute(RepositoryContainer.java:190)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:252)
   at org.alfresco.repo.web.scripts.RepositoryContainer.getTemplateParameters(RepositoryContainer.java:188)
   at org.alfresco.web.scripts.AbstractWebScript.createTemplateParameters(AbstractWebScript.java:408)
   at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:95)
   … 21 more


This is the webscript I'm executing:

<javascript>
var filename = null;
var content = null;
var tipo_documento = null;
var num_liquidacion = null;
var num_folio = null;
var centro = null;
var fecha = null;
var cod_cliente = null;
var rut_cliente = null;
var Ruta_ALF = "";

//var Ruta_ALF = "Expediente de Titulo/11000000/11230000/11234500/Expediente/Reservado";

try
   {
for each (field in formdata.fields)
{
  
   if (field.name == "tipo_documento")
   {
      tipo_documento = field.value;
   }
   if (field.name == "num_liquidacion")
   {
      num_liquidacion = field.value;
   }
   if (field.name == "num_folio")
   {
      num_folio = field.value;
   }
   if (field.name == "centro")
   {
      centro = field.value;
   }
   if (field.name == "fecha")
   {  
     fecha = field.value;
      if(fecha == "")
      {     
         fecha = null;
      }
      else
      {
         fecha = fecha.replaceAll("-","/");
         fecha = new Date(fecha);
      }
   }
   if (field.name == "cod_cliente")
   {
      cod_cliente = field.value;
   }
   if (field.name == "rut_cliente")
   {
      rut_cliente = field.value;
   }
   if(field.name == "file" && field.isFile)
   {
      filename = field.filename;
      content = field.content;
   }
 
}
}catch (mierror){
     status.code = 777;
     status.message = "Error detectado: " + mierror.description;
     status.redirect = true;
     logger.log("Error detectado: " + mierror.description);
 
   }
      
   if (filename == undefined || content == undefined)
   {
     status.code = 401;
     status.message = "El archivo cargado no puede ser ubicado en el lugar solicitado";
     status.redirect = true;
     logger.log("El nombre de archivo o su contenido no han sido definidos.");
   }
else
{

//var folder = "10000000/11000000/11230000/11234500/Expediente/Reservado"



//var space = "Company Home/Lipigas/Validacion/"
var space = "Company Home/PENDIENTES/";
var espacio = roothome.childByNamePath(space+centro+"/"+num_liquidacion);


if(espacio == null || espacio == undefined)
{
   if(roothome.childByNamePath(space+centro)==null || roothome.childByNamePath(space+centro)== undefined)
   {
        path = (space);
        espacio = roothome.childByNamePath(path);
        espacio = espacio.createFolder(centro);
   }
   if(roothome.childByNamePath(space+centro+"/"+num_liquidacion)==null || roothome.childByNamePath(space+centro+"/"+num_liquidacion)== undefined)
   {
      
        path = (space+centro);
        espacio = roothome.childByNamePath(path);
        espacio = espacio.createFolder(num_liquidacion);
   }


}

     try
   {

   upload = espacio.createFile(filename); 
 
     upload.properties.content.write(content);
     upload.properties.content.encoding = "UTF-8";
     upload.properties["lip:tipo_documento"] = tipo_documento ;
     upload.properties["lip:num_liquidacion"] = num_liquidacion ;
     upload.properties["lip:num_folio"] = num_folio ;
     upload.properties["lip:centro"] = centro ;
     upload.properties["lip:fecha"] = fecha ;
     upload.properties["lip:cod_cliente"] = cod_cliente ;
     upload.properties["lip:rut_cliente"] = rut_cliente ;

     upload.save();

     model.upload = upload;
    
   }catch (mierror){
        status.code = 300;
        status.message = "Error detectado: " + mierror.description;
        status.redirect = true;
        logger.log("Error detectado: " + mierror.description);      
       }

}
</javascript>

If there is any information I've missed please tell me. I appreciate your help!
1 REPLY 1

abarisone
Star Contributor
Star Contributor
Hi,
you could use this extension https://code.google.com/p/alfresco-bulk-filesystem-import/ wich allows you to have more control over import process.

Regards,
Andrea