[Seasar-user:9740] Re: setterインジェクションでDIされるケースとされないケースがある

Taro Unno [E-MAIL ADDRESS DELETED]
2007年 8月 7日 (火) 14:30:52 JST


小林さん

お世話になっております。海野です。
下記に、スタックトレースを添付します。
これがヒントになって回避策が見つかりました。

AaaPageクラスに定義したプロパティに、
javax.faces.internal.LabelUtil#getLabelValue(String)メソッドで
値を設定しているのですが、
これをgetterで設定するように変更したところ、回避できました。

   private String aaa = LabelUtil.getLabelValue("aaalabel");

としていたのを

    private String aaa;

    public String getAaa(){
        if(aaa == null){
            aaa = LabelUtil.getLabelValue("aaalabel");
        }
    }

と変更しました。

これは、こちらのLabelUtilの使い方が悪かった、
(プロパティの初期化に使うべきものでなかった)
という認識で合ってますでしょうか。

以前にもCoolDeployのときだけ問題が起きたのですが
([Seasar-user:8348] Re: CoolDeploy時のみ、Tomcat起動時にエラーが発生する)
プロパティの初期化は仕組みをよく理解して行わないといけないってことですかね。

Eclipseでのデバッグ方法の勉強にもなりました。
感謝します。

<スタックトレースここから>----------------------------------------------
org.seasar.framework.exception.InvocationTargetRuntimeException:
[ESSR0043]jp.co.eee.fff.web.include.AaaPageが呼び出した対象が不正です。理由はjava.lang.NullPointerException
	at org.seasar.framework.util.ConstructorUtil.newInstance(ConstructorUtil.java:62)
	at org.seasar.framework.container.assembler.AbstractConstructorAssembler.assembleDefault(AbstractConstructorAssembler.java:115)
	at org.seasar.framework.container.assembler.AutoConstructorAssembler.doAssemble(AutoConstructorAssembler.java:44)
	at org.seasar.framework.container.assembler.AbstractConstructorAssembler.assemble(AbstractConstructorAssembler.java:55)
	at org.seasar.framework.container.deployer.RequestComponentDeployer.deploy(RequestComponentDeployer.java:65)
	at org.seasar.framework.container.impl.ComponentDefImpl.getComponent(ComponentDefImpl.java:111)
	at org.seasar.framework.container.impl.S2ContainerImpl.getComponent(S2ContainerImpl.java:129)
	at org.seasar.framework.container.assembler.AbstractBindingTypeDef.getValue(AbstractBindingTypeDef.java:282)
	at org.seasar.framework.container.assembler.AbstractBindingTypeDef.bindAuto(AbstractBindingTypeDef.java:208)
	at org.seasar.framework.container.assembler.BindingTypeShouldDef.doBind(BindingTypeShouldDef.java:58)
	at org.seasar.framework.container.assembler.AbstractBindingTypeDef.bind(AbstractBindingTypeDef.java:78)
	at org.seasar.framework.container.assembler.AutoPropertyAssembler.assemble(AutoPropertyAssembler.java:67)
	at org.seasar.framework.container.deployer.RequestComponentDeployer.deploy(RequestComponentDeployer.java:67)
	at org.seasar.framework.container.impl.ComponentDefImpl.getComponent(ComponentDefImpl.java:111)
	at org.seasar.framework.container.impl.S2ContainerImpl.getComponent(S2ContainerImpl.java:129)
	at org.seasar.teeda.core.util.BindingUtil.getValue(BindingUtil.java:61)
	at org.seasar.teeda.core.el.TeedaVariableResolver.resolveVariable(TeedaVariableResolver.java:83)
	at org.seasar.teeda.core.util.VariableResolverUtil.resolveVariable(VariableResolverUtil.java:38)
	at org.seasar.teeda.core.el.impl.commons.ELVariableResolver.resolveVariable(ELVariableResolver.java:37)
	at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
	at org.seasar.teeda.core.el.impl.commons.CommonsExpressionProcessorImpl.evaluate(CommonsExpressionProcessorImpl.java:94)
	at org.seasar.teeda.core.el.impl.ValueBindingImpl.getValue(ValueBindingImpl.java:68)
	at org.seasar.teeda.core.util.BindingUtil.resolveBinding(BindingUtil.java:86)
	at org.seasar.teeda.core.util.BindingUtil.resolveBindingNoException(BindingUtil.java:92)
	at org.seasar.teeda.extension.taglib.TInputCommaTextTag.setProperties(TInputCommaTextTag.java:82)
	at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:391)
	at javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:397)
	at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:274)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:231)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:200)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTreeChildren(ElementProcessorImpl.java:247)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:235)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:200)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTreeChildren(ElementProcessorImpl.java:247)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:235)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:200)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTreeChildren(ElementProcessorImpl.java:247)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:235)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:200)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTreeChildren(ElementProcessorImpl.java:247)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:235)
	at org.seasar.teeda.extension.html.processor.ElementProcessorImpl.composeComponentTree(ElementProcessorImpl.java:200)
	at org.seasar.teeda.extension.html.impl.HtmlViewHandler.createView(HtmlViewHandler.java:120)
	at org.seasar.teeda.core.lifecycle.impl.RestoreViewPhase.composeViewRoot(RestoreViewPhase.java:120)
	at org.seasar.teeda.core.lifecycle.impl.RestoreViewPhase.executePhase(RestoreViewPhase.java:81)
	at org.seasar.teeda.core.lifecycle.AbstractPhase.execute(AbstractPhase.java:55)
	at org.seasar.teeda.core.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:68)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:92)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at jp.co.eee.fff.filter.fffAuthFilter.doFilter(fffAuthFilter.java:98)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at jp.co.eee.fff.filter.fffLoginFilter.doFilter(fffLoginFilter.java:94)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:64)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:69)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
	at javax.faces.internal.LabelUtil.getLabelValue(LabelUtil.java:40)
	at jp.co.eee.fff.web.include.AaaPage.<init>(AaaPage.java:72)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at org.seasar.framework.util.ConstructorUtil.newInstance(ConstructorUtil.java:54)
	... 80 more
