You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Kevan Miller <ke...@gmail.com> on 2011/01/06 15:58:01 UTC

Re: svn commit: r1055305 - /geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java

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, vamsic007@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);
>     }
> 
> 


Re: svn commit: r1055305 - /geronimo/server/branches/2.1/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Yes. I will update the JIRA fix versions to include 2.2.x and 3.0.

On Thu, Jan 6, 2011 at 8:28 PM, Kevan Miller <ke...@gmail.com> wrote:

> 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, vamsic007@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);
> >     }
> >
> >
>
>


-- 
Vamsi