0 Replies Latest reply on Feb 6, 2007 8:29 AM by Patrick Krämer

    EJB 3 TrailBlazer Demo Class Cast

    Patrick Krämer Newbie

      Well I know that there are several Threads about the ClassCast Problem, but nothing helped me realy - except looking that I did not have these errors.

      So, I use JBoss 4.04 and started with the TrailBlazer Demo about StatelessSessionBeans.

      I can start the JSP but I got a ClassCastException during it.

      I have deployed it to TrailBalzerApplication.ear which contains:


      The application.xml:
      <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
       <module id="myeclipse.1170763402122">
       <module id="myeclipse.1170763401891">

      The jboss-app.xml

      <?xml version="1.0" encoding="UTF-8"?>

      The SessionBean
      package trail.slsb;
      import org.jboss.annotation.ejb.LocalBinding;
      import javax.ejb.*;
      @LocalBinding (jndiBinding="EJB3TrailBlazer/slsb/Calculator")
      public class StatelessCalculator implements Calculator {
       public double calculate (int start, int end, double growthrate, double saving) {
       double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
       return saving * 12. * (tmp - 1) / growthrate;

      Part of the jsp:
       <%@ page import="trail.slsb.*, javax.naming.*, java.text.*"%>
       private Calculator cal = null;
       public void jspInit () {
       try {
       InitialContext ctx = new InitialContext();
       cal = (Calculator) ctx.lookup(
       } catch (Exception e) {
       e.printStackTrace ();

      There are no errors during deployment

      Can anybody please help me?