Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. |Running Grails application
  2. Configuring Spring Security Core ...
  3. ... finished configuring Spring Security Core
  4. Error |
  5. 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:
  6. 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:
  7. Line | Method
  8. ->> 12 | doCall in BootStrap$_closure1
  9. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  10. | 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
  11. | 320 | executeForEnvironment . . . . . in ''
  12. | 296 | executeForCurrentEnvironment in ''
  13. | 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
  14. | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
  15. | 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  16. ^ 745 | run in java.lang.Thread
  17. Caused by WrongClassException: Object [id=1] was not of the specified subclass [com.user.SecUser] : Discriminator:
  18. ->> 12 | doCall in BootStrap$_closure1
  19. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  20. | 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
  21. | 320 | executeForEnvironment . . . . . in ''
  22. | 296 | executeForCurrentEnvironment in ''
  23. | 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
  24. | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
  25. | 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  26. ^ 745 | run in java.lang.Thread
  27. Error |
  28. Forked Grails VM exited with error
  29.  
  30. Process finished with exit code 1
  31.  
  32. @EqualsAndHashCode(includes='username')
  33. @ToString(includes='username', includeNames=true, includePackage=false)
  34. class SecUser implements Serializable {
  35.  
  36. private static final long serialVersionUID = 1
  37.  
  38. transient springSecurityService
  39.  
  40. String username
  41. String password
  42. boolean enabled = true
  43. boolean accountExpired
  44. boolean accountLocked
  45. boolean passwordExpired
  46.  
  47. SecUser(String username, String password) {
  48. this()
  49. this.username = username
  50. this.password = password
  51. }
  52. boolean beforeInsertRunOnce = false
  53. boolean beforeUpdateRunOnce = false
  54. Set<SecRole> getAuthorities() {
  55. SecUserSecRole.findAllBySecUser(this)*.secRole
  56. }
  57.  
  58. def beforeInsert() {
  59. if (! beforeInsertRunOnce) {
  60. beforeInsertRunOnce = true
  61. encodePassword()
  62. }
  63. }
  64. def afterInsert() {
  65. beforeInsertRunOnce = false
  66. }
  67. def beforeUpdate() {
  68. if (isDirty('password') && ! beforeUpdateRunOnce ) {
  69. beforeUpdateRunOnce = true
  70. encodePassword()
  71. }
  72. }
  73. def afterUpdate() {
  74. beforeUpdateRunOnce = false
  75. }
  76. protected void encodePassword() {
  77. //password = springSecurityService?.passwordEncoder ? springSecurityService.encodePassword(password) : password
  78. password = springSecurityService.encodePassword(password)
  79. }
  80.  
  81. static transients = ['springSecurityService']
  82.  
  83. static constraints = {
  84. username blank: false, unique: true
  85. password blank: false
  86. }
  87.  
  88. static mapping = {
  89. password column: '`password`'
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement