Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

  • Add hibernate_sequence to TBASE2_POSTGRES_CREATION.sql for new database installations
  • Add idempotent migration script docker/03-migration-hibernate-sequence.sql
  • Update docker/entrypoint-dev.sh to run migrations on every container startup
  • Update docker-compose.yml to mount migration script
  • Address code review feedback
  • Investigate additional data type mismatch between ORM and database schema

Summary

This PR fixes the "relation hibernate_sequence does not exist" error that occurs during NEXUS file uploads.

Changes

  1. Schema fix: Added CREATE SEQUENCE hibernate_sequence; to the schema creation SQL
  2. Migration script: Created idempotent migration that safely creates the sequence if missing
  3. Auto-migration: Updated entrypoint script to run migrations on every container startup

Current Status

  • The hibernate_sequence issue is fixed
  • User confirmed database is properly wiped and recreated with correct matrixrow schema (6 columns)
  • New error: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1] with Bad value for type long
  • Requested user to verify matrixelement and rowsegment table schemas to identify additional type mismatches

How it works

  • New databases: The schema SQL creates the sequence during initialization
  • Existing databases: The entrypoint script runs the migration on container startup, creating the sequence if it doesn't exist

Testing

After pulling this change, simply restart the containers:

docker compose down -v
docker compose --profile development up -d

The migration will automatically create the missing sequence.

Original prompt

When I upload a file, I see this in the tomcat log:

treebase-web-dev   | Reading NEXUS file 1_1768338939_Gale_Vidovic_2023_Mesquite.nex.txt
treebase-web-dev   | Reading block: TAXA
treebase-web-dev   | Reading block: CHARACTERS
treebase-web-dev   | Reading CHARACTERS block Categorical states matrix
treebase-web-dev   | .. manual ready.
treebase-web-dev   | Reading block: CHARACTERS
treebase-web-dev   | Reading CHARACTERS block Continuous states matrix
treebase-web-dev   | Reading block: ASSUMPTIONS
treebase-web-dev   | Reading block: NOTES
treebase-web-dev   | Reading block: MESQUITECHARMODELS
treebase-web-dev   | Reading block: TREES
treebase-web-dev   | Reading block: MESQUITE
treebase-web-dev   | Module Basic File Coordinator (mesquite.minimal.BasicFileCoordinator.BasicFileCoordinator) did not respond to command timeSaved with arguments (1687991214851)
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | Note: File Busy or Not Found  (0): 
treebase-web-dev   | directory </usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../> 
treebase-web-dev   | file <GALE_&_Vidovic_2023_tree_out.tre>
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | Note: File Busy or Not Found  (0): 
treebase-web-dev   | directory </usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../> 
treebase-web-dev   | file <GALE_&_Vidovic_2023_tree_out.tre>
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | double // in path /usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../GALE_&_Vidovic_2023_tree_out.tre
treebase-web-dev   | Note: File Busy or Not Found  (0): 
treebase-web-dev   | directory </usr/local/tomcat/webapps/treebase-web/NexusFileUpload/rvosa//../> 
treebase-web-dev   | file <GALE_&_Vidovic_2023_tree_out.tre>
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command mqVersion with arguments (311)
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command checksumv with arguments (0 3 2303381834 null getNumChars 47 numChars 47 getNumTaxa 18 numTaxa 18 short false bits 7 states 7 sumSquaresStatesOnly 1906.0 sumSquares 1906.0 longCompressibleToShort true usingShortMatrix false NumFiles 4 NumMatrices 2)
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command mqVersion with arguments ()
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command mqVersion with arguments (311)
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command checksumv with arguments (1 3 4240696501 null numChars 1 numItems 1 min 6.0 max 15.0 sumSquares 1727.0 NumFiles 4 NumMatrices 2)
treebase-web-dev   | Module Character Matrix manager (mesquite.charMatrices.ManageCharacters.ManageCharacters) did not respond to command mqVersion with arguments ()
treebase-web-dev   | Window Project did not respond to command setResourcesState with arguments (false false 100)
treebase-web-dev   | Window Project did not respond to command setPopoutState with arguments (452)
treebase-web-dev   | A script has failed to execute properly, possibly because it expected certain modules not available in the current configuration of Mesquite.  Details: Object of tell command is null (previous command: "getToolPalette;" to object mesquite.minimal.BasicFileCoordinator.ProjectWindow@682eb824)
treebase-web-dev   | Window Project did not respond to command desuppress with arguments ()
treebase-web-dev   | Module Tree Window (mesquite.trees.BasicTreeWindowMaker.BasicTreeWindowMaker) did not respond to command suppressEPCResponse with arguments ()
treebase-web-dev   | Module Stored Trees (mesquite.trees.StoredTrees.StoredTrees) did not respond to command setTreeBlockID with arguments (0189041d36ad8)
treebase-web-dev   | 
treebase-web-dev   | MODULE REQUESTED BY COMMAND NOT FOUND
treebase-web-dev   | The module "SquareLineTree", named in a command, was not found.
treebase-web-dev   | The script or macro being executed may not execute properly.
treebase-web-dev   | The package in which this module resides (Basic Tree Modules for Mesquite) is installed and activated (loaded).  Perh...

