[jboss-user] [EJB 3.0] - Re: can not lookup session bean under Jboss 4.2.2GA and ejb3

yanlong11 do-not-reply at jboss.com
Wed Jan 16 08:16:35 EST 2008


:( I must be doing something wrong.

I even made very base interface (Calculator.java) like in the example but I am always getting the same error. Class Cast Exception.


please give me a hint what I am doing wrong. below all important code. (I had rather included it.)

thanks in advance

//baseBean.java
package beans;

public interface baseBean {
    public String hello();
}

//baseRemote.java
package beans;

import javax.ejb.Remote;
@Remote
public interface baseRemote extends baseBean{
    //public String hello();
}

//testBean
package beans;
import javax.ejb.Stateless;
@Stateless(name = "testBean")
public class testBean implements baseRemote {
    public testBean() {
    }

    public String hello() {
        return "Hello from bean";
    }
}

//index.jsp

  <%
      InitialContext ctx = new InitialContext();
      try {
          Object obj = ctx.lookup("testBean/remote");
          //baseRemote testRemote = (baseRemote) PortableRemoteObject.narrow(obj, baseRemote.class);
          baseBean bean = (baseBean)obj;
          out.print(bean.hello());
          //out.print(testRemote.hello());
      } catch (Exception e) {
         e.printStackTrace();
      }
  %>
  


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120440#4120440

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120440



More information about the jboss-user mailing list