4 Replies Latest reply on Apr 5, 2004 6:56 AM by gunzip

    EJB - java.lang.ClassCastException - newbie

    gunzip Newbie

      I develop the ejb and it deploys ok
      on it there is
      Bean class
      Remote class
      Home class
      ejb-jar.xml
      jboss.xml(all in an JAR)
      servlet(in an WAR)
      (it doesnt have manifests nor jndi.properties, because i dont know if they are necessary or how to make them)then I pack everything in an EAR, it deploys ok, the servelet works

      but the problem is that when it tries to

      javax.naming.InitialContext jndiContext = new javax.naming.InitialContext();
      System.out.println("Got context");
      java.lang.Object reference = jndiContext.lookup("helloejb/HelloEJB");
      System.out.println("Got reference");
      HelloHome helloejbhome;
      helloejbhome = (HelloHome) javax.rmi.PortableRemoteObject.narrow(reference, org.jboss.helloejb.HelloHome.class);


      it gives me an error on the last line(i receive the last two got messages but then error)
      java.lang.ClassCastException
      I'm made the ant set lib with jbossall-client.jar

      Im confused about EJB and Servlet integration, so I've put them ALL on the same folder and package, but still dont work

      my ejb-jar.xml
      <ejb-jar>
      JBoss Demo Application
      <display-name>EJB HelloWorld Demo</display-name>
      -
      <enterprise-beans>
      -
      <ejb-name>HelloEJB</ejb-name>
      org.jboss.dww.HelloHome
      org.jboss.helloejb.HelloRemote
      <ejb-class>org.jboss.helloejb.HelloBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>

      </enterprise-beans>
      </ejb-jar>

      jboss.xml

      <enterprise-beans>

      <ejb-name>HelloEJB</ejb-name>
      <jndi-name>helloejb/HelloEJB</jndi-name>

      </enterprise-beans>

      I'm using red hat 9, Jedit
      Anyone