grails-2.0

How to fix “Invalid remember-me token (Series/token) mismatch” Error?

断了今生、忘了曾经 提交于 2021-02-07 09:18:13
问题 I use Spring Security persistent logins. I persist the remember me token in my database. Sometimes I get the following error: | Error 2013-07-02 13:54:14,859 [http-nio-8080-exec-2] ERROR [/buddyis].[gsp] - Servlet.service() for servlet [gsp] in context with path [/buddyis] threw exception Message: Invalid remember-me token (Series/token) mismatch. Implies previous cookie theft attack. Line | Method ->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor - - - - - - - - - - - - - - - -

How to fix “Invalid remember-me token (Series/token) mismatch” Error?

房东的猫 提交于 2021-02-07 09:13:59
问题 I use Spring Security persistent logins. I persist the remember me token in my database. Sometimes I get the following error: | Error 2013-07-02 13:54:14,859 [http-nio-8080-exec-2] ERROR [/buddyis].[gsp] - Servlet.service() for servlet [gsp] in context with path [/buddyis] threw exception Message: Invalid remember-me token (Series/token) mismatch. Implies previous cookie theft attack. Line | Method ->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor - - - - - - - - - - - - - - - -

Grails 2.5.4: Get all logged in users with HttpSessionListener

主宰稳场 提交于 2021-01-28 13:16:31
问题 I'm trying to get all the current user sessions using the app-info plugin but it doesn't compile in Grails 2.5.4 . Is there another way to get this information? I'm new to Grails. This link has some information including a reference to the app-info plugin but it's old and I wasn't able to get anything to compile. UPDATE I've added this custom class in src\groovy\UserSessions : package usersessions import javax.servlet.http.HttpSessionEvent import javax.servlet.http.HttpSessionListener /

Grails clean doesn't work

醉酒当歌 提交于 2021-01-28 00:10:31
问题 I'm using Grails -2.0.1 and when trying to run an app, I find a NoClassDefFoundError : Error 2012-10-16 15:24:25,301 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver - NoClassDefFoundError occurred when processing request: [GET] /workstation/track/computerName/login/MacOSX/true/username Could not initialize class workstation.server.TrackController. Stacktrace follows: Message: Error creating bean with name 'workstation.server.TrackController': Instantiation of bean failed; nested

Grails session variable null

蓝咒 提交于 2020-06-29 10:16:32
问题 My app has an expensive service method, results of which must be 1) checked for errors and 2) presented to a Java applet via a URL (i.e. as opposed to a JavaScript variable). The method result is a string, and the applet is only capable of loading data from a file or URL. I tried to deal with the problem using a session variable: def action1 = { def input = params['input'] def result = expensiveServiceMethod( input ) def failed = result == null session['result'] = result render( view:'view1',

How do I unit test a Grails service that uses a converter?

陌路散爱 提交于 2020-06-09 10:59:46
问题 I have a Grails service that sends out e-mails using a 3rd-party service by doing a HTTP call: class EmailService { def sendEmail(values) { def valueJson = values as JSON ... // does HTTP call to 3rd party service } } I've written a unit test to test this service (because an integration test spins up Hibernate and the entire domain framework, which I don't need): @TestFor(EmailService) class EmailServiceTests { void testEmailServiceWorks() { def values = [test: 'test', test2: 'test2'] service

How to execute mysql scripts in cloudfoundry

假如想象 提交于 2020-02-07 15:46:53
问题 I have a .sql file (initial sql scripts). I have recently deployed application in cloudfoundry, So I want to run these scripts to make application work, Scripts will update more than 5 db tables. Is there any other way to run the mysql scripts from the grails application on start up Or Is there any provision to run the scripts in the cloudfoundry. 回答1: you have several options here. The first one (which I recommend), is to use something like http://liquibase.org/ (there is a Grails plugin for

Adding changes listeners in Grails' GORM

淺唱寂寞╮ 提交于 2020-02-02 13:38:29
问题 I'm new to Grails and I'm using Grails 2.0.1. I want to add a persistence event listener for changes in objects for a domain class, so I tried the code in Bootstrap.groovy as given in the user guide: def init = { applicationContext.addApplicationListener(new FooBarListener()) } And I get the following error message: ERROR context.GrailsContextLoader - Error executing bootstraps: No such property: applicationContext for class: BootStrap How can I get the applicacionContext property from inside

What is the difference between withTransaction and withNewTransaction?

亡梦爱人 提交于 2020-01-24 04:02:06
问题 What is the difference between the following actions? def someAction() { User.withTransaction { ... } } and def someAction() { User.withNewTransaction { ... } } When do I use what? When a grails action contains only a Transaction block. In this case I guess withTransaction and withNewTransaction are the same, because each action has its own transaction. Is this true? 回答1: I believe these functions have to do with transaction isolation semantics. The withTransaction function will participate

Grails 2 can't login with spring security when using multiple databases

China☆狼群 提交于 2020-01-23 10:43:26
问题 On Grails 2.0.3, I installed Spring Security Core and created the User, UserRole and Role objects as per the tutorial: http://blog.springsource.org/2010/08/11/simplified-spring-security-with-grails/ All went fine until I decided to add a second datasource in preparation for accessing objects from a different database. DataSource.groovy looks like this: test { dataSource_product { dbCreate = "update" url = "jdbc:mysql://localhost/products" pooled = true driverClassName = "com.mysql.jdbc.Driver