Could not run OG-Example simulated with hts in postgresql


#1

I use the latest github master branch download and

changed config/toolcontext/toolcontext-examplessimulated.properties hts part as

db.hts.dialect = com.opengamma.util.db.PostgresDbDialect
db.hts.driver = org.postgresql.Driver
db.hts.url = jdbc:postgresql://192.168.2.112/og_financial
db.hts.username = opengamma
db.hts.password = opengamma

The db og_financial is accessible via commad psql -h 192.168.2.112 -d og_financial -U opengamma
(where my db should reside)
mvn install -DskipTests

./scripts/init-examples-simulated-db.sh in the server-dir and I get

17:43:00,618 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [BRIDGE] to Logger[ROOT]
17:43:00,618 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
17:43:00,619 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5e8caa63 - Registering current configuration as safe fallback point

com.opengamma.OpenGammaRuntimeException: Failed to init component factory: ‘dbHtsMaster’ with {factory=com.opengamma.component.factory.master.DbHistoricalTimeSeriesMasterComponentFactory, classifier=tool, dbConnector=::hts}
at com.opengamma.component.ComponentManager.initComponent(ComponentManager.java:360)
at com.opengamma.component.ComponentManager.initComponents(ComponentManager.java:325)
at com.opengamma.component.ComponentManager.init(ComponentManager.java:300)
at com.opengamma.component.ComponentManager.start(ComponentManager.java:205)
at com.opengamma.component.ComponentManager.start(ComponentManager.java:192)
at com.opengamma.component.tool.ToolContextUtils.getToolContext(ToolContextUtils.java:91)
at com.opengamma.component.tool.ToolContextUtils.getToolContext(ToolContextUtils.java:69)
at com.opengamma.component.tool.AbstractTool.run(AbstractTool.java:172)
at com.opengamma.component.tool.AbstractTool.run(AbstractTool.java:151)
at com.opengamma.examples.simulated.tool.ExampleDatabaseCreator.run(ExampleDatabaseCreator.java:111)
at com.opengamma.examples.simulated.tool.ExampleDatabaseCreator.main(ExampleDatabaseCreator.java:65)
Caused by: com.opengamma.OpenGammaRuntimeException: Unable to find current hts schema version in database
at com.opengamma.component.factory.master.AbstractDbMasterComponentFactory.checkSchemaVersion(AbstractDbMasterComponentFactory.java:134)
at com.opengamma.component.factory.master.AbstractDbMasterComponentFactory.checkSchema(AbstractDbMasterComponentFactory.java:71)
at com.opengamma.component.factory.master.DbHistoricalTimeSeriesMasterComponentFactory.init(DbHistoricalTimeSeriesMasterComponentFactory.java:92)
at com.opengamma.component.ComponentManager.initFactory(ComponentManager.java:555)
at com.opengamma.component.ComponentManager.initComponent(ComponentManager.java:358)
… 10 more

Completed

any clue?


#2

That looks like the schema hasn’t been created correctly. Does the og_financial database have any tables in it when you look at it?


#3

I was going in an assumption that the exampleDataBaseCreator would do it during init script.


#4

I have run the sql file psql -h 192.168.2.112 -d og_financial -U opengamma -f projects/OG-MasterDB/src/main/resources/db/create/postgres/hts/V_45__create_hts.sql

now the tables are in the database

still I am getting the same error when running init script


#5

Running the class examples simulated ExampleDatabaseCreator from an IDE should correctly setup the database using the file /toolcontext/toolcontext-examplessimulated.properties. That class automatically calls ExampleDatabasePopulator to populate the data. And the script init-examples-simulated-db.sh calls ExampleDatabaseCreator (without the need for an IDE).

The script may be failing now because you already have some tables created (although it is supposed to just delete them and recreate them. Have you tried deleting the database and starting again?


#6

One problem is that postgresql does not like underscores in the database name.

In

I have some property files that work on my postgresql server.