<スタックトレースここから>----------------------------------------------


07/08/07 に Koichi Kobayashi<[E-MAIL ADDRESS DELETED]> さんは書きました:
> 小林 (koichik) です.
>
> Date:    Tue, 7 Aug 2007 08:57:13 +0900
> From:    "Taro Unno" <[E-MAIL ADDRESS DELETED]>
> To:      [E-MAIL ADDRESS DELETED]
> Subject: [Seasar-user:9722] Re: setterインジェクションでDIされるケースとされないケースがある
>
> > > この時に発生している例外が何か教えてください.
> >
> > org.seasar.framework.exception.InvocationTargetRuntimeException:
> > [ESSR0043]jp.co.eee.fff.web.include.AaaPageが呼び出した対象が不正です。理由はjava.lang.NullPointerException
> >
> > と表示されます。
>
> ぬぬぅ,ぬるぽ?
>
> お手数ですが,同じく AbstractBindingTypeDef の
> getValue() メソッドでブレークしてる状態で,
> Variables ビューで cause を選択し,下のペイン
> (選択したオブジェクトの文字列表現がが表示される
> エリア) に printStackTrace() と入力してそれを
> 選択,右クリックして「実行」をクリックしてください.
>
> コンソールに InvocationTargetRuntimeException と,
> その原因となったヌルポのスタックトレースが
> 出力されるはずなのでそれをメールにコピペして
> 送ってください.
> よろしくお願いします.
>
>
> --
> <component name="koichik">
>    <property name="fullName">"Koichi Kobayashi"</property>
>    <property name="email">"[E-MAIL ADDRESS DELETED]"</property>
>    <property name="blog">"http://d.hatena.ne.jp/koichik"</property>
> </component>
>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>



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