</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

@rvosa
Copy link
Contributor

rvosa commented Jan 13, 2026

@copilot and this appears in the browser:

Data Access Failure
could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet

org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:195) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:374) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334) at org.springframework.orm.hibernate5.HibernateTemplate.flush(HibernateTemplate.java:786) at org.cipres.treebase.dao.AbstractDAO.flush(AbstractDAO.java:164) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:234) at jdk.proxy3/jdk.proxy3.$Proxy115.flush(Unknown Source) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFile(SubmissionServiceImpl.java:701) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFilesJDBC(SubmissionServiceImpl.java:604) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) at jdk.proxy3/jdk.proxy3.$Proxy141.addNexusFilesJDBC(Unknown Source) at org.cipres.treebase.web.controllers.UploadFileController.onSubmit(UploadFileController.java:219) at org.cipres.treebase.web.compat.CancellableFormController.processFormSubmission(CancellableFormController.java:209) at org.cipres.treebase.web.compat.CancellableFormController.handleRequestInternal(CancellableFormController.java:112) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:156) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:352) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:117) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:164) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:199) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:88) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:83) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:643) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:398) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:939) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1831) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:973) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:491) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:103) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:67) at org.hibernate.id.enhanced.SequenceStructure$1.getNextValue(SequenceStructure.java:107) at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40) at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:534) at org.hibernate.collection.internal.PersistentIdentifierBag.preInsert(PersistentIdentifierBag.java:406) at org.hibernate.persister.collection.AbstractCollectionPersister.insertRows(AbstractCollectionPersister.java:1540) at org.hibernate.action.internal.CollectionUpdateAction.execute(CollectionUpdateAction.java:89) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604) at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:344) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1394) at org.springframework.orm.hibernate5.HibernateTemplate.lambda$flush$26(HibernateTemplate.java:787) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:367) ... 124 more Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist Position: 17 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2734) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:518) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:196) at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:139) at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:123) at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:123) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57) ... 141 more [« Back](http://localhost:8080/user/submissionList.html)

@rvosa
Copy link
Contributor

rvosa commented Jan 13, 2026

@copilot this is the file I upload:
Gale_Vidovic_2023_Mesquite.nex.txt

Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Nexus file upload logging error in Tomcat Add missing hibernate_sequence to database schema Jan 13, 2026
Copilot AI requested a review from rvosa January 13, 2026 21:26
Co-authored-by: rvosa <106490+rvosa@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot and this appears in the browser:

...

The error persisted because the schema change only applies to fresh database installations. The PostgreSQL init scripts only run when the database is first created.

I've added an auto-migration in commit e5d0972 that runs on every container startup. It will create the hibernate_sequence if it doesn't exist.

To apply the fix, restart the containers:

docker compose down
docker compose --profile development up -d

The entrypoint script will now run the migration automatically.

@rvosa
Copy link
Contributor

rvosa commented Jan 13, 2026

@copilot is it possible that the nexus file I sent you is invalid? It has quite complex syntax. Maybe compare it with this simplified file and see if Mesquite responds differently:

Gale_Vidovic_2023_Mesquite.nex copy.txt

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot is it possible that the nexus file I sent you is invalid? It has quite complex syntax. Maybe compare it with this simplified file and see if Mesquite responds differently:

[Gale_Vidovic_20...

The hibernate_sequence error you saw is definitely a database schema issue, not a file parsing issue. The NEXUS file syntax wouldn't cause that specific error.

After restarting your containers with the migration fix (commit e5d0972), the sequence will be created. If you then see new errors when uploading either file, those would be separate issues - possibly related to Mesquite parsing the complex NEXUS syntax.

Could you confirm whether you've restarted the containers since my last commit? If so and you're still seeing errors, please share the new error message - it would help determine if there are additional issues beyond the missing sequence.

@rvosa
Copy link
Contributor

rvosa commented Jan 13, 2026

@copilot I did a clean rebuild and am now getting this:

Data Access Failure
could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]; SQL [select matrixrow0_.MATRIXROW_ID as matrixro1_45_1_, matrixrow0_.VERSION as version2_45_1_, matrixrow0_.MATRIX_ID as matrix_i4_45_1_, matrixrow0_.SymbolString as symbolst3_45_1_, matrixrow0_.TAXONLABEL_ID as taxonlab5_45_1_, segments1_.MATRIXROW_ID as matrixr20_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_0_, segments1_.VERSION as version2_54_0_, segments1_.EndIndex as endindex3_54_0_, segments1_.MATRIXROW_ID as matrixr20_54_0_, segments1_.CatalogNum as catalogn4_54_0_, segments1_.CollectionCode as collecti5_54_0_, segments1_.Collector as collecto6_54_0_, segments1_.Country as country7_54_0_, segments1_.Elevation as elevatio8_54_0_, segments1_.GenBAccession as genbacce9_54_0_, segments1_.InstAcronym as instacr10_54_0_, segments1_.Latitude as latitud11_54_0_, segments1_.Locality as localit12_54_0_, segments1_.Longitude as longitu13_54_0_, segments1_.Notes as notes14_54_0_, segments1_.OtherAccession as otherac15_54_0_, segments1_.SampleDate as sampled16_54_0_, segments1_.State as state17_54_0_, segments1_.StartIndex as startin18_54_0_, segments1_.TAXONLABEL_ID as taxonla21_54_0_, segments1_.Title as title19_54_0_ from MATRIXROW matrixrow0_ left outer join ROWSEGMENT segments1_ on matrixrow0_.MATRIXROW_ID=segments1_.MATRIXROW_ID where matrixrow0_.MATRIXROW_ID=?]; nested exception is org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]

