問題を解決するのに役立つとは思えない多くの例外に遭遇しました。
ここにある
Class org.apache.struts2.json.JSONWriter can not access a member of class org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
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.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
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.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl 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.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
org.apache.struts2.json.JSONException: 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.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: 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.hibernate.bytecode.internal.javassist.BytecodeProviderImpl$EntityInstrumentationMetadataImpl with modifiers "public"
これがJSONを返すアクションクラスです
public class GetTagsAction extends ActionSupport{
public String execute(){
Gson gson = new Gson();
String tags = gson.toJson(audioTaggingService.findTagsByName(q));
System.out.println(tags);
return Action.SUCCESS;
}
public String getQ() {
return q;
}
public void setQ(String q) {
this.q = q;
}
public AudioTaggingService getAudioTaggingService() {
return audioTaggingService;
}
public void setAudioTaggingService(AudioTaggingService audioTaggingService) {
this.audioTaggingService = audioTaggingService;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
private String q;
private AudioTaggingService audioTaggingService;
private String tags;
}
パッケージはこちら
<package name="default" namespace="/" extends="json-default">
<!-- Get AJAX Related Actions -->
<action name="tags" class="tags">
<result type="json" />
</action>
</package>
そして、私は使用していますStruts2-JSON-plugin