geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r1058001 - /geronimo/server/branches/2.2/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
Date Wed, 12 Jan 2011 07:15:20 GMT
Author: vamsic007
Date: Wed Jan 12 07:15:19 2011
New Revision: 1058001

URL: http://svn.apache.org/viewvc?rev=1058001&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.
 o Merging rev 1055305 from 2.1 branch.

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

Modified: geronimo/server/branches/2.2/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java?rev=1058001&r1=1058000&r2=1058001&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
(original)
+++ geronimo/server/branches/2.2/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
Wed Jan 12 07:15:19 2011
@@ -89,12 +89,17 @@ 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.monitoring/agent-ds/JCAManagedConnectionFactory/jdbc/ActiveDS");
             archiveDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins.monitoring/agent-ds/JCAManagedConnectionFactory/jdbc/ArchiveDS");
         } catch(Exception e) {
             log.error(e.getMessage());
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
         }
         snapshotDBHelper = new SnapshotDBHelper(activeDS, archiveDS);
     }



Mime
View raw message