R
Ranger
I have a scenario where I need to invoke methods on the object
implementing HttpSession retrieved by getSession(). When I use
ServletExec and run my code, it works fine. When I deploy this same
code on WebLogic, I get an IllegalAccessException with no detailed
information (the message is null).
See the following code:
HttpSession session = request.getSession();
Method method = session.getClass().getMethod("getId", new Class[] {
});
String id = (String)method.invoke(session, new Object[] { });
out.println("Session id is: "+id);
The error when executing this on a WebLogic server:
java.lang.IllegalAccessException
at java.lang.reflect.Method.invoke(Native Method)
at TestServlet.doGet(TestServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
implementing HttpSession retrieved by getSession(). When I use
ServletExec and run my code, it works fine. When I deploy this same
code on WebLogic, I get an IllegalAccessException with no detailed
information (the message is null).
See the following code:
HttpSession session = request.getSession();
Method method = session.getClass().getMethod("getId", new Class[] {
});
String id = (String)method.invoke(session, new Object[] { });
out.println("Session id is: "+id);
The error when executing this on a WebLogic server:
java.lang.IllegalAccessException
at java.lang.reflect.Method.invoke(Native Method)
at TestServlet.doGet(TestServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)