You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Miguel <mi...@gmail.com> on 2010/11/04 20:07:20 UTC

Error in error.flt

Hello,
I have a problem and Struts reports an error in one of it's own files:
error.ftl.
My code throws an exception and then the error.flt throws another
exception while trying to print my exception, thus masking mine.
I'm posting to dev, because I think it's an struts problem. Thanks for
your help.
I have pasted the stacktrace below.

The following code that throws the exception:
           <#if (msgs?size > 1)>
            <ol>
                <#list msgs as msg>
                    <#if (msg?is_method)>
                        <li>${msg[0]}</li>     <--- this line
                    <#else>
                        <li>${msg}</li>
                    </#if>
                </#list>


Struts Problem Report
Struts has detected an unhandled exception:

Messages:

1. � � FreeMarker template error!

2.
3.
4. � � � � � Method public java.lang.String
org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an
exception when invoked on org.hibernate.HibernateException: Illegal attempt
to associate a collection with two open sessions
5. � � � � � The problematic instruction:
6. � � � � � ----------
7. � � � � � ==> ${msg[0]} [on line 68, column 29 in
org/apache/struts2/dispatcher/error.ftl]
8. � � � � � ----------
9.
10. � � � Java backtrace for programmers:
11. � � � ----------
12. � � � freemarker.template.TemplateModelException: Method public
java.lang.String
org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an
exception when invoked on org.hibernate.HibernateException: Illegal attempt
to associate a collection with two open sessions
13. � � � � � � � at
freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
14. � � � � � � � at
freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138)
15. � � � � � � � at
freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111)
16. � � � � � � � at
freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
17. � � � � � � � at
freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
18. � � � � � � � at
freemarker.core.Expression.getStringValue(Expression.java:93)
19. � � � � � � � at
freemarker.core.DollarVariable.accept(DollarVariable.java:76)
20. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
21. � � � � � � � at
freemarker.core.MixedContent.accept(MixedContent.java:92)
22. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
23. � � � � � � � at freemarker.core.IfBlock.accept(IfBlock.java:82)
24. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
25. � � � � � � � at
freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
26. � � � � � � � at freemarker.core.Environment.visit(Environment.java:416)
27. � � � � � � � at
freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
28. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
29. � � � � � � � at
freemarker.core.MixedContent.accept(MixedContent.java:92)
30. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
31. � � � � � � � at freemarker.core.IfBlock.accept(IfBlock.java:82)
32. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
33. � � � � � � � at
freemarker.core.MixedContent.accept(MixedContent.java:92)
34. � � � � � � � at freemarker.core.Environment.visit(Environment.java:209)
35. � � � � � � � at
freemarker.core.Environment.process(Environment.java:189)
36. � � � � � � � at freemarker.template.Template.process(Template.java:237)
37. � � � � � � � at
org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:748)
38. � � � � � � � at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)
39. � � � � � � � at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:395)
40. � � � � � � � at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:242)
41. � � � � � � � at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:208)
42. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:343)
43. � � � � � � � at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.
invoke(FilterSecurityInterceptor.java:109)
44. � � � � � � � at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.
doFilter(FilterSecurityInterceptor.java:83)
45. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
46. � � � � � � � at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(
ExceptionTranslationFilter.java:97)
47. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
48. � � � � � � � at
org.springframework.security.web.authentication.AnonymousAuthenticationFilte
r.doFilter(AnonymousAuthenticationFilter.java:78)
49. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
50. � � � � � � � at
org.springframework.security.web.authentication.rememberme.RememberMeAuthent
icationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
51. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
52. � � � � � � � at
org.springframework.security.web.authentication.AbstractAuthenticationProces
singFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
53. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
54. � � � � � � � at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter
(LogoutFilter.java:105)
55. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
56. � � � � � � � at
org.springframework.security.web.context.SecurityContextPersistenceFilter.do
Filter(SecurityContextPersistenceFilter.java:79)
57. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
58. � � � � � � � at
org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(Co
ncurrentSessionFilter.java:109)
59. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
60. � � � � � � � at
org.springframework.security.web.access.channel.ChannelProcessingFilter.doFi
lter(ChannelProcessingFilter.java:109)
61. � � � � � � � at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
r(FilterChainProxy.java:355)
62. � � � � � � � at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.
java:149)
63. � � � � � � � at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(Delegati
ngFilterProxy.java:237)
64. � � � � � � � at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilt
erProxy.java:167)
65. � � � � � � � at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:242)
66. � � � � � � � at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:208)
67. � � � � � � � at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
68. � � � � � � � at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
69. � � � � � � � at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163
)
70. � � � � � � � at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108
)
71. � � � � � � � at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556)
72. � � � � � � � at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:118)
73. � � � � � � � at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:402)
74. � � � � � � � at
org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:439)
75. � � � � � � � at
org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProt
ocol.java:390)
76. � � � � � � � at
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:
1555)
77. � � � � � � � at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
10)
78. � � � � � � � at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
03)
79. � � � � � � � at java.lang.Thread.run(Thread.java:636)
80. � � � Caused by: java.lang.NullPointerException
81. � � � � � � � at
freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.jav
a:85)
82. � � � � � � � at
freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
83. � � � � � � � ... 66 more


Re: Error in error.flt

Posted by Dave Newton <da...@gmail.com>.
Looks like a Hibernate issue. When underlying frameworks throw exceptions in
templating solutions the stack traces can be large, but the problem is
obvious.

