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);
4
  • 1
    Can you please include the code from RunnerController. Given it's the top of the stack trace that's where you should start looking. Commented Mar 21, 2013 at 2:20
  • 2
    Try the power of grails clean :) Commented Mar 21, 2013 at 5:43
  • 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. Commented Jul 9, 2013 at 19:31
  • Also having trouble when running from IDEA, but not the command line. Clearing the .slcache not helping then, so must be related to IDEA. Commented Oct 10, 2013 at 21:55

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Shortcut - remove entire .grails folder.
Thanks! BTW, in my environment, it's ~/.grails/.slcache/.
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.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.