JBoss-2.4.4_Tomcat-4.0.1 ClassCastException Problem
fmorton Jan 7, 2002 11:26 PMAnyone really have this running? I've been beating my head against the wall for three days now trying to get this going. Would have done something a long time ago if I didn't have to have servlet 2.3.....but I digress.
I've gotten this running with help from other posts in this forum, but now I'm stumped. I have a stateless session bean that has a method that returns a "com.base2inc.bean.value.object.ProfileValueObject" object. I am certain that the object is really such a thing because I did a o.getClass().getName(), which returns the right class name. I also wrote a test application that uses the bean, which works fine.
However, when I make the same call from a servlet, it looks to me like the proxy is messed up or something because I get a ClassCastException.
Does anyone have a clue what to do about this? The other strangeness with JBoss-2.4.4_Tomcat-4.0.1 I have been able to code around, but there is only one way to do a return from a method with an object of a certain type.
I'm stuck and will try any suggestions.
The code for the method in question is:
public ProfileValueObject getByProfileHandle(String profileHandle) throws FinderException,RemoteException,NamingException {
ValueList list = get("profileHandle='"+String.valueOf(profileHandle)+"'",0);
if(list.size() == 0) return(null);
ProfileValueObject profileValueObject = (ProfileValueObject)(list.get(0));
// exception from the return statement...makes it to here just fine
return(profileValueObject);
}
The exception caused by the return statement:
[ERROR,EmbeddedCatalinaServiceSX] StandardWrapperValve[invoker]: Servlet.service() for servlet invoker threw exception
java.lang.ClassCastException: com.base2inc.bean.value.object.ProfileValueObject
at $Proxy16.getByProfileHandle(Unknown Source)
at com.base2inc.app.util.ServletEnvironment.authenticate(ServletEnvironment.java:596)
at com.base2inc.app.framework.JspFramework.authenticate(JspFramework.java:212)
at com.base2inc.app.framework.JspFramework.doService(JspFramework.java:76)
at com.base2inc.app.util.HttpServletExtended.doPost(HttpServletExtended.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
[SNIP]