Yeah, I didn't think it would change it, but it was worth a try. I also sent another reply, but that got sent to the "moderator" since it was too large. I added an attachment, which is generally a no-no. I'll resend in a second without the attachment.

Dean Crothers wrote:

Rick,

I tried your new hashCode method, but as expected I still see the exception. Remember, my code now passes an ArrayList to <display:table ...> not a Set.

thanks for efforts.

Dean



----Original Message Follows----
From: Rick Herrick <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: [displaytag-user] Jasper exception?
Date: Thu, 21 Apr 2005 14:22:25 -0700

Humor me and try this.  Replace your hashCode() method with this:

   public int hashCode()
   {
       int result;
       result = id;
       result = 29 * result + (bike != null ? bike.hashCode() : 0);
       result = 29 * result + (route != null ? route.hashCode() : 0);
       result = 29 * result + (date != null ? date.hashCode() : 0);
       result = 29 * result + dst;
       result = 29 * result + duration;
       result = 29 * result + odo;
       return result;
   }

A standard result for the hashCode() method can make objects stored in hashsets behave oddly. Your sample code shows this as a Set, but there must be some kind of implementation there. If it's a HashSet, then if the hashCode() method returns the same for every object, that may be causing trouble.

That said, I DOUBT that's the problem. When I first set up some sample code for this, I would end up with a hashset with only one value. Since you get more than one value, I doubt that's the problem. But please check that also just to see.

Dean Crothers wrote:

Rick,

I'm using hibernate V2 to populate the Set. To remove the Set issue you spoke of, I then convert the Set to a java.util.ArrayList and set it as an attribute on the http request, the code fragment being:

                       Set rides = dao.getAllRides();
            Iterator i = rides.iterator();
            ArrayList arr = new ArrayList();
            while(i.hasNext()) {
                arr.add(i.next());
            }
            req.setAttribute("Rides", arr);

The ArrayList is composed of Ride objects, being:

import java.util.Date;

public class Ride {
   private int id;
   private String route;
   private Date date;
   private int dst;
   private int duration;
   private int odo;
   private Bike bike;


public Ride() {}

public Ride(String route, Date date, int dst, int duration, int odo) {
setRoute(route);
setDate(date);
setDst(dst);
setDuration(duration);
setOdo(odo);
}


   public int getId() {
       return id;
   }

   public String getRoute() {
       return route;
   }

   public Date getDate() {
       return date;
   }

   public int getDst() {
       return dst;
   }

   public int getDuration() {
       return duration;
   }

   public int getOdo() {
       return odo;
   }

   public Bike getBike() {
       return bike;
   }

   public void setId(int id) {
       this.id = id;
   }

   public void setRoute(String route) {
       this.route = route;
   }

   public void setDate(Date date) {
       this.date = date;
   }

   public void setDst(int dst) {
       this.dst = dst;
   }

   public void setDuration(int duration) {
       this.duration = duration;
   }

   public void setOdo(int odo) {
       this.odo = odo;
   }

   public void setBike(Bike bike) {
       this.bike = bike;
   }

   public String toString() {
       return date + " " + route;
   }

   public boolean equals(Object other) {
       if ( this == other ) {
           return true;
       }
       if ( !(other instanceof Ride) ) {
           return false;
       }
       if ( this.getId() == ((Ride)other).getId() ) {
           return true;
       }
       return false;
   }

   public int hashCode() {
       return 12; // legal but very inefficient
   }
}


Then finally the JSP code to render the table is (and I've tried various forms of this) to no avail:


<%@ taglib uri="http://displaytag.sf.net"; prefix="display" %>
...
    <logic:present scope="request" name="Rides">
        <display:table name="Rides" pagesize="10" >
            <display:column property="date" />
            <display:column property="route" />
            <display:column property="dst" />
        </display:table>
    </logic:present>


As I've said the first 10 records are displayed fine, but when I click 'Next', 'Last', etc it throws the exception. I've removed the acegi security and that wasnt it, so I think this is as about as simple as it can be, so its a little puzzling as to whats going on? I'm using Tiles but I cant see how that could be it?


thanks for your time,

Dean

----Original Message Follows----
From: Rick Herrick <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: [displaytag-user] Jasper exception?
Date: Thu, 21 Apr 2005 11:35:36 -0700

Sorry, you've stumped me then! I really have issues with the error reporting from within the Tomcat engine, precisely for this reason. It's quite difficult to figure out precisely what's making it mad.

If you can post a snippet of how the list is getting populated and what it's getting populated with, that may provide some more information, but this is one of those more difficult things to figure out...

Dean Crothers wrote:

Rick,

thanks for the suggestion, but I've changed it to an implementation of java.util.ArrayList and I'm still getting the same exception.


Dean

----Original Message Follows----
From: "Dean Crothers" <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: [displaytag-user] Jasper exception?
Date: Thu, 21 Apr 2005 07:59:58 +0000

Hi,

I have a problem that I cant find the answer to in the forums archives. The first 10 records displays fine in the table, however when I click 'Next' I get a jasper exception. I'm using Tomcat 4.1.31, Spring 1.1.5, Struts 1.2.4, DisplayTag-1.0, all the correct commons-* dependences as I copied them from the example webapp.

Any help is appreciated!

My displayTag JSP code is:
        <display:table name="Rides" pagesize="10">
            <display:column property="date" title="Date" />
            <display:column property="route" title="Route" />
            <display:column property="dst" title="DST" />
        </display:table>

where "Rides" is an instance of java.util.HashSet, and the exception is:

HTTP Status 500 -

--------------------------------------------------------------------------------




type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
at net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:214)




at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:374)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:225)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:179)



at net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:125)



at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)



at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)



at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)




at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)




at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)



at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)




at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)




at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)



at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)



at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)



    at java.lang.Thread.run(Unknown Source)


root cause

org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)




at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)




at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:300)



at net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:84)



at net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter.doFilter(SecurityEnforcementFilter.java:182)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:374)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:225)



at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)



at net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:179)



at net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:125)



at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)



at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)



at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)




at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)




at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)



at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)



at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)




at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)



at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)



at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)




at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)



at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)



at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)



at java.lang.Thread.run(Unknown Source)



--
Rick Herrick
[EMAIL PROTECTED]

I haven't got time for inner peace.

Get out of control, but appear under control. It's not bad to alarm other 
people, though--it's good for them.--Hunter S. Thompson




------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ displaytag-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to