Hi,
I'm following this example on how to use Grails with ReactJS.
I've skipped the part where mapping to MongoDB is discussed - so I'm still using the default H2 database in the background.
I'm stuck at the point where the domain class controllers are initialized with the @Resource annotation. When I'm calling the TodoListController at /api/todoLists the following exception is thrown:
ERROR org.grails.web.errors.GrailsExceptionResolver - ClassCastException occurred when processing request: [GET] /api/todoLists
com.ociweb.Todo cannot be cast to org.grails.datastore.mapping.proxy.EntityProxy. Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:210)
at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:187)
at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: com.ociweb.Todo cannot be cast to org.grails.datastore.mapping.proxy.EntityProxy
Using Grails 3.2.0 with JDK 1.8_101. I've pushed the sample app to this repo.
Am I missing something? Thanks for your help!
Hi,
I'm following this example on how to use Grails with ReactJS.
I've skipped the part where mapping to MongoDB is discussed - so I'm still using the default H2 database in the background.
I'm stuck at the point where the domain class controllers are initialized with the
@Resourceannotation. When I'm calling the TodoListController at/api/todoListsthe following exception is thrown:Using Grails 3.2.0 with JDK 1.8_101. I've pushed the sample app to this repo.
Am I missing something? Thanks for your help!