[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - list all active HTTP-Sessions

thomas78 do-not-reply at jboss.com
Wed Sep 20 09:58:05 EDT 2006


Hi,

I tried to view all acitve HTTP-Sessions. but I get an very strange error:
here is the code i used:

MBeanServer server = MBeanServerLocator.locateJBoss();
  | ObjectName oname = new ObjectName("jboss.web:type=Manager,path=/,host=localhost");
  | 
  |      String sessionids = (String)server.invoke(oname, "listSessionIds", new Object[] {}, new String[] {});
  |       StringTokenizer strtok = new StringTokenizer(sessionids, " ");
  | 
  | 
  |       String description = ""; 
  |       String sessionid = "";
  |       while (strtok.hasMoreTokens()){
  |         sessionid = strtok.nextToken();
  |         String name = "pa_bean";
  |         description += "ID: " + sessionid;
  |         description += ", last accessed: " + server.invoke(oname, "getLastAccessedTime", new Object[] {sessionid.trim()}, new String[] {"java.lang.String"}).toString();
  |         String param[] = {sessionid, name};
  |         String signature[] = {"java.lang.String", "java.lang.String"};
  |         PA_Bean pa_bean = (PA_Bean)server.invoke(oname, "getSessionAttribute", param, signature);
  |         description += ", pa_bean: " + pa_bean;
  |      }
  |       logger.debug("desc: " + description);
  |     }catch (Exception ex){logger.fatal(ex.getMessage(), ex);}

the get last accessed time is working fine. just the getSessionAttribute results in the folllowing error:

java.lang.ClassCastException: java.lang.String
  | 	at com.sonydadc.securom.pa.server.PA_Bean.getSessionlist(PA_Bean.java:1897)
  | 	at com.sonydadc.securom.pa.server.servlet.SecuROM_portal.executeListSessionsRequest(SecuROM_portal.java:916)
  | 	at com.sonydadc.securom.pa.server.servlet.SecuROM_portal.doIt(SecuROM_portal.java:983)
  | 	at com.sonydadc.securom.pa.server.servlet.SecuROM_portal.doGet(SecuROM_portal.java:1049)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
  | 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
  | 	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
  | 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
  | 	at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:81)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
  | 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:177)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
  | 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
  | 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
  | 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
  | 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
  | 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
  | 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  | 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
  | 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
  | 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
  | 	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
  | 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
  | 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
  | 	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
  | 	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
  | 	at java.lang.Thread.run(Thread.java:595)


the error occurs exactly in the line, where I invoke the getSessionAttribute.

can anyone help me with this problem?


best regards,


Thomas

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

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



More information about the jboss-user mailing list