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 t_jsp.java:28)
ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJsp Base.java:51)
ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getSer vlet(JspServletWrapper.java:158)
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 ?