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);
grantmcconnaughey
  • 10,130
  • 10
  • 37
  • 66
  • 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. – David Mar 21 '13 at 02:20
  • 2
    Try the power of grails clean :) – uchamp Mar 21 '13 at 05: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. – nycynik Jul 09 '13 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. – Peter N. Steinmetz Oct 10 '13 at 21:55

3 Answers3

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.

AverageJoe
  • 436
  • 4
  • 13
3

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.

Peter N. Steinmetz
  • 1,252
  • 1
  • 15
  • 23
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.

Lari Hotari
  • 5,190
  • 1
  • 36
  • 43