GMOD / Apollo

Genome annotation editor with a Java Server backend and a Javascript client that runs in a web browser as a JBrowse plugin.
http://genomearchitect.readthedocs.io/
Other
126 stars 85 forks source link

Failing to authenticate users in WebApollo2. #1593

Closed rpbap closed 7 years ago

rpbap commented 7 years ago

Dear all,

Recently, all users from our webapollo2 server started to not be authenticated anymore. It seems that after someone restarted/deployed our tomcat server, we were unable to link the users back ti the database. All files seems to be untuched. I have the war file and the catalina log if needed. Could you help me with this issue?

Thanks

Rodrigo

PS: here is part of the catalina log file:

2017-05-08 11:02:43,731 [http-bio-8080-exec-7] ERROR authenticator.UsernamePasswordAuthenticatorService - Not implemented without a token 2017-05-08 11:02:43,731 [http-bio-8080-exec-7] WARN apollo.PermissionService - Failed to authenticate user 2017-05-08 11:02:43,731 [http-bio-8080-exec-7] ERROR apollo.UserController - Failed to authenticate 2017-05-08 11:02:43,764 [http-bio-8080-exec-7] ERROR spi.SqlExceptionHelper - Table "GRAILSUSER" not found; SQL statement: select count(*) as y0 from grailsuser this [42102-176] 2017-05-08 11:02:43,772 [http-bio-8080-exec-7] ERROR errors.GrailsExceptionResolver - JdbcSQLException occurred when processing request: [GET] /apollo204/user/checkLogin Table "GRAILSUSER" not found; SQL statement: select count(*) as y0 from grailsuser this [42102-176]. Stacktrace follows: org.h2.jdbc.JdbcSQLException: Table "GRAILSUSER" not found; SQL statement: select count(*) as y0 from grailsuser this [42102-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) at org.h2.message.DbException.get(DbException.java:178) at org.h2.message.DbException.get(DbException.java:154) at org.h2.command.Parser.readTableOrView(Parser.java:5213) at org.h2.command.Parser.readTableFilter(Parser.java:1220) at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1859) at org.h2.command.Parser.parseSelectSimple(Parser.java:1968) at org.h2.command.Parser.parseSelectSub(Parser.java:1853) at org.h2.command.Parser.parseSelectUnion(Parser.java:1674) at org.h2.command.Parser.parseSelect(Parser.java:1662) at org.h2.command.Parser.parsePrepared(Parser.java:434) at org.h2.command.Parser.parse(Parser.java:306) at org.h2.command.Parser.parse(Parser.java:278) at org.h2.command.Parser.prepareCommand(Parser.java:243) at org.h2.engine.Session.prepareLocal(Session.java:442) at org.h2.engine.Session.prepareCommand(Session.java:384) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188) at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:73) at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276) at org.grails.datastore.gorm.GormStaticApi.getCount(GormStaticApi.groovy:385) at org.bbop.apollo.UserController.$tt__checkLogin(UserController.groovy:188) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) 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:722)

nathandunn commented 7 years ago

Either when it was rebooted the database was moved or removed or the configuration changed.

Do you have a backup of the database somewhere?

Nathan

On May 9, 2017, at 1:31 PM, rpbap notifications@github.com wrote:

Dear all,

Recently, all users from our webapollo2 server started to not be authenticated anymore. It seems that after someone restarted/deployed our tomcat server, we were unable to link the users back ti the database. All files seems to be untuched. I have the war file and the catalina log if needed. Could you help me with this issue?

Thanks

Rodrigo

PS: here is part of the catalina log file:

2017-05-08 11:02:43,731 [http-bio-8080-exec-7] ERROR authenticator.UsernamePasswordAuthenticatorService - Not implemented without a token 2017-05-08 11:02:43,731 [http-bio-8080-exec-7] WARN apollo.PermissionService - Failed to authenticate user 2017-05-08 11:02:43,731 [http-bio-8080-exec-7] ERROR apollo.UserController - Failed to authenticate 2017-05-08 11:02:43,764 [http-bio-8080-exec-7] ERROR spi.SqlExceptionHelper - Table "GRAILSUSER" not found; SQL statement: select count() as y0 from grailsuser this [42102-176] 2017-05-08 11:02:43,772 [http-bio-8080-exec-7] ERROR errors.GrailsExceptionResolver - JdbcSQLException occurred when processing request: [GET] /apollo204/user/checkLogin Table "GRAILSUSER" not found; SQL statement: select count() as y0 from grailsuser this [42102-176]. Stacktrace follows: org.h2.jdbc.JdbcSQLException: Table "GRAILSUSER" not found; SQL statement: select count(*) as y0 from grailsuser this [42102-176] at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) at org.h2.message.DbException.get(DbException.java:178) at org.h2.message.DbException.get(DbException.java:154) at org.h2.command.Parser.readTableOrView(Parser.java:5213) at org.h2.command.Parser.readTableFilter(Parser.java:1220) at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1859) at org.h2.command.Parser.parseSelectSimple(Parser.java:1968) at org.h2.command.Parser.parseSelectSub(Parser.java:1853) at org.h2.command.Parser.parseSelectUnion(Parser.java:1674) at org.h2.command.Parser.parseSelect(Parser.java:1662) at org.h2.command.Parser.parsePrepared(Parser.java:434) at org.h2.command.Parser.parse(Parser.java:306) at org.h2.command.Parser.parse(Parser.java:278) at org.h2.command.Parser.prepareCommand(Parser.java:243) at org.h2.engine.Session.prepareLocal(Session.java:442) at org.h2.engine.Session.prepareCommand(Session.java:384) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188) at org.h2.jdbc.JdbcPreparedStatement.(JdbcPreparedStatement.java:73) at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276) at org.grails.datastore.gorm.GormStaticApi.getCount(GormStaticApi.groovy:385) at org.bbop.apollo.UserController.$tt__checkLogin(UserController.groovy:188) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) 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:722)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GMOD/Apollo/issues/1593, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt2qvUYp5ow7FZmGIdHtHhQsMWgRHhWks5r4M0dgaJpZM4NV12B.

