Vamsi,
Seems like this needs to be merged into 2.2 and trunk -- wanted to be sure that 
you're planning on doing this...

--kevan
On Jan 5, 2011, at 1:17 AM, vamsic...@apache.org wrote:

> 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);
>     }
> 
> 

Reply via email to