ArrayList<AllAttributeContent>allAttributeContent=
(ArrayList<AllAttributeContent>) MySessionFactory.executeQuery("from AllAttributeContent where allAttribute=?", attribute_id);
JSONArray jsonArray=JSONArray.fromObject(allAttributeContent);
out.println(jsonArray);
这个怎么解决啊
EVERE: Servlet.service() for servlet [action] in context with path [/Zjingling] threw exception [net.sf.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.lj.domain.AllAttribute.allAttributeContents, no session or session was closed] with root cause
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.lj.domain.AllAttribute.allAttributeContents, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:434)
at java.util.HashMap.hash(HashMap.java:351)
at java.util.HashMap.put(HashMap.java:471)
at java.util.HashSet.add(HashSet.java:217)
at net.sf.json.AbstractJSON.addInstance(AbstractJSON.java:52)
at net.sf.json.JSONArray._fromCollection(JSONArray.java:821)
at net.sf.json.JSONArray.fromObject(JSONArray.java:137)
at net.sf.json.JSONObject._processValue(JSONObject.java:2402)
at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
at net.sf.json.JSONObject._processValue(JSONObject.java:2426)
at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
at net.sf.json.JSONArray._processValue(JSONArray.java:2294)
at net.sf.json.JSONArray.processValue(JSONArray.java:2325)
at net.sf.json.JSONArray.addValue(JSONArray.java:2312)
at net.sf.json.JSONArray._fromCollection(JSONArray.java:841)
at net.sf.json.JSONArray.fromObject(JSONArray.java:137)
at net.sf.json.JSONArray.fromObject(JSONArray.java:120)
at com.lj.struts.action.UpdateAction.execute(UpdateAction.java:37)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)