Hello all,
I have a BMP
ejb with a findAll method returning a collection. I have put in a
test code in this EJB which displays the object type in the collection.
---------------------------------------in EJB----------------------------------------------------------------
Collection result; //this is the return value from findAll
Iterator itr = result.iterator();
Vector v;
while (itr.hasNext() ) {
Object o = itr.next();
System.out.println("class is =" + o.getClass().getName()); //prints java.util.Vector
v = (Vector) o;
}
--------------------------------------------------------------------------------------------------------------------
The object type is Vector , so everything is fine in the ejb.
The client to this ejb is a session EJB which contains the following code snippet.
----------------------------------------client session EJB------------------------------------------------
ctx = new InitialContext();
exphome = (ExpenseHome) ctx.lookup("ejb/Expense");
Collection result = exphome.findByAll(........)
Iterator itr = result.iterator();
Vector v;
Object o;
while (itr.hasNext() ) {
o = itr.next();
System.out.println("class is =" + o.getClass().getName()); //prints $Proxy87 ???
v = (Vector) o;
}
----------------------------------------------------------------------------------------------------------------------------------------------
I don't have any clue why i get this proxy problem?..Can anyone help me out please..First I thought that there was mismatch of stubs, but the problem exists even after installing the application completely.
This is the complete stacktrace.
---------------------------------------------------------------------------------------------------------------------
java.lang.ClassCastException: $Proxy87
at project.expense.servlet.SearchExpResult.doGet(SearchExpResult.java:60
)
at project.expense.servlet.SearchExpResult.doPost(SearchExpResult.java:1
04)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112
)
at jsp_servlet.__searchexpform._jspService(__searchexpform.java:193)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
-----------------------------------------------------------------------------------------------------------------------------
TIA