java.lang.ClassCastException in Grails app
Asked Answered
G

3

13

I am following the free online book "Getting Started with Grails" (http://www.infoq.com/minibooks/grails-getting-started) and I am getting a java.lang.ClassCastException when trying to list any domain class. Can anyone decipher this?

URI: /RaceTrack/runner/list
Class: java.lang.ClassCastException
Message: sun.proxy.$Proxy26 cannot be cast to org.springframework.orm.hibernate3.HibernateCallback

Stack trace:

    Line | Method
->>   15 | list      in RunnerController.groovy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    186 | doFilter  in PageFragmentCachingFilter.java
|     63 | doFilter  in AbstractFilter.java
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run       in java.lang.Thread

Additional info (around line 186 of PageFragmentCachingFilter.java)

183:            if(method == null) {
184:                log.debug("No cacheable method found for {}:{} {}",
185:                        new Object[] { request.getMethod(), request.getRequestURI(), getContext() });
186:                chain.doFilter(request, response);
187:                return;
188:            }
189:            Collection<CacheOperation> cacheOperations = cacheOperationSource.getCacheOperations(

Additional info (around line 63 of AbstractFilter.java):

60:     try {
61:         // NO_FILTER set for RequestDispatcher forwards to avoid double gzipping
62:         if (filterNotDisabled(request)) {
63:             doFilter(request, response, chain);
64:         }
65:         else {
66:             chain.doFilter(req, res);
Gallican answered 20/3, 2013 at 20:40 Comment(4)
Can you please include the code from RunnerController. Given it's the top of the stack trace that's where you should start looking.Autogamy
Try the power of grails clean :)Ascent
I have noticed this issue when I run from idea, but not from the command line (grails run-app). Maybe this has to do with the environment? our production version is using a remote db, and the dev is using hsqldb.Impanation
Also having trouble when running from IDEA, but not the command line. Clearing the .slcache not helping then, so must be related to IDEA.Pharmacist
S
23

I've had the same issue happening all of a sudden couple days back. Deleting ~/.grails/2.0.4/.slcache/ directory fixes it for me.

Spathic answered 11/4, 2013 at 16:28 Comment(2)
Shortcut - remove entire .grails folder.Cookhouse
Thanks! BTW, in my environment, it's ~/.grails/.slcache/.Etheridge
P
2

Delete .slcache in both the top of the .grails subdirectory and also the .slcache, if it exists, for the particular version of grails being used. For example, ~/.grails/2.1.3/.slcache.

This worked when using IntelliJ IDEA to launch the app.

Pharmacist answered 10/10, 2013 at 22:3 Comment(0)
M
1

Does the app start up with reloading (spring-loaded agent) disabled?

grails -noreloading run-app

A similar problem has been reported to Grails Jira as GRAILS-9952. It would help fixing the problem if you can provide an test app that reproduces the problem. Please attach that to the jira issue.

Malamute answered 3/4, 2013 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.