I am getting an Object from session and typecasting to some User Object. Lets say like this:
A a =(A)session.getAttribute("A"); //Class Cast Exception
Background: I am going to jsp from a normal java class by requestDispatch.forward(request,response) In Java, If I do the same casting , it works fine , but in JSP(scripplet:I know a bad coding but its a legacy application, cant help it), Its not working
Analysis:
The Object which I am getting from session in jsp, doesn't pass isInstanceOf test ( its also a worry) ( But it pass this test in java )
If I do class equal comparision, it also fails ( But it pass this test in java )
So I checked the classloader instance for Class A in java as well as in JSP, And I see both are different instances.
So my question is how do I make sure that class loader instance will be same? Or am I analysing properly? What else shold I check more? Any hit n trail u can suggest for same?
P.S> 1.I am using weblogic 10.3.6 2. I am deploying as a single war ( so no question on modifying weblogic-application.xml for class loading hierarchy.) 3. Its a simple java-servlet-jsp legacy application, so I have no liberty of using anymvc framework 4. I have already marked my DTOs as Serializable with serialveruuid 5. It works fine in first go. But second go onwards, it starts failing