[Seasar-user:5210] 【S2JSF1.0.18】s:forEachでMap$EntryのメソッドにアクセスするとIllegalAccessExceptionが発生する。

SCC村上剛志 [E-MAIL ADDRESS DELETED]
2006年 11月 20日 (月) 14:05:21 JST


お世話になっております。
村上です。

s:forEachにおいてMap$Entryのメソッドを実行した際に
メソッドのアクセスエラーが発生しましたので、対応を
お願いしたくご連絡いたしました。

  Java(SUN) 1.5.0_06
  Tomcat 5.5.17
  Seasar2 2.3.15
  S2JSF 1.0.19

の環境にて、HashMapのEntrySetを返すDto(sampleDto)に
対してMap$Entry#getKey,getValueを実行しようとすると、
IllegalAccessExceptionが発生します。

<ul>
  <div m:inject="s:forEach"
    m:items="#{sampleDto.entrySet}"
    m:var="entry" m:varIndex="index">
    <li>
      <span m:value="#{entry.key}" /> : 
      <span m:value="#{entry.value}" />
    </li>
  </div>
</ul>

スタックトレースは以下のとおりです。
------
2006-11-20 14:01:31,093 [http-18080-Processor25] ERROR org.apache.myfaces.el.ValueBindingImpl - Cannot get value for expression '#{entry.key}'
org.seasar.framework.exception.IllegalAccessRuntimeException: [ESSR0042]java.util.HashMap$Entryで不正なアクセスがありました。理由はjava.lang.IllegalAccessException: Class org.seasar.framework.util.MethodUtil can not access a member of class java.util.HashMap$Entry with modifiers "public"
	at org.seasar.framework.util.MethodUtil.invoke(MethodUtil.java:54)
	at org.seasar.framework.beans.impl.PropertyDescImpl.getValue(PropertyDescImpl.java:117)
	at org.seasar.jsf.el.S2PropertyResolver.getProperty(S2PropertyResolver.java:203)
	at org.seasar.jsf.el.S2PropertyResolver.getValue(S2PropertyResolver.java:56)
	at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:555)
	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
	at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:441)
	at javax.faces.component.UIOutput.getValue(UIOutput.java:75)
	at org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:296)
	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:93)
	at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:81)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:341)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:79)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.component.ForEach.encodeChildren(ForEach.java:232)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:77)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at org.seasar.jsf.util.RenderUtil.encodeChild(RenderUtil.java:75)
	at org.seasar.jsf.util.RenderUtil.encodeChildren(RenderUtil.java:63)
	at org.seasar.jsf.render.html.HtmlElementRenderer.encodeChildren(HtmlElementRenderer.java:85)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:329)
	at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:380)
	at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:288)
	at org.seasar.jsf.processor.TagProcessorImpl.processTag(TagProcessorImpl.java:226)
	at org.seasar.jsf.processor.TagProcessorImpl.process(TagProcessorImpl.java:217)
	at org.seasar.jsf.processor.ElementProcessor.process(ElementProcessor.java:93)
	at org.seasar.jsf.processor.TagProcessorImpl.processChildren(TagProcessorImpl.java:269)
	at org.seasar.jsf.processor.TagProcessorImpl.processBodyTag(TagProcessorImpl.java:243)
	at org.seasar.jsf.processor.TagProcessorImpl.process(TagProcessorImpl.java:213)
	at org.seasar.jsf.processor.TagProcessorImpl.process(TagProcessorImpl.java:196)
	at org.seasar.jsf.processor.ViewProcessor.process(ViewProcessor.java:174)
	at org.seasar.jsf.processor.ViewProcessor.process(ViewProcessor.java:172)
	at org.seasar.jsf.runtime.ViewRendererImpl.renderView(ViewRendererImpl.java:100)
	at org.seasar.jsf.application.S2ViewHandler.renderView(S2ViewHandler.java:123)
	at org.seasar.jsf.lifecycle.LifecycleImpl.render(LifecycleImpl.java:197)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:62)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:60)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:112)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalAccessException: Class org.seasar.framework.util.MethodUtil can not access a member of class java.util.HashMap$Entry with modifiers "public"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
	at java.lang.reflect.Method.invoke(Method.java:578)
	at org.seasar.framework.util.MethodUtil.invoke(MethodUtil.java:42)
	... 
------

デバッグしてみたところ、Seasar2のPropertyDescImplで
保持しているreadMethodが、パッケージプライベートな
HashMap$Entryのメソッドであるため、MethodUtil#invoke
にてIllegalAccessExceptionが発生しているようです。


対応が難しいようでしたら、もし回避策などありましたら
ご教示いただきたいと思います。

以上です。
宜しくお願いいたします。



--- 
村上剛志(Tsuyoshi Murakami)
株式会社エスシーシー  システム事業本部
第1システム事業部 システムサービス部
TEL: 03-3228-4446 FAX: 03-3319-6994
E-mail: [E-MAIL ADDRESS DELETED]



Seasar-user メーリングリストの案内