1 Reply Latest reply on May 16, 2002 11:38 AM by bjs_pd

    class cast problem

    smcmor

      I am new to programming ejbs and was hoping for some help.
      I have written an ejb that is being called from jsp code. There is a declaration of a class called Searchable(externally written class) in the jsp code. the jsp invokes a method from the ejb and returns an instance of Searchable to the jsp.

      Eg
      Jsp code
      Searchable se=null;
      se = bean.getActiveSearchable(); //ejb method

      Ejb code function
      private Searchable active_searchable = null; //declared outside the function
      public Searchable getActiveSearchable()
      {
      return active_searchable;
      }

      I have a jar file that the ejb and the jsp code uses called search.jar
      It is placed in the
      deploy/search.war/web-inf/lib folder
      lib/ext

      The error i get back is

      [ERROR,Default] java.lang.ClassCastException: Searchable
      [ERROR,Default] at $Proxy5.getActiveSearchable(Unknown Source)
      [ERROR,Default]
      [ERROR,Default] at org.apache.jsp.processSearch$jsp._jspService(processS
      earch$jsp.java:108)
      [ERROR,Default]
      [ERROR,Default] at org.apache.jasper.runtime.HttpJspBase.service(HttpJsp

      I also tried changing about the location of the jar files and I get a different error Class Searhable violates loader contraints.

      If anyone could help it would be great.

        • 1. Re: class cast problem
          bjs_pd

          Hi!

          What exacly is your bean.getActive... doing. If there is an jndi-lookup inside notice that you have to cast at the Home-Interface of the bean not the Object-Interface!

          CU
          BJ