Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001532 [Resin] minor always 01-02-07 09:36 01-02-07 12:50
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0001532: CMP java.util.Date vs java.sql.Date cast exception
Description (rep by Andrew Barton)

For reference, I have attached CachedImage.ejb where the ejbSelect
query in question is defined. I have also attached with my debug code attached.

The schema for the table in question is listed at the bottom of this
message. You will notice I am using a mysql 'datetime' data type for
the modified date.

The problem method is:
public Date ejbHomeGetModifiedDate(Integer key) {
System.out.println("CachedImageBean.ejbHomeGetModifiedDate() -
key: " + key);
(): " + ejbSelectModifiedDate(key));
return new Date();
catch (FinderException e){
return null;

public abstract Date ejbSelectModifiedDate(Integer id) throws

When the return type for ejbSelectModifiedDate is defined as a
java.util.Date, I get the following exception:
javax.servlet.ServletException: java.lang.ClassCastException
at eblox.commons.image.BaseCachedImageServlet.service
at javax.servlet.http.HttpServlet.service(
at com.caucho.server.dispatch.ServletFilterChain.doFilter
at com.caucho.server.webapp.WebAppFilterChain.doFilter
at com.caucho.server.dispatch.ServletInvocation.service
at com.caucho.server.http.HttpRequest.handleRequest(
at com.caucho.util.ThreadPool.runTasks(
Caused by: java.lang.ClassCastException
at _ejb.CachedImageBean.CachedImageBean__EJB
at eblox.commons.image.CachedImageBean.ejbHomeGetModifiedDate
at _ejb.CachedImageBean.CachedImageBean__EJB
at eblox.commons.image.CachedImageServlet.getModifiedDate
at eblox.commons.image.BaseCachedImageServlet.service
... 9 more
This was the previous state. When I define the return type as
java.sql.Date as in:

public abstract java.sql.Date ejbSelectModifiedDate(Integer id)
throws FinderException;

I don't get the class cast exception, but I also don't get the data I
expect. I get null instead. The debugging output returned is:

CachedImageBean.ejbHomeGetModifiedDate() - key: 1
CachedImageBean.ejbHomeGetModifiedDate(): null

So, for pk_blob_id = 1, the returned value is null. Below, you will
see that I do have a modified date in they table for pk_blob_id = 1.

I reiterate that using a return type of java.util.Date did work in
Resin-ee-3.0.7 and versions prior to that. And ejbSelectModifiedData
did properly return datetime data.

Please let me know if there is anything I can do or information I can
provide to help resolve this issue.
Additional Information
Attached Files

- Relationships

- Notes
01-02-07 12:50


- Issue History
Date Modified Username Field Change
01-02-07 09:36 ferg New Issue
01-02-07 12:50 ferg Note Added: 0001690
01-02-07 12:50 ferg Assigned To  => ferg
01-02-07 12:50 ferg Status new => closed
01-02-07 12:50 ferg Resolution open => fixed
01-02-07 12:50 ferg Fixed in Version  => 3.0.23

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker