Struggling with cloud deployment

Forside Forum Developer discussions Struggling with cloud deployment

Tagged: ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4084
    Benny
    Participant

    I have tried to deploy the opentele-server and opentele-citizen-server to AWS as WAR files (ElasticBeanstalk). A MySql server is also running on AWS.

    In that setup I do not have the ‘citizen.properties’ and ‘clinician.properties’ files, but I am hoping that specifying the properties in Datasource.groovy and building the war with ‘grails -Dgrails.env=performance war’ is sufficient. However, it is failing with database related errors.

    Are you aware of any problems running Opentele like this?

    The opentele-server may be trying to use H2 driver even though I’ve specified MySql, as can be seen in this stacktrace

    2016-03-10 13:43:45,488 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener – Error initializing the application: Hibernate operation: could not prepare statement; bad SQL grammar [select this_.id as id1_46_0_, this_.version as version2_46_0_, this_.created_by as created_3_46_0_, this_.created_date as created_4_46_0_, this_.modified_by as modified5_46_0_, this_.modified_date as modified6_46_0_, this_.permission as permissi7_46_0_ from permission this_ where this_.permission=? limit ?]; nested exception is org.h2.jdbc.JdbcSQLException: Table “PERMISSION” not found; SQL statement:
    select this_.id as id1_46_0_, this_.version as version2_46_0_, this_.created_by as created_3_46_0_, this_.created_date as created_4_46_0_, this_.modified_by as modified5_46_0_, this_.modified_date as modified6_46_0_, this_.permission as permissi7_46_0_ from permission this_ where this_.permission=? limit ? [42102-176]
    org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not prepare statement; bad SQL grammar [select this_.id as id1_46_0_, this_.version as version2_46_0_, this_.created_by as created_3_46_0_, this_.created_date as created_4_46_0_, this_.modified_by as modified5_46_0_, this_.modified_date as modified6_46_0_, this_.permission as permissi7_46_0_ from permission this_ where this_.permission=? limit ?]; nested exception is org.h2.jdbc.JdbcSQLException: Table “PERMISSION” not found; SQL statement:

    The opentele-citizen-server fails to start with plenty of these errors

    2016-03-14 08:33:54,906 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener – Error initializing the application: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is java.lang.NullPointerException
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is java.lang.NullPointerException
    … 5 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is java.lang.NullPointerException
    … 5 more
    Caused by: java.lang.NullPointerException
    … 5 more

    Do you have any idea why I am experiencing such errors?
    I’d be happy to provide more details.

    #4085

    I assume you made entries in Config.groovy that corresponds to the performance profile. Try to add the following to the opentele-servers profile that you are using:

    grails.plugin.databasemigration.dropOnStart = true
    grails.plugin.databasemigration.updateOnStart = true
    grails.plugin.databasemigration.updateOnStartFileNames = [‘changelog.groovy’]
    grails.plugin.databasemigration.autoMigrateScripts = [‘RunApp’, ‘TestApp’]

    As the current version on head doesn’t do database migrations – I’m not sure if that is you root problem thou…

    Can you make the software run locally with “grails run-app” ?

    ^__^
    Mike

    #4086
    Michael
    Keymaster

    Looks similar to issue that I had when I was trying to use both database migration AND DataSource based database creation. These two overlap in functionality and may clash with errors. Therefore, either do

    grails.plugin.databasemigration.dropOnStart = true
    grails.plugin.databasemigration.updateOnStart = true

    with dbCreate = ‘validate’ (or empty) in DataSource.groovy (under appropriate environment) OR do

    grails.plugin.databasemigration.dropOnStart = false
    grails.plugin.databasemigration.updateOnStart = false

    with dbCreate = ‘create-drop’ in DataSource.groovy.

    For me the latter has worked better with both h2 and MySQL databases.

    /Michael

    PS: You may want to debug this under the development environment rather than diving straight into performance.

    #4089
    Benny
    Participant

    Thanks for the assistance.
    I changed the datamigration properties to false, and set the dbCreate to create-drop, but I am still not able to get it running.

    One error which I have seen multiple times when starting up opentele-server (the clinician server) is this:

    Creating overview for patient with id: 12
    Creating overview for patient with id: 13
    2016-03-22 11:04:17,187 [localhost-startStop-1] ERROR spi.SqlExceptionHelper – Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1
    2016-03-22 11:04:17,202 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener – Error initializing the application: Hibernate operation: could not execute statement; SQL [n/a]; Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1
    org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute statement; SQL [n/a]; Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1
    at org.opentele.server.core.PatientOverviewMaintenanceService.createOverviewFor(PatientOverviewMaintenanceService.groovy:14)
    at BootStrap$_createPatientOverviewDataForPatients_closure5.doCall(BootStrap.groovy:247)
    at BootStrap.createPatientOverviewDataForPatients(BootStrap.groovy:245)
    at BootStrap$_closure1_closure32_closure33.doCall(BootStrap.groovy:181)
    at grails.util.Environment$EnvironmentBlockEvaluator.execute(Environment.java:340)
    at grails.util.Environment.executeForEnvironment(Environment.java:321)
    at grails.util.Environment.executeForCurrentEnvironment(Environment.java:296)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘green_questionnaire_ids’ at row 1
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3607)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330)
    at io.jdev.miniprofiler.sql.log4jdbc.PreparedStatementSpy.executeUpdate(PreparedStatementSpy.java:1021)
    … 11 more

    It is as if the database schema is not according to domain classes or dummy data.

    #4090
    mikek
    Participant

    Hi,

    You need to run the datamigrations the first time you start the system (start with the OpenTele2-Server, as that is the one who will seed the database).

    ^__^
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.