This isn't a Struts issue, but if you need assistance figuring out where the
two sessions are coming from you could post to the user list.

Dave
 On Nov 4, 2010 2:07 PM, "Miguel" <mi...@gmail.com> wrote:
> Hello,
> I have a problem and Struts reports an error in one of it's own files:
> error.ftl.
> My code throws an exception and then the error.flt throws another
> exception while trying to print my exception, thus masking mine.
> I'm posting to dev, because I think it's an struts problem. Thanks for
> your help.
> I have pasted the stacktrace below.
>
> The following code that throws the exception:
> <#if (msgs?size > 1)>
> <ol>
> <#list msgs as msg>
> <#if (msg?is_method)>
> <li>${msg[0]}</li> <--- this line
> <#else>
> <li>${msg}</li>
> </#if>
> </#list>
>
>
> Struts Problem Report
> Struts has detected an unhandled exception:
>
> Messages:
>
> 1.     FreeMarker template error!
>
> 2.
> 3.
> 4.           Method public java.lang.String
> org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an
> exception when invoked on org.hibernate.HibernateException: Illegal
attempt
> to associate a collection with two open sessions
> 5.           The problematic instruction:
> 6.           ----------
> 7.           ==> ${msg[0]} [on line 68, column 29 in
> org/apache/struts2/dispatcher/error.ftl]
> 8.           ----------
> 9.
> 10.       Java backtrace for programmers:
> 11.       ----------
> 12.       freemarker.template.TemplateModelException: Method public
> java.lang.String
> org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an
> exception when invoked on org.hibernate.HibernateException: Illegal
attempt
> to associate a collection with two open sessions
> 13.               at
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
> 14.               at
> freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138)
> 15.               at
>
freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:111)
> 16.               at
> freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:90)
> 17.               at
> freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
> 18.               at
> freemarker.core.Expression.getStringValue(Expression.java:93)
> 19.               at
> freemarker.core.DollarVariable.accept(DollarVariable.java:76)
> 20.               at
freemarker.core.Environment.visit(Environment.java:209)
> 21.               at
> freemarker.core.MixedContent.accept(MixedContent.java:92)
> 22.               at
freemarker.core.Environment.visit(Environment.java:209)
> 23.               at freemarker.core.IfBlock.accept(IfBlock.java:82)
> 24.               at
freemarker.core.Environment.visit(Environment.java:209)
> 25.               at
> freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
> 26.               at
freemarker.core.Environment.visit(Environment.java:416)
> 27.               at
> freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
> 28.               at
freemarker.core.Environment.visit(Environment.java:209)
> 29.               at
> freemarker.core.MixedContent.accept(MixedContent.java:92)
> 30.               at
freemarker.core.Environment.visit(Environment.java:209)
> 31.               at freemarker.core.IfBlock.accept(IfBlock.java:82)
> 32.               at
freemarker.core.Environment.visit(Environment.java:209)
> 33.               at
> freemarker.core.MixedContent.accept(MixedContent.java:92)
> 34.               at
freemarker.core.Environment.visit(Environment.java:209)
> 35.               at
> freemarker.core.Environment.process(Environment.java:189)
> 36.               at
freemarker.template.Template.process(Template.java:237)
> 37.               at
> org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:748)
> 38.               at
>
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)
> 39.               at
>
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
> a:395)
> 40.               at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:242)
> 41.               at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:208)
> 42.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:343)
> 43.               at
>
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.
> invoke(FilterSecurityInterceptor.java:109)
> 44.               at
>
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.
> doFilter(FilterSecurityInterceptor.java:83)
> 45.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 46.               at
>
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(
> ExceptionTranslationFilter.java:97)
> 47.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 48.               at
>
org.springframework.security.web.authentication.AnonymousAuthenticationFilte
> r.doFilter(AnonymousAuthenticationFilter.java:78)
> 49.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 50.               at
>
org.springframework.security.web.authentication.rememberme.RememberMeAuthent
> icationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
> 51.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 52.               at
>
org.springframework.security.web.authentication.AbstractAuthenticationProces
> singFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
> 53.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 54.               at
>
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter
> (LogoutFilter.java:105)
> 55.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 56.               at
>
org.springframework.security.web.context.SecurityContextPersistenceFilter.do
> Filter(SecurityContextPersistenceFilter.java:79)
> 57.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 58.               at
>
org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(Co
> ncurrentSessionFilter.java:109)
> 59.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 60.               at
>
org.springframework.security.web.access.channel.ChannelProcessingFilter.doFi
> lter(ChannelProcessingFilter.java:109)
> 61.               at
>
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilte
> r(FilterChainProxy.java:355)
> 62.               at
>
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.
> java:149)
> 63.               at
>
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(Delegati
> ngFilterProxy.java:237)
> 64.               at
>
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilt
> erProxy.java:167)
> 65.               at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:242)
> 66.               at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:208)
> 67.               at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:243)
> 68.               at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:201)
> 69.               at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:163
> )
> 70.               at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108
> )
> 71.               at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:556)
> 72.               at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :118)
> 73.               at
>
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:402)
> 74.               at
> org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:439)
> 75.               at
>
org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProt
> ocol.java:390)
> 76.               at
>
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:
> 1555)
> 77.               at
>
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
> 10)
> 78.               at
>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
> 03)
> 79.               at java.lang.Thread.run(Thread.java:636)
> 80.       Caused by: java.lang.NullPointerException
> 81.               at
>
freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.jav
> a:85)
> 82.               at
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
> 83.               ... 66 more
>