[jboss-user] [JNDI/Naming/Network] - java.lang.ClassCastException: $Proxy78 cannot be cast to com

areyyyyy do-not-reply at jboss.com
Sun Apr 12 09:24:06 EDT 2009


Hi,
   I got the following error when i tried to lookup on statefull session bean.

java.lang.ClassCastException: $Proxy78 cannot be cast to com.vs.uhome.model.session.LoginSession
	com.vs.uhome.model.util.PropertyUtil.getLoginSession(PropertyUtil.java:239)
	com.vs.uhome.view.serv.mainServ.onLogin(mainServ.java:101)
	com.vs.uhome.view.serv.mainServ.doPost(mainServ.java:79)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

Here i m giving statefull session bean

@Stateful(name = "uhomeSession")
public class LoginSessionBean implements LoginSession {
	@PersistenceContext(unitName = "Model")
	private EntityManager em;
	private PropertyLogger pl;
	private Ruser sessionUser;
	private FinderMethods fm;

public void logon(String userEmail, String password, boolean encrypted)
			throws UnknownException, WarningException {
		pl.write("Entered logon(String, String, boolean)", 1,
				"DefaultSessionBean", "logon");
		if ((userEmail == null) || userEmail.matches("^\\s*$")) {
			throw new WarningException(new CatalogHelper("UHOME_002002", 1,
					"DefaultSession", "logon"));
		}
		if (password == null) {
			password = "";
		}
		if (encrypted) {
			logon(userEmail, password);
		} else {
			String ecPasswd = PropertyUtil.encodeStr(password + userEmail);
			logon(userEmail, ecPasswd);
		}
		pl.write("Leaving logon(String, String, boolean)", 1,
		
}
}


And i m doing lookup like this


public static LoginSession getLoginSession() throws UnknownException, WarningException {
        LoginSession ls;
        Context ctx;
        try {
            ctx = getInitialContext();
        } catch (WarningException we) {
            throw we;
        } catch (NamingException ne) {
            throw new UnknownException (new CatalogHelper("UHOME_900035", ne.getMessage(), ne, "PropertyUtil", "getLoginSession"));
        }
        try {
            ls = (LoginSession)ctx.lookup("uhomeSession/remote");
            return ls;
        } catch (NamingException ne) {
            throw new UnknownException (new CatalogHelper("UHOME_900036", new Object[]{"LoginSession", ne.getMessage()}, ne, "PropertyUtil", "getLoginSession"));
        }
    }



and i got the JNDI view like this 
+- uhomeSession (class: org.jnp.interfaces.NamingContext)
  |   +- remote (class: java.lang.Object)
  |   +- remoteStatefulProxyFactory (proxy: $Proxy79 implements interface org.jboss.ejb3.ProxyFactory)
  
Can you please tell what is the problem. How to resolve this problem?
Thanks in advance!

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

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



More information about the jboss-user mailing list