Grails 错误仅在 Tomcat 服务器上;无法在本地重现:执行标记时出错:对象不是声明类的实例
我的实时服务器上有一个奇怪的错误。它仅发生在特定操作(搜索)上。我无法在本地重现它(我使用 grails run-app 运行代码),并且无法在测试服务器上重现它,该服务器以与生产环境完全相同的方式运行 Tomcat服务器。我已经将生产数据库复制到本地,但仍然无法重现该错误。唯一的配置不同是启用了邮件和其他一些小东西,这些东西在这里似乎都不相关。
我不知道该往哪里看,因为我不知道“对象不是声明类的实例”是什么意思。或者更重要的是,为什么这只会成为生产服务器上的问题。这是完整的错误:
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]
第 41 行周围的 .gsp 代码是:
<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>
第 41 行是最后一个 g:link 标记。
再次注意,所有这些在本地和测试服务器上都运行良好。我完全被难住了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的 UrlMapping.groovy 是什么样子的?你修改了吗?
另外,尝试使用
标签代替
并使用“absolute”参数:http://grails.org/doc/1.0.x/ref/Tags /createLink.html
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
错误“对象不是声明类的实例”通常与环境问题相关。检查服务器中的 JVM 和 tomcat 版本。
尝试使用相同的 JVM 版本进行生产和开发。
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.