rpbap commented 7 years ago

Hi Nathan, Sorry but I'm a bit new to tomcat, how can I check where is the grails_user table and the database are (Will the path be in some of the webapollo files?) - The grails.xml is in the "/opt/apache-tomcat-7.0.40/webapps/webapollo/WEB-INF/" same as the apollo-config.groovy. When I installed the webapollo2 I followed the user guide, using the H2 database. It was working fine for 6 months.

All files (tracks, genomes, and the final outputs - gff and fasta files) have a backup. when I go to the jbrowse folder in the "/opt/apache-tomcat-7.0.40/webapps/webapollo/jbrowse/data/" folder all data still there.

nathandunn commented 7 years ago

What did you use for your apollo-config.groovy (minus passwords)?

On May 9, 2017, at 3:10 PM, rpbap notifications@github.com wrote:

Hi Nathan, Sorry but I'm a bit new to tomcat, how can I check where is the grails_user table and the database are (Will the path be in some of the webapollo files?) - The grails.xml is in the "/opt/apache-tomcat-7.0.40/webapps/webapollo/WEB-INF/" same as the apollo-config.groovy. When I installed the webapollo2 I followed the user guide, using the H2 database. It was working fine for 6 months.

All files (tracks, genomes, and the final outputs - gff and fasta files) have a backup. when I go to the jbrowse folder in the "/opt/apache-tomcat-7.0.40/webapps/webapollo/jbrowse/data/" folder all data still there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GMOD/Apollo/issues/1593#issuecomment-300316406, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt2qhWFqUzS7FIXh-pDrXHd7m3_FYNjks5r4OREgaJpZM4NV12B.

rpbap commented 7 years ago

Here is my apollo-config.groovy file minus user and password:

// default username/password on h2 are given here. see docs for adjusting
dataSource {
    pooled = true
    jmxExport = true
    driverClassName = "org.h2.Driver"
    username = "******"
    password = "*****"
}
// environment specific settings
environments {
    development {
        // sample config to turn on debug logging in development e.g. for apollo run-local
        log4j.main = {
            debug "grails.app"
        }
        // sample config to edit apollo specific configs in development mode
        apollo {
            gff3.source = "testing"
        }
        dataSource {
            dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }
    test {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
        }
    }

    //note: not necessarily recommended to use h2 in production mode. see precautions
    production {
        dataSource {
            dbCreate = "update"
            //NOTE: production mode uses file instead of mem database
            //Please specify the appropriate file path, otherwise /tmp/prodDb will be used.
            //url = "jdbc:h2:/opt/apollo/h2/prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
            url = "jdbc:h2:/tmp/prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
            properties {
               // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
               jmxEnabled = true
               initialSize = 5
               maxActive = 50
               minIdle = 5
               maxIdle = 25
               maxWait = 10000
               maxAge = 10 * 60000
               timeBetweenEvictionRunsMillis = 5000
               minEvictableIdleTimeMillis = 60000
               validationQuery = "SELECT 1"
               validationQueryTimeout = 3
               validationInterval = 15000
               testOnBorrow = true
               testWhileIdle = true
               testOnReturn = false
               jdbcInterceptors = "ConnectionState"
               defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
            }
        }
    }
}

// Uncomment to make changes
//
//jbrowse {
//    git {
//        url= "https://github.com/GMOD/jbrowse"
//        tag = "1.12.2-apollo"
////        branch = "master"
//        alwaysPull = true
//        alwaysRecheck = true
//    }
//    plugins {
//        WebApollo{
//            included = true
//        }
//        NeatHTMLFeatures{
//            included = true
//        }
//        NeatCanvasFeatures{
//            included = true
//        }
//        RegexSequenceSearch{
//            included = true
//        }
//        HideTrackLabels{
//            included = true
//        }
////        MyVariantInfo {
////            git = 'https://github.com/GMOD/myvariantviewer'
////            branch = 'master'
////            alwaysRecheck = "true"
////            alwaysPull = "true"
////        }
////        SashimiPlot {
////            git = 'https://github.com/cmdcolin/sashimiplot'
////            branch = 'master'
////            alwaysPull = "true"
////        }
//    }
//}
nathandunn commented 7 years ago

If it was being stored here:

/tmp/prodDb

Unix likes to delete things from the /tmp directory (it is the "temp" directory). Most likely it did this when tomcat was turned off and the file was no longer being red and then recreated it the next time you ran it. I think I had a note in there about changing it or /tmp would be used, but I also realize that we have a lot of documentation in there and we should have a sane default ;)

I will change this in the sample file so it doesn't happen to someone else.

If you have the backups then I would recommend creating a new instance with your backed up data. Fortunately you can use all of the older data.

However make sure you when you configure your H2 (though I would recommend using PostgreSQL or MySQL), that you put it in a directory that is writable by your production tomcat, but won't be deleted (e.g., /opt/apollo/database) and backing it up every once in awhile.

You'll probably have to re-create your user and remount the organism unless you have a SQL dump. However, both of those should be pretty quick.

If you want to recreate the same manual annotations you can use a script from here: https://github.com/GMOD/Apollo/tree/master/tools/data