Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:45:46+00:00 2026-06-13T07:45:46+00:00

I am using Grails 2.1.1 with Spring Security 1.2.7.1 and Spring Security UI 0.2.

  • 0

I am using Grails 2.1.1 with Spring Security 1.2.7.1 and Spring Security UI 0.2.

When I create some test users in BootStrap.groovy using an in memory database I am able to log in and manage users–everything works fine. However, when I switch my data source to a MySQL database, the service states that the user account is disabled when I try to log in. I have checked and the password appears to be hashing correctly (i.e., it matches what’s in the database). The only modification I made to a user is to include a Study ID. In attempting to debug the code I’ve found that org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser indicates enabled=false.

Any help is greatly appreciated!

My DataSource:

    dataSource {
        driverClassName = "com.mysql.jdbc.Driver"
        dialect = org.hibernate.dialect.MySQL5InnoDBDialect
        url = "jdbc:mysql://localhost/users"
        username = "root"
        password = ""
        dbCreate = "create-drop" 
    }

My BootStrap.groovy code:

    def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
    def userRole = new Role(authority: 'ROLE_USER').save(flush: true)

    def testAdmin = new User(username: 'me', enabled: true, password: 'password', studyID: '0')
    testAdmin.save(flush: true)
    UserRole.create testAdmin, adminRole, true

    def testUser = new User(username: '100', enabled: true, password: 'test', studyID: '101')
    testUser.save(flush: true)
    UserRole.create testUser, userRole, true

    assert User.count() == 2
    assert Role.count() == 2
    assert UserRole.count() == 2

A row from my User.user table after starting the application. No matter how I change these values, login attempts state that the user is disabled:

id  version account_expired account_locked  enabled password    password_expired    studyid username
        1   0   1   1   1   5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a...   1   0   me
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:45:47+00:00Added an answer on June 13, 2026 at 7:45 am

    If making changes directly into the DB also gives the error and it works with the ‘in memory DB’, I think that MySQL might be the problem.

    It can be that MySQL is storing the values using a type that Hibernate cannot use correctly as a boolean

    You can test that by retrieving a user from the DB and manually check:

    if( ! user.enabled ) println "not enabled"  // or something like that
    

    The last 3 posts on this mail list give a solution to correctly map a boolean in MySQL:

    You can use a custom dialect to change BIT(1) to boolean:

       import org.hibernate.dialect.MySQL5InnoDBDialect 
       import java.sql.Types 
    
       class MyCustomMySQL5InnoDBDialect extends MySQL5InnoDBDialect { 
          MyCustomMySQL5InnoDBDialect() { 
             registerColumnType(Types.BIT, 'boolean') 
          } 
       }
    

    And use it specify the class in DataSource.groovy:

       dataSource { 
          pooled = true 
          driverClassName = 'com.mysql.jdbc.Driver' 
          username = ... 
          password = ... 
          dialect = com.foo.bar.MyCustomMySQL5InnoDBDialect 
       } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to grails. I am using grails 1.3.7, and spring security core
I'm using the Spring Security Plugin in Grails 2.0.3, and am trying to add
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I have installed spring-security-core in a grails project, but for some reason, IDEA didn't
Is it possible, using spring security plugin 0.5.3 with Grails 1.2.1, to authenticate a
I'm using Spring Security in Grails to restrict access to my controllers. I have
I am using Spring security core plugin . I want to test if the
I'm using spring-security-core and spring-security-ui with Grails 1.3.7. I can't find anything in the
Using Grails 2.0.x and the spring security plugin with the default @Secured annotations how
I am using spring security core plug in in my grails app. When I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.