StrutsとStruts JSONプラグインを使用してSpringアプリケーションを開発しています。アプリケーションを実行すると、(Firebugで)次のエラーが発生します。
org.Apache.struts2.json.JSONException: org.Apache.struts2.json.JSONException: org.Apache.struts2.json.JSONException: org.Apache.struts2.json.JSONException: Java.lang.IllegalAccessException: Class org.Apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers public
これは完全なスタックトレースです。
org.Apache.struts2.json.JSONException:
org.Apache.struts2.json.JSONException:
org.Apache.struts2.json.JSONException:
org.Apache.struts2.json.JSONException:
Java.lang.IllegalAccessException: Class
org.Apache.struts2.json.JSONWriter can not access a member of class
org.springframework.aop.TruePointcut with modifiers "public"
org.Apache.struts2.json.JSONWriter.bean(JSONWriter.Java:238)
org.Apache.struts2.json.JSONWriter.processCustom(JSONWriter.Java:171)
org.Apache.struts2.json.JSONWriter.process(JSONWriter.Java:161)
org.Apache.struts2.json.JSONWriter.value(JSONWriter.Java:127)
org.Apache.struts2.json.JSONWriter.write(JSONWriter.Java:95)
org.Apache.struts2.json.JSONUtil.serialize(JSONUtil.Java:116)
org.Apache.struts2.json.JSONResult.createJSONString(JSONResult.Java:196)
org.Apache.struts2.json.JSONResult.execute(JSONResult.Java:170)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.Java:374)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:278)
org.Apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.Java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.Java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.Java:265)
org.Apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.Java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.Java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.Java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.Java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.Java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.Java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.Java:90)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.Java:243)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.Java:100)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.Java:141)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.Java:145)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.Java:171)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.Java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.Java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.Java:192)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.Java:187)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.Java:54)
org.Apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.Java:511)
org.Apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.Java:432)
根本的な原因:
org.Apache.struts2.json.JSONException:
org.Apache.struts2.json.JSONException:
org.Apache.struts2.json.JSONException:
Java.lang.IllegalAccessException: Class
org.Apache.struts2.json.JSONWriter can not access a member of class
org.springframework.aop.TruePointcut with modifiers "public"
org.Apache.struts2.json.JSONWriter.bean(JSONWriter.Java:238)
org.Apache.struts2.json.JSONWriter.processCustom(JSONWriter.Java:171)
org.Apache.struts2.json.JSONWriter.process(JSONWriter.Java:161)
org.Apache.struts2.json.JSONWriter.value(JSONWriter.Java:127)
org.Apache.struts2.json.JSONWriter.add(JSONWriter.Java:363)
org.Apache.struts2.json.JSONWriter.bean(JSONWriter.Java:223)
org.Apache.struts2.json.JSONWriter.processCustom(JSONWriter.Java:171)
org.Apache.struts2.json.JSONWriter.process(JSONWriter.Java:161)
org.Apache.struts2.json.JSONWriter.value(JSONWriter.Java:127)
org.Apache.struts2.json.JSONWriter.write(JSONWriter.Java:95)
org.Apache.struts2.json.JSONUtil.serialize(JSONUtil.Java:116)
org.Apache.struts2.json.JSONResult.createJSONString(JSONResult.Java:196)
org.Apache.struts2.json.JSONResult.execute(JSONResult.Java:170)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.Java:374)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:278)
org.Apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.Java:256)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.Java:176)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.Java:265)
org.Apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.Java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.Java:138)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.Java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.Java:211)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.Java:98)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.Java:190)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.Java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249)
org.Apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.Java:90)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.Java:249
このクラス自体は公開されていません。パッケージ保護されています( ここ を参照)。メンバーにアクセスする前に、プライベートまたは保護されたメンバーにアクセスする場合とまったく同じように、setAccessible(true)
を呼び出す必要があります。
編集。残念ながら、完全なスタックトレースが提供されていません。この例外があなたの活動の結果である場合(つまり、自分でSpringクラスのメンバーにアクセスしようとした場合)、解決策は上記のとおりです。ただし、フレームワークの衝突の結果としてこれが発生した場合は、詳細を送信してください。おそらく、StrutsとSpringのバージョンに互換性がないか、追加の構成が必要です。