[jboss-user] [EJB 3.0] - Re: java.lang.ClassCastException
tornadojava
do-not-reply at jboss.com
Fri Aug 25 05:51:32 EDT 2006
"tornadojava" wrote : MyAccount.class
| package test.four;
|
| import java.io.Serializable;
|
| public interface MyAccount extends Serializable{
| public int add(int i,int j) throws Exception;
| public int getResult() throws Exception;
| }
| MyAccountBean.class
| package test.four;
| import javax.ejb.Local;
| import javax.ejb.Stateful;
|
| import org.jboss.annotation.ejb.LocalBinding;
|
|
| @SuppressWarnings("serial")
| @Stateful
| @Local({MyAccount.class})
| @LocalBinding(jndiBinding="test/MyAccountBean")
| public class MyAccountBean implements MyAccount {
| private int add_falg=0;
| private int total_flag=0;
| public int add(int i, int j) throws Exception {
| this.add_falg=i+j;
| this.total_flag+=this.add_falg;
| return this.add_falg;
| }
|
| public int getResult() throws Exception{
| return this.total_flag;
| }
|
| }
| jsp client
| <%@ page contentType="text/html; charset=iso"%>
| <%@ page import="test.four.MyAccount,javax.naming.*"%>
| <%
| Properties props = new Properties();
| props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.setProperty("java.naming.provider.url", "localhost:1099");
| props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
|
| InitialContext ctx = new InitialContext(props);
| try {
| MyAccount A = ctx.lookup("test/MyAccountBean");
| out.println("A.Add() Result is?"+ A.add(1,1));
| out.println("A.getResult() result is?"+ A.getResult());
| } catch (Exception e) {
| e.printStackTrace();
| out.println(e.getMessage());
| }
| %>
|
| code end
|
| when I visit website http://localhst:8080/test/four.jsp,java.lang.ClassCastException was threw.
| this exception detail:
| java.lang.ClassCastException: $Proxy157
| 17:33:13,447 ERROR [STDERR] at org.apache.jsp.four_jsp._jspService(four_jsp.java:69)
| 17:33:13,447 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| 17:33:13,447 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 17:33:13,447 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
| 17:33:13,457 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| 17:33:13,457 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| 17:33:13,457 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 17:33:13,457 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| 17:33:13,457 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| 17:33:13,457 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| 17:33:13,457 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| 17:33:13,457 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| 17:33:13,457 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| 17:33:13,457 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| 17:33:13,457 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| 17:33:13,457 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
|
|
| pls help me
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967435#3967435
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967435
More information about the jboss-user
mailing list