简体   繁体   中英

Grails error only on Tomcat server; not reproducible locally: Error executing tag <g:link>: object is not an instance of declaring class

I've got a weird bug on the live server. It happens only on a specific action (a search). I can't reproduce it locally (where I run the code using grails run-app ), and I can't reproduce it on the test server, which runs Tomcat in exactly the same way as the production server. I've copied the production database to local, and I still can't reproduce the error. The only config differenes are that mail is enabled and some other minor stuff, none of which seems relevant here.

I have no idea where to look, because I have no idea what "object is not an instance of declaring class" means. Or more importantly, why this would only be a problem on the production server. Here's the full error:

Error 500: Error processing GroovyPageView: Error executing tag <g:link>: object is not an instance of declaring class at /WEB-INF/grails-app/views/dealer/list.gsp:41
Servlet: grails
URI: /grails/dealer/list.dispatch
Exception Message: object is not an instance of declaring class
Caused by: Error processing GroovyPageView: Error executing tag <g:link>: object is not an instance of declaring class at /WEB-INF/grails-app/views/dealer/list.gsp:41
Class: gsp_quotations_dealerlist_gsp
At Line: [72] 

The .gsp code around line 41 is:

<g:each in="${dealerInstanceList}" status="i" var="dealerInstance">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
  <td><g:link action="show" id="${dealerInstance.id}">${fieldValue(bean:dealerInstance, field:'name')}</g:link></td>
  <td><g:link action="show" id="${dealerInstance.id}">${fieldValue(bean:dealerInstance, field:'address')}</g:link></td>
  <td><g:link controller="quoteSettings" action="adminEdit" id="${dealerInstance.id}">${dealerInstance?.quoteSettings?.pricingTables?.size() > 0}</g:link></td>
</tr>
</g:each>

Line 41 is the last g:link tag.

Note again that all of this works fine locally and on the test server. I'm completely stumped.

The error " object is not an instance of declaring class " is usually associated with environment issues. Check your JVM and tomcat versions in server.

Try using same JVM version for production and development.

How does you UrlMapping.groovy look like? did you modify it? also, try using <g:createLink ...> tag instead of <g:link> and play with the "absolute" param: http://grails.org/doc/1.0.x/ref/Tags/createLink.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM