There is reason to beieve that this problem is easy (http://jira.jboss.com/jira/browse/EJBTHREE-456), but I have searched the forum and can not find exactly the same situation.
The easiest way to reproduce it is to take the calcualtor.jsp from the EJB3Trail, and put it in a seperate war along with trail.slsb.Calculator.class. I then get
20:12:40,859 ERROR [STDERR] java.lang.ClassCastException: $Proxy136 20:12:48,437 ERROR [STDERR] at org.apache.jsp.calculator_jsp.jspInit(calculator_jsp.java:19) 20:12:48,437 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:78) 20:12:48,437 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:155)
InitialContext ctx = new InitialContext(); cal = (Calculator) ctx.lookup( "EJB3Trail/StatelessCalculator/local");
+- EJB3Trail (class: org.jnp.interfaces.NamingContext) ........ | +- StatelessCalculator (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy136 implements interface trail.slsb.Calculator,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
Well, I got there in the end. For the benefit of anyone else who has this problem:
The reason is that the classloader for the ejb interface was not the same as that of the ejb class. So:
remove the interface file from the war.
if, in the ear jboss-app.xml you have:
or something similar, remove it.
And you should be OK.