org.springframework.dao.DataIntegrityViolationException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]; SQL [select matrixrow0_.MATRIXROW_ID as matrixro1_45_1_, matrixrow0_.VERSION as version2_45_1_, matrixrow0_.MATRIX_ID as matrix_i4_45_1_, matrixrow0_.SymbolString as symbolst3_45_1_, matrixrow0_.TAXONLABEL_ID as taxonlab5_45_1_, segments1_.MATRIXROW_ID as matrixr20_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_0_, segments1_.VERSION as version2_54_0_, segments1_.EndIndex as endindex3_54_0_, segments1_.MATRIXROW_ID as matrixr20_54_0_, segments1_.CatalogNum as catalogn4_54_0_, segments1_.CollectionCode as collecti5_54_0_, segments1_.Collector as collecto6_54_0_, segments1_.Country as country7_54_0_, segments1_.Elevation as elevatio8_54_0_, segments1_.GenBAccession as genbacce9_54_0_, segments1_.InstAcronym as instacr10_54_0_, segments1_.Latitude as latitud11_54_0_, segments1_.Locality as localit12_54_0_, segments1_.Longitude as longitu13_54_0_, segments1_.Notes as notes14_54_0_, segments1_.OtherAccession as otherac15_54_0_, segments1_.SampleDate as sampled16_54_0_, segments1_.State as state17_54_0_, segments1_.StartIndex as startin18_54_0_, segments1_.TAXONLABEL_ID as taxonla21_54_0_, segments1_.Title as title19_54_0_ from MATRIXROW matrixrow0_ left outer join ROWSEGMENT segments1_ on matrixrow0_.MATRIXROW_ID=segments1_.MATRIXROW_ID where matrixrow0_.MATRIXROW_ID=?]; nested exception is org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1] at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:216) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:374) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334) at org.springframework.orm.hibernate5.HibernateTemplate.refresh(HibernateTemplate.java:542) at org.springframework.orm.hibernate5.HibernateTemplate.refresh(HibernateTemplate.java:537) at org.cipres.treebase.dao.AbstractDAO.refresh(AbstractDAO.java:41) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:234) at jdk.proxy3/jdk.proxy3.$Proxy115.refresh(Unknown Source) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFilesJDBC(SubmissionServiceImpl.java:637) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) at jdk.proxy3/jdk.proxy3.$Proxy141.addNexusFilesJDBC(Unknown Source) at org.cipres.treebase.web.controllers.UploadFileController.onSubmit(UploadFileController.java:219) at org.cipres.treebase.web.compat.CancellableFormController.processFormSubmission(CancellableFormController.java:209) at org.cipres.treebase.web.compat.CancellableFormController.handleRequestInternal(CancellableFormController.java:112) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:156) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:352) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:117) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:164) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:199) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:88) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:83) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:643) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:398) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:939) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1831) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:973) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:491) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1] at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.loader.Loader.loadEntity(Loader.java:2444) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:77) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4550) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4535) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:213) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:118) at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1314) at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1277) at org.hibernate.engine.spi.CascadingActions$3.cascade(CascadingActions.java:142) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:510) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:434) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:220) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:543) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:474) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:437) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:220) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:153) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:135) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:52) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1295) at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1247) at org.springframework.orm.hibernate5.HibernateTemplate.lambda$refresh$6(HibernateTemplate.java:547) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:367) ... 124 more Caused by: org.postgresql.util.PSQLException: Bad value for type long : 0002000000000000000000000-0-0000000---00-000000 at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:3397) at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2635) at org.postgresql.jdbc.PgResultSet.getClob(PgResultSet.java:509) at org.postgresql.jdbc.PgResultSet.getClob(PgResultSet.java:494) at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:451) at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:451) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doExtract(ClobTypeDescriptor.java:44) at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243) at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3214) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1887) at org.hibernate.loader.Loader.hydrateEntityState(Loader.java:1811) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1784) at org.hibernate.loader.Loader.getRow(Loader.java:1624) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748) at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047) at org.hibernate.loader.Loader.processResultSet(Loader.java:998) at org.hibernate.loader.Loader.doQuery(Loader.java:967) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:327) at org.hibernate.loader.Loader.loadEntity(Loader.java:2440) ... 148 more [« Back](http://localhost:8080/user/submissionList.html)

For this file:
Gale_Vidovic_2023_Mesquite.nex copy.txt

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot I did a clean rebuild and am now getting this:

...

Good news - the hibernate_sequence error is now fixed. This new error is different and unrelated to my changes.

The new error is a DataException when loading MatrixRow#1 - this suggests there's existing data in the database that's causing issues. This could be:

  1. Test/demo data from a previous schema version
  2. A data type mismatch between the entity and database column

For a truly clean start, you may need to delete the postgres data volume:

docker compose down
docker volume rm treebase_postgres-data
docker compose --profile development up -d

This will create a fresh database with the correct schema including hibernate_sequence. If the error persists after that, it would indicate an issue with the NEXUS file parsing creating incompatible data.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot I started from an empty database so I don't think this is because of previous data. I suspect that, again, there is a data type mismatch. Please go through the types that the ORM is trying to insert and those that are in the database columns that it is targeting? This has been a recurrent problem before so I suspect it is happening again. Thanks!

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot I started from an empty database so I don't think this is because of previous data. I suspect that, again, there is a data type mismatch. Please go through the types that the ORM is trying to...

I've analyzed the MatrixRow entity and ROWSEGMENT table mappings. Here's the comparison:

MATRIXROW Table (Schema)

Column DB Type
matrixrow_id bigint
version integer
symbolstring text
matrix_id bigint
taxonlabel_id bigint
row_order integer

MatrixRow Entity (Java)

Property Java Type Column
id Long MATRIXROW_ID
version int VERSION
symbolString String (@lob) SymbolString
matrix CharacterMatrix MATRIX_ID
taxonLabel TaxonLabel TAXONLABEL_ID

Potential issue found: The row_order column exists in the database schema but is NOT a direct property of MatrixRow entity. Instead, it's managed via @IndexColumn(name = "ROW_ORDER") on the CharacterMatrix.getRows() collection. This should work, but could cause issues if:

  1. Rows are being inserted with NULL row_order values
  2. There's a gap or inconsistency in the ordering

ROWSEGMENT: The embedded SpecimenLabel maps several columns. All types appear to match (Double for elevation/lat/long, Date for sampledate, varchar for strings).

The error might actually be caused by the data being inserted having issues with the @IndexColumn order. Could you check the tomcat logs for the underlying PostgreSQL error message? It would show the actual data type violation.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot multiple questions:

  1. which log do you think I should check and where?
  2. I have claude desktop. I think it would be handy if I had that configured to use an MCP to connect to the postgres. What would the connection details be?

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot multiple questions:

  1. which log do you think I should check and where?
    ...

1. Logs to check:

  • Tomcat logs: docker logs treebase-web-dev - This shows the full stack trace including the underlying PostgreSQL error
  • PostgreSQL logs: docker logs treebase-postgres - Shows SQL errors directly from the database

The Tomcat logs should contain the root cause after "Caused by: org.postgresql.util.PSQLException:" which will show the actual data type error.

2. PostgreSQL MCP connection details:

Host: localhost
Port: 5432
Database: treebase
Username: treebase
Password: treebase

Since the PostgreSQL container maps port 5432 to your host, you can connect directly from Claude desktop using localhost.

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot treebase=# SELECT column_name, data_type, udt_name
FROM information_schema.columns
WHERE table_name = 'matrixrow' ...

The schema now matches the ORM perfectly. The fresh rebuild with docker compose down -v worked.

Please try uploading your NEXUS file again. With the correct schema in place, the symbolstring column can now properly store the character state strings as text, and the file upload should work.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot I don't think this removal of the volumes cleared out all the data because I can see my old submission still in there.

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot I don't think this removal of the volumes cleared out all the data because I can see my old submission still in there.

The schema query you ran earlier shows the correct 6 columns with proper types, which means the database WAS recreated from scratch. If you're seeing old submissions, a few possibilities:

  1. Browser cache - Try a hard refresh (Ctrl+Shift+R) or open in incognito
  2. Session data - Log out and back in
  3. Init data - Check if initTreebase.sql inserts any demo submissions

To verify the database is truly fresh, run:

SELECT COUNT(*) FROM submission;
SELECT COUNT(*) FROM study;

If these return 0 (or only the counts from init data), the volume was cleared. The old submission might be cached in your browser session.

Did the NEXUS file upload work this time?

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot ```
treebase=# SELECT COUNT(*) FROM submission;
count

 2

(1 row)

treebase=# SELECT COUNT(*) FROM study;
count

 2

(1 row)

treebase=#

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot ```
treebase=# SELECT COUNT(*) FROM submission;
count ...

The initTreebase.sql script creates 1 seed study and 1 seed submission for testing. You have 2 of each, which means:

  • 1 from the init script (seed data)
  • 1 that you created

This confirms the database was properly recreated. The second study/submission is likely from your recent upload attempt.

Did the NEXUS file upload succeed this time? The schema is now correct, so the character state strings should be stored properly in the symbolstring text column.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot No, it isn't. I "cleared" everything but then when I logged back in, my old submission in progress was still there and I could upload immediately without creating the study and citation data. Hypothesis: the Docker compose setup is NOT storing the data in treebase_postgres-data but inside the postgres image.

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot No, it isn't. I "cleared" everything but then when I logged back in, my old submission in progress was still there and I could upload immediately without creating the study and citation data....

The volume configuration is correct (postgres-data:/var/lib/postgresql/data). The fact that you see the correct 6-column schema proves the database WAS recreated from the SQL scripts.

What you're seeing is the seed submission from initTreebase.sql, not your old data:

INSERT INTO SUBMISSION(SUBMISSION_ID, VERSION, SUBMISSIONNUMBER, CREATEDATE, STUDY_ID, USER_ID, TEST)
    VALUES(1, 0, '1', CURRENT_DATE, 1, 1, 1);

This creates a test submission belonging to user_id=1. When you log in as that user, it appears as "your" submission in progress.

To verify this is seed data and not persisted data, check:

SELECT submission_id, submissionnumber, createdate FROM submission;

If createdate is today's date and submissionnumber is '1', it's the seed data.

More importantly: did the NEXUS file upload succeed with the corrected schema?

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot No, look, there are 2 submissions in the database:

treebase=# SELECT COUNT(*) FROM submission;
 count 
-------
     2
(1 row)

One is probably from seed data and happens upon initialization. The other is still there from a failure to wipe. I can only see the second one when I log in under my account (user_id=2).

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot No, look, there are 2 submissions in the database:

I understand the concern. The init script only creates 1 submission (user_id=1). If there are 2, we need to investigate.

Can you run these queries to get the details:

SELECT submission_id, user_id, createdate, submissionnumber FROM submission ORDER BY submission_id;
SELECT user_id, username FROM "user" ORDER BY user_id;

This will show us:

  1. Which users own which submissions
  2. Whether the second submission has today's date (new) or an older date (persisted)

Also, please confirm: when you ran docker compose down -v, did you see output showing the volume being removed? The -v flag should print something like Removing volume treebase_postgres-data.

The correct schema (6 columns) proves the SQL init scripts ran, but I want to understand where the second submission came from.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot I am 100% sure that the second submission is the one I made last night. It has dummy data in it. The abstract says "The notes for your study are not for the public, but are there for your own benefit and for communicating with TreeBASE staff once your submission status is ready to be made public." I know that I copied and pasted this from the website last night. WE ARE NOT WIPING THE VOLUME.

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot I am 100% sure that the second submission is the one I made last night. It has dummy data in it. The abstract says "The notes for your study are not for the public, but are there for your own...

I see the issue! The output shows:

! Network treebase_default  Resource is still in use

This means the web-dev container is still running because you started it with --profile development, but docker compose down -v without the profile flag doesn't stop it.

Fix: Include the profile when stopping:

docker compose --profile development down -v
docker compose --profile development up -d

Or stop ALL containers first:

docker stop $(docker ps -q)
docker compose down -v
docker compose --profile development up -d

The still-running web-dev container maintains a connection to the database, which might explain why data persists or gets recreated unexpectedly.

@copilot I am 100% sure that the second submission is the one I made last night. It has dummy data in it. The abstract says "The notes for your study are not for the public, but are there for your own...

If the volume still appears in Docker GUI after showing "Removed", there might be multiple volumes or the GUI is caching.

Try these commands to force a complete cleanup:

# Stop ALL docker containers
docker stop $(docker ps -aq)

# Remove all stopped containers
docker rm $(docker ps -aq)

# List all volumes to see what exists
docker volume ls | grep treebase

# Explicitly remove the postgres volume
docker volume rm treebase_postgres-data

# Verify it's gone
docker volume ls | grep treebase

# Now start fresh
docker compose --profile development up -d

If docker volume rm fails with "volume in use", something is still holding a reference to it. The docker stop $(docker ps -aq) should fix that.

Alternatively, a nuclear option:

docker system prune -a --volumes

Warning: This removes ALL unused containers, images, and volumes system-wide.

@rvosa
Copy link
Contributor

rvosa commented Jan 14, 2026

@copilot ok, we did a nuke and then I went through a new account creation and submission procedure. Here's what I see:

treebase=# select * from submission;
 submission_id | version | createdate | submissionnumber | test | study_id | user_id 
---------------+---------+------------+------------------+------+----------+---------
             1 |       0 | 2026-01-14 | 1                |    1 |        1 |       1
             2 |       4 | 2026-01-14 | 2                |    1 |        2 |       4
(2 rows)

This makes sense: submission 1 is created by the init script and belongs to user 1 (Piel). Submission 2 is what I did manually and belongs to user 4 (me, the account I just created).

However, the upload failed:

Data Access Failure
could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]; SQL [select matrixrow0_.MATRIXROW_ID as matrixro1_45_1_, matrixrow0_.VERSION as version2_45_1_, matrixrow0_.MATRIX_ID as matrix_i4_45_1_, matrixrow0_.SymbolString as symbolst3_45_1_, matrixrow0_.TAXONLABEL_ID as taxonlab5_45_1_, segments1_.MATRIXROW_ID as matrixr20_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_0_, segments1_.VERSION as version2_54_0_, segments1_.EndIndex as endindex3_54_0_, segments1_.MATRIXROW_ID as matrixr20_54_0_, segments1_.CatalogNum as catalogn4_54_0_, segments1_.CollectionCode as collecti5_54_0_, segments1_.Collector as collecto6_54_0_, segments1_.Country as country7_54_0_, segments1_.Elevation as elevatio8_54_0_, segments1_.GenBAccession as genbacce9_54_0_, segments1_.InstAcronym as instacr10_54_0_, segments1_.Latitude as latitud11_54_0_, segments1_.Locality as localit12_54_0_, segments1_.Longitude as longitu13_54_0_, segments1_.Notes as notes14_54_0_, segments1_.OtherAccession as otherac15_54_0_, segments1_.SampleDate as sampled16_54_0_, segments1_.State as state17_54_0_, segments1_.StartIndex as startin18_54_0_, segments1_.TAXONLABEL_ID as taxonla21_54_0_, segments1_.Title as title19_54_0_ from MATRIXROW matrixrow0_ left outer join ROWSEGMENT segments1_ on matrixrow0_.MATRIXROW_ID=segments1_.MATRIXROW_ID where matrixrow0_.MATRIXROW_ID=?]; nested exception is org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]

