Marcos,

Looks like your address hierarchy entry table got into some sort of wonky state 
when it crashed.  I'd be interested in the more detailed information that 
Darius asked for, so we could potentially prevent it from failing this badly in 
the future, but to solve your problem you could probably just delete all the 
entries in the address_hierarchy_entry and address_hierarchy_level and then try 
the import again (assuming the TXT file had the entire hierarchy, i.e. you 
weren't trying to add to some existing hierarchy data in the system).  You'll 
want to delete all entries in the tables, not drop the tables completely, so 
you'd be doing the following mysql calls:

delete from address_hierarchy_entry;
delete from address_hierarchy_level;

You may get some foreign key errors when attempting to delete the rows, in 
which case you'll have to turn foreign key checks off before deleting, and then 
turn them back on again:

set foreign_key_checks = 0;
delete from address_hierarchy_entry;
delete from address_hierarchy_level;
set foreign_key_checks = 1;

Let me know if this works.
Mark

From: [email protected] [mailto:[email protected]] On Behalf Of 
Darius Jazayeri
Sent: Wednesday, August 17, 2011 10:08 AM
To: [email protected]
Subject: Re: [OPENMRS-IMPLEMENTERS] Address Hierarchy Module error

Hi Marcos,

Somewhere in your tomcat log file, near this exception, you'll see a bit more 
detailed information, probably including the specific SQL call that failed.

Can you look for that?

-Darius

On Wed, Aug 17, 2011 at 6:49 AM, Marcos Núñez 
<[email protected]<mailto:[email protected]>> wrote:
I was importing a list of Provinces/Cities/ZIP-Codes to the Address Hierachy 
Module from a TXT, when I got the "Java memory heap" error. I guess I ran out 
of memory, so I restarted tomcat with "-Xmx512m -Xms512m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:NewSize=128m". When I go to the admin page to reimport 
the txt, I got this error:

org.hibernate.exception.ConstraintViolationException





Could not execute JDBC batch update
Tried reinstalling the module, did not work. Any ideas?
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1562)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
org.openmrs.module.addresshierarchy.db.hibernate.HibernateAddressHierarchyDAO.getAddressHierarchyEntryCountByLevel(HibernateAddressHierarchyDAO.java:57)
org.openmrs.module.addresshierarchy.service.AddressHierarchyServiceImpl.getAddressHierarchyEntryCountByLevel(AddressHierarchyServiceImpl.java:234)
org.openmrs.module.addresshierarchy.service.AddressHierarchyServiceImpl.setAddressHierarchyLevelParents(AddressHierarchyServiceImpl.java:421)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy287.setAddressHierarchyLevelParents(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:114)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy288.setAddressHierarchyLevelParents(Unknown Source)
org.openmrs.module.addresshierarchy.web.controller.AddressHierarchyAdminController.getOrderedAddressHierarchyLevels(AddressHierarchyAdminController.java:70)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:162)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:65)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:76)
org.openmrs.module.xforms.web.XformsFilter.doFilter(XformsFilter.java:60)
org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:74)
org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:58)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:112)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:83)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:636)


OpenMRS Version: 1.8.2 Build 21762
________________________________
Click here to 
unsubscribe<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
 from OpenMRS Implementers' mailing list

________________________________
Click here to 
unsubscribe<mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l>
 from OpenMRS Implementers' mailing list

_________________________________________

To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-implement-l" in the  body 
(not the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

Reply via email to