2 Replies Latest reply on Jan 9, 2007 7:12 PM by Ganesh Gothai

    Getting java.lang.reflect.UndeclaredThrowableException when

    Ganesh Gothai Newbie

      I am Getting java.lang.reflect.UndeclaredThrowableException when returning Collection obj from stateless bean.

      Though I implement the Serializable in my return obj(i.e. Response), I got the exception,
      java.lang.reflect.UndeclaredThrowableException
      at $Proxy96.readResult(Unknown Source)
      at com.ussearch.crm.web.report.ViewResultAction1.execute(ViewResultAction1.java:66)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.ussearch.util.web.filters.GZIPFilter.doFilter(GZIPFilter.java:39)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      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.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      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:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.io.UTFDataFormatException: encoded string too long: 270422 bytes
      at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
      at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
      at org.jboss.serial.util.StringUtil.saveString(StringUtil.java:27)
      at org.jboss.serial.objectmetamodel.DataContainer.saveString(DataContainer.java:987)
      at org.jboss.serial.objectmetamodel.DataContainer.writeMyself(DataContainer.java:1056)
      at org.jboss.serial.objectmetamodel.DataContainer.saveData(DataContainer.java:936)
      at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:114)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:287)
      at org.jboss.serial.io.MarshalledObject.(MarshalledObject.java:51)
      at org.jboss.ejb3.SessionContainer.marshallResponse(SessionContainer.java:211)
      at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:223)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:55)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      at org.jboss.ejb3.stateless.StatelessClusteredProxy.invoke(StatelessClusteredProxy.java:100)

      Can anyone help me to resolve this?

      Here is my code

      My Stateless bean interface:

      public interface ReportManager {
      
      throws EJBException;
      
       public List<Response> readResult(String orderLineId);
      }

      My Local interface:

      @javax.ejb.Local
      public interface ReportManagerLocal extends ReportManager{
      }

      My Remote interface:

      @javax.ejb.Remote
      public interface ReportManagerRemote extends ReportManager{
      }

      My Bean Impl:

      @javax.ejb.Stateless
      @org.jboss.annotation.ejb.Clustered
      public class ReportManagerBean implements ReportManagerLocal, ReportManagerRemote{
       private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ReportManagerBean.class);
      
       private ReportDAO reportDAO;
      
       public ReportManagerBean(){
       reportDAO = new ReportDAO();
       }
      
       public List<Response> readResult(String _orderLineId){
       try{
       return reportDAO.readResult(_orderLineId);
       } catch(Exception ex){
       logger.error("Error in reading result: ", ex);
       throw new EJBException("Error while reading result for line id "+_orderLineId, ex);
       }
       }
      }

      My Response class:

      import java.io.Serializable;
      
      public class Response implements Serializable {
       private String response;
      
       public Response(){}
      
       public Response(String _response){
       response = _response;
       }
      
       public String getResponse(){
       return response;
       }
      
       public void setResponse(String _response){
       response = _response;
       }
      }