geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r1055305 - /geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
Date Wed, 05 Jan 2011 06:17:00 GMT
Author: vamsic007
Date: Wed Jan  5 06:17:00 2011
New Revision: 1055305

URL: http://svn.apache.org/viewvc?rev=1055305&view=rev
Log:
GERONIMO-5355 ClassCastException while starting snapshot (Stat Query) in Monitoring portlet
through java client
 o Exception is due to a different thread context classloader at play when the method is invoked
through RMI as opposed to invocation through admin console. Fixed by changing the context
classloader for the lookups.

Modified:
    geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java

Modified: geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java?rev=1055305&r1=1055304&r2=1055305&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
(original)
+++ geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
Wed Jan  5 06:17:00 2011
@@ -95,7 +95,10 @@ public class MasterRemoteControlJMX impl
        
         // set up SnaphotDBHelper with the necessary data sources
         // Note: do not put this in the constructor...datasources are not injected by then
+        ClassLoader oldCl = null;
         try {
+            oldCl = Thread.currentThread().getContextClassLoader();
+            Thread.currentThread().setContextClassLoader(MasterRemoteControlJMX.class.getClassLoader());
             InitialContext ic = new InitialContext();
             activeDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ActiveDS");
             archiveDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ArchiveDS");
@@ -104,6 +107,8 @@ public class MasterRemoteControlJMX impl
         } catch(Exception e) {
             log.error(e.getMessage());
             e.printStackTrace();
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
         }
         snapshotDBHelper = new SnapshotDBHelper(activeDS, archiveDS);
     }



Mime
View raw message