Opened 11 years ago

Closed 11 years ago

#526 closed defect (fixed)

Error when petascopedb is not updated to ps9

Reported by: Dimitar Misev Owned by: Piero Campalani
Priority: major Milestone: 9.0
Component: petascope Version: development
Keywords: Cc:
Complexity: Medium

Description

There should be a check which prints an informative message when ps9 is not present, like:
"Petascope can not be started, please update the database to version 9 by running update_petascopedb.sh [—migrate]" or similar:

  INFO [16:33:31] ConfigManager@346: ------------------------------------
  INFO [16:33:31] PetascopeInterface@112: Petascope 2.0.0 starting
  INFO [16:33:31] PetascopeInterface@115: To obtain a list of external packages used, please visit www.rasdaman.org .
  INFO [16:33:31] PetascopeInterface@130: Initializing metadata database
 DEBUG [16:33:31] DbMetadataSource@354: SQL query:  SELECT id, type, type_codespace, type_versions, description_id, fees, access_constraints FROM ps9_service_identification WHERE type ILIKE '%WCS%';
 ERROR [16:33:31] PetascopeInterface@137: Stack trace: {}
ResourceError: Metadata database error
	at petascope.core.DbMetadataSource.<init>(DbMetadataSource.java:671)
	at petascope.PetascopeInterface.init(PetascopeInterface.java:131)
	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "ps9_service_identification" does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:235)
	at petascope.core.DbMetadataSource.<init>(DbMetadataSource.java:355)
	... 28 more

Change History (2)

comment:1 by Piero Campalani, 11 years ago

Status: newaccepted

comment:2 by Piero Campalani, 11 years ago

Resolution: fixed
Status: acceptedclosed

Patch applied: changeset:635ce50.
It adds a check on the number of PS9_* tables.
NOTE: every changes to the database will need to adjust this check.

INFO:   INFO [11:00:26] PetascopeInterface@130: Initializing metadata database
INFO:   DEBUG [11:00:26] DbMetadataSource@2181: SQL query:  SELECT COUNT(*) FROM pg_catalog.pg_tables WHERE schemaname=CURRENT_SCHEMA AND tablename ILIKE 'ps9_%'
INFO:   ERROR [11:00:26] DbMetadataSource@355: Missing ps9_* tables in the database.
INFO:   ERROR [11:00:26] PetascopeInterface@137: Stack trace: {}
InternalComponentError: There are 0 out of 30 tables with prefix ps9_ in jdbc:postgresql://localhost:5433/petascopedb Petascope cannot be started: please update the database to version 9 by running `update_petascopedb.sh [--migrate]`
	at petascope.core.DbMetadataSource.<init>(DbMetadataSource.java:356)
	at petascope.PetascopeInterface.init(PetascopeInterface.java:131)
	at javax.servlet.GenericServlet.init(GenericServlet.java:244)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1382)
...
Note: See TracTickets for help on using tickets.