[jboss-user] [JNDI/Naming/Network] - ClassCastException after redeploy

ahachmann do-not-reply at jboss.com
Wed Oct 11 09:30:43 EDT 2006


Hi there,
I am quiet frustrated with having a strange behavior I do not understand.

I have an EAR Application containing an EJB and a WAR.
In the EJB I have a small HelloWorld Class being remote and local.

I Call this class from the Servlet in the War. Which works perfectly fine.

Now when I change the Code in the HelloWorld Class (simply changing the returned text) and redeploy this EAR, I get a ClassCastException when calling this Object. 

When I hav the WAR deployed itself in a different ctxPath, that servlet keeps working fine.

My Bean:

  | @Stateless
  | @Local(MyDAO.class)
  | @LocalBinding(jndiBinding="EpgData/LocalDao")
  | @Remote(MyDAO.class)
  | @RemoteBinding(jndiBinding="EpgData/RemoteDao")
  | public class MyDAOImpl implements MyDAO {
  | 
  | 	public String getObject() {
  | 		// TODO Auto-generated method stub
  | 		return "Hi There?! Someone";
  | 	}
  | 
  | }
  | 

my servlet:

  | 	public void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
  | 		arg1.setContentType("text/html");
  | 		PrintWriter out = arg1.getWriter();
  | 		Context ctx;
  | 		try {
  | 			ctx = new InitialContext();
  | 			out.println("2----------------------------------------------------------------<br>");
  | 			Object o;
  | 			try {
  | 				o = ctx.lookup("EpgData/LocalDao");
  | 				MyDAO hello = (MyDAO)o;
  | 				out.println(hello.getObject());
  | 			} catch (NamingException e) {
  | 				// TODO Auto-generated catch block
  | 				out.println("Second: "+e);
  | 			}catch (ClassCastException e){
  | 				e.printStackTrace(out);
  | 				out.println(reflect(ctx.lookup("LOVE")));
  | 			}
  | 			
  | 		} catch (NamingException e) {
  | 			// TODO Auto-generated catch block
  | 			out.println("Outer: "+e);
  | 		}
  | 	}
  | 
  | 

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

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



More information about the jboss-user mailing list