org.springframework.dao.DataIntegrityViolationException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1]; SQL [select matrixrow0_.MATRIXROW_ID as matrixro1_45_1_, matrixrow0_.VERSION as version2_45_1_, matrixrow0_.MATRIX_ID as matrix_i4_45_1_, matrixrow0_.SymbolString as symbolst3_45_1_, matrixrow0_.TAXONLABEL_ID as taxonlab5_45_1_, segments1_.MATRIXROW_ID as matrixr20_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_3_, segments1_.ROWSEGMENT_ID as rowsegme1_54_0_, segments1_.VERSION as version2_54_0_, segments1_.EndIndex as endindex3_54_0_, segments1_.MATRIXROW_ID as matrixr20_54_0_, segments1_.CatalogNum as catalogn4_54_0_, segments1_.CollectionCode as collecti5_54_0_, segments1_.Collector as collecto6_54_0_, segments1_.Country as country7_54_0_, segments1_.Elevation as elevatio8_54_0_, segments1_.GenBAccession as genbacce9_54_0_, segments1_.InstAcronym as instacr10_54_0_, segments1_.Latitude as latitud11_54_0_, segments1_.Locality as localit12_54_0_, segments1_.Longitude as longitu13_54_0_, segments1_.Notes as notes14_54_0_, segments1_.OtherAccession as otherac15_54_0_, segments1_.SampleDate as sampled16_54_0_, segments1_.State as state17_54_0_, segments1_.StartIndex as startin18_54_0_, segments1_.TAXONLABEL_ID as taxonla21_54_0_, segments1_.Title as title19_54_0_ from MATRIXROW matrixrow0_ left outer join ROWSEGMENT segments1_ on matrixrow0_.MATRIXROW_ID=segments1_.MATRIXROW_ID where matrixrow0_.MATRIXROW_ID=?]; nested exception is org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1] at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:216) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:374) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334) at org.springframework.orm.hibernate5.HibernateTemplate.refresh(HibernateTemplate.java:542) at org.springframework.orm.hibernate5.HibernateTemplate.refresh(HibernateTemplate.java:537) at org.cipres.treebase.dao.AbstractDAO.refresh(AbstractDAO.java:41) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:234) at jdk.proxy3/jdk.proxy3.$Proxy115.refresh(Unknown Source) at org.cipres.treebase.service.study.SubmissionServiceImpl.addNexusFilesJDBC(SubmissionServiceImpl.java:637) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) at jdk.proxy3/jdk.proxy3.$Proxy141.addNexusFilesJDBC(Unknown Source) at org.cipres.treebase.web.controllers.UploadFileController.onSubmit(UploadFileController.java:219) at org.cipres.treebase.web.compat.CancellableFormController.processFormSubmission(CancellableFormController.java:209) at org.cipres.treebase.web.compat.CancellableFormController.handleRequestInternal(CancellableFormController.java:112) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:156) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:352) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:117) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:164) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:199) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:88) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:83) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:643) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:72) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:398) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:939) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1831) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:973) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:491) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: org.hibernate.exception.DataException: could not load an entity: [org.cipres.treebase.domain.matrix.MatrixRow#1] at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.loader.Loader.loadEntity(Loader.java:2444) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:77) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:61) at org.hibernate.persister.entity.AbstractEntityPersister.doLoad(AbstractEntityPersister.java:4550) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4535) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:213) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:118) at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1314) at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1277) at org.hibernate.engine.spi.CascadingActions$3.cascade(CascadingActions.java:142) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:510) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:434) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:220) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:543) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:474) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:437) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:220) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:153) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:135) at org.hibernate.event.internal.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:52) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.fireRefresh(SessionImpl.java:1295) at org.hibernate.internal.SessionImpl.refresh(SessionImpl.java:1247) at org.springframework.orm.hibernate5.HibernateTemplate.lambda$refresh$6(HibernateTemplate.java:547) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:367) ... 124 more Caused by: org.postgresql.util.PSQLException: Bad value for type long : 0002000000000000000000000-0-0000000---00-000000 at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:3397) at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2635) at org.postgresql.jdbc.PgResultSet.getClob(PgResultSet.java:509) at org.postgresql.jdbc.PgResultSet.getClob(PgResultSet.java:494) at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:451) at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getClob(DelegatingResultSet.java:451) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doExtract(ClobTypeDescriptor.java:44) at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:243) at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:329) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3214) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1887) at org.hibernate.loader.Loader.hydrateEntityState(Loader.java:1811) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1784) at org.hibernate.loader.Loader.getRow(Loader.java:1624) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748) at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047) at org.hibernate.loader.Loader.processResultSet(Loader.java:998) at org.hibernate.loader.Loader.doQuery(Loader.java:967) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:327) at org.hibernate.loader.Loader.loadEntity(Loader.java:2440) ... 148 more

Copy link
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot ok, we did a nuke and then I went through a new account creation and submission procedure. Here's what I see:

...

The database is now properly fresh (submissions confirm this). The upload failure when loading MatrixRow#1 indicates data was inserted but cannot be reloaded. The error Bad value for type long means a column expected to be long/bigint contains a string value.

Could you run these queries to verify the related tables:

SELECT column_name, data_type, udt_name 
FROM information_schema.columns 
WHERE table_name = 'matrixelement' 
ORDER BY ordinal_position;

SELECT column_name, data_type, udt_name 
FROM information_schema.columns 
WHERE table_name = 'rowsegment' 
ORDER BY ordinal_position;

The matrixelement table should have an element_order integer column, and rowsegment should have ~20 columns including matrixrow_id bigint.

Also, can you check the tomcat logs for the full stack trace? Run docker logs treebase-web-dev 2>&1 | tail -100 to see which specific column is causing the type mismatch.

@rvosa rvosa marked this pull request as ready for review January 14, 2026 20:13
@rvosa rvosa merged commit a53ee2c into master Jan 14, 2026
18 checks passed
@rvosa rvosa deleted the copilot/fix-nexus-file-upload-issue branch January 14, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants