while calling look up from standard alone application, it will work fine | | InitialContext ctx = null; | Hashtable<String, String> props = new Hashtable<String, String>(); | | props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); | props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); | props.put("java.naming.provider.url", "jnp://localhost:1099"); | try { | ctx = new InitialContext(props); | CalculatorRemote calc = (CalculatorRemote) ctx.lookup("CalculatorBean/remote"); | System.out.println( "addition == " + calc .add( 10, 20 )); | | } catch (NamingException e) { | e.printStackTrace(); | } | |
but its not working from servlet getting java.lang.ClassCastException: $Proxy78 cannot be cast to stateless.CalculatorRemote at web.CalcServlet.init(CalculationServlet.java:36) | public void jspInit() { | try { | | InitialContext ic = new InitialContext(); | Object object = ic.lookup( "example/CalculatorBean/remote" ); | | CalculatorRemote calc = (CalculatorRemote)PortableRemoteObject.narrow( object , CalculatorBean.class); | | System.out.println("Loaded Calculator Bean"); | | } catch (Exception ex) { | e.printStackTrace (); | } | } | and i print the method and class name here Class Name === $Proxy78 Method === hashCode Method === equals Method === toString Method === add Method === subtract Method === multiply Method === division Method === getAsynchronousProxy Method === isProxyClass Method === getProxyClass Method === newProxyInstance Method === getInvocationHandler Method === getClass Method === wait Method === wait Method === wait Method === notify Method === notifyAll here i am getting the object of java.lang.reflect.Proxy why i am getting this object instead of CalculatorRemote ? any thing i want to set in jboss-4.2.2.GA sever ? thx for your replay View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263972#4263972 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263972 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user