Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- |Running Grails application
- Configuring Spring Security Core ...
- ... finished configuring Spring Security Core
- Error |
- 2016-02-22 10:31:21,257 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator: ; nested exception is org.hibernate.WrongClassException: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator:
- Message: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator: ; nested exception is org.hibernate.WrongClassException: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator:
- Line | Method
- ->> 12 | doCall in BootStrap$_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- | 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
- | 320 | executeForEnvironment . . . . . in ''
- | 296 | executeForCurrentEnvironment in ''
- | 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
- | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
- | 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
- ^ 745 | run in java.lang.Thread
- Caused by WrongClassException: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator:
- ->> 12 | doCall in BootStrap$_closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- | 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
- | 320 | executeForEnvironment . . . . . in ''
- | 296 | executeForCurrentEnvironment in ''
- | 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
- | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
- | 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
- ^ 745 | run in java.lang.Thread
- Error |
- Forked Grails VM exited with error
- Process finished with exit code 1
- @EqualsAndHashCode(includes='username')
- @ToString(includes='username', includeNames=true, includePackage=false)
- class SecUser implements Serializable {
- private static final long serialVersionUID = 1
- transient springSecurityService
- String username
- String password
- boolean enabled = true
- boolean accountExpired
- boolean accountLocked
- boolean passwordExpired
- SecUser(String username, String password) {
- this()
- this.username = username
- this.password = password
- }
- boolean beforeInsertRunOnce = false
- boolean beforeUpdateRunOnce = false
- Set<SecRole> getAuthorities() {
- SecUserSecRole.findAllBySecUser(this)*.secRole
- }
- def beforeInsert() {
- if (! beforeInsertRunOnce) {
- beforeInsertRunOnce = true
- encodePassword()
- }
- }
- def afterInsert() {
- beforeInsertRunOnce = false
- }
- def beforeUpdate() {
- if (isDirty('password') && ! beforeUpdateRunOnce ) {
- beforeUpdateRunOnce = true
- encodePassword()
- }
- }
- def afterUpdate() {
- beforeUpdateRunOnce = false
- }
- protected void encodePassword() {
- //password = springSecurityService?.passwordEncoder ? springSecurityService.encodePassword(password) : password
- password = springSecurityService.encodePassword(password)
- }
- static transients = ['springSecurityService']
- static constraints = {
- username blank: false, unique: true
- password blank: false
- }
- static mapping = {
- password column: '`password`'
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement