problem in ejb3 while running on jboss-4.2


EJB programming & troubleshooting: problem in ejb3 while running on jboss-4.2

  1. problem in ejb3 while running on jboss-4.2 (1 messages)

    hi, I am new to eb3 and i am having following problem when running stateful application. I am having EJB 3 stateful application. Code is shown below try { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.namingrg.jnp.interfaces"); props.put(Context.PROVIDER_URL, "jnp://localhost:1099"); InitialContext ic = new InitialContext(props); //InitialContext ic = new InitialContext(); System.out.println("JSP INIT Befor lookup============="); //Object obj = (Object) ic.lookup("StatefulCode/AccountBean/remote"); account = (AccountRemote) ic.lookup("StatefulCode_1/AccountBean/remote"); //account = (AccountRemote)javax.rmi.PortableRemoteObject.narr ow(obj,AccountBean.class); System.out.println("JSP INIT After lookup============="); //System.out.println("JSP INIT After lookup test============="+obj.getClass().getName()); System.out.println("Loaded Account Bean"); } catch (Exception ex) { ex.printStackTrace(); } When I run the application, I am facing java.lang.ClassCastException: $Proxy72 ERROR [STDERR] at org.apache.jsp.ejb3.WebClient_jsp.jspInit(WebClien ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJsp ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getSer vlet( In JBoss, in Global JNDI Namespace it is showing +- StatefulCode_1 (class: org.jnp.interfaces.NamingContext) | +- AccountBean (class: org.jnp.interfaces.NamingContext) | | +- remote (class: java.lang.Object) | | +- remoteStatefulProxyFactory (proxy: $Proxy73 implements interface org.jboss.ejb3.ProxyFactory) I was not able to solve. Can anyone suggest what can be the possible remedy for this ?
  2. Hi, I'm experiencing the same problems when attempting to access a Stateful bean (EJB 3) from a JSP test client. I'm able to access Stateless beans without any problems but always receive ClassCastExceptions when casting the result of the initialcontext lookup. Again I'm using JBoss 4.2. Did you manage to resolve this issue? Many thanks Alistair