You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/10/15 09:02:19 UTC

svn commit: r825414 - in /geronimo/sandbox/djencks/osgi/framework: configs/karaf-framework/pom.xml modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java

Author: djencks
Date: Thu Oct 15 07:02:19 2009
New Revision: 825414

URL: http://svn.apache.org/viewvc?rev=825414&view=rev
Log:
fix felix jar version, make xbean-naming classes accessible to jmx remoting.  JMXConnector still wont start

Modified:
    geronimo/sandbox/djencks/osgi/framework/configs/karaf-framework/pom.xml
    geronimo/sandbox/djencks/osgi/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java

Modified: geronimo/sandbox/djencks/osgi/framework/configs/karaf-framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/configs/karaf-framework/pom.xml?rev=825414&r1=825413&r2=825414&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/configs/karaf-framework/pom.xml (original)
+++ geronimo/sandbox/djencks/osgi/framework/configs/karaf-framework/pom.xml Thu Oct 15 07:02:19 2009
@@ -43,7 +43,7 @@
         <felix.bundlerepository.version>1.4.0</felix.bundlerepository.version>
         <felix.compendium.version>1.2.0</felix.compendium.version>
         <felix.configadmin.version>1.2.4</felix.configadmin.version>
-        <felix.fileinstall.version>2.0.0</felix.fileinstall.version>
+        <felix.fileinstall.version>2.0.1-SNAPSHOT</felix.fileinstall.version>
         <felix.framework.version>2.0.0</felix.framework.version>
         <felix.gogo.version>0.2.0</felix.gogo.version>
         <felix.osgi.version>1.4.0</felix.osgi.version>

Modified: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java?rev=825414&r1=825413&r2=825414&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java (original)
+++ geronimo/sandbox/djencks/osgi/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java Thu Oct 15 07:02:19 2009
@@ -67,7 +67,7 @@
      * able to load all the LoginModules used in the JAAS login
      *
      * @param mbeanServer the mbean server
-     * @param objectName this connector's object name
+     * @param objectName  this connector's object name
      * @param classLoader the classLoader used to create this connector
      */
     public JMXConnector(MBeanServer mbeanServer, String objectName, ClassLoader classLoader) {
@@ -110,6 +110,7 @@
 
     /**
      * Gets the protocol to use for the connection.
+     *
      * @return the protocol to use for the connection
      */
     public String getProtocol() {
@@ -118,6 +119,7 @@
 
     /**
      * Sets the protocol to use for the connection.
+     *
      * @param protocol the protocol to use for the connection
      */
     public void setProtocol(String protocol) {
@@ -135,6 +137,7 @@
 
     /**
      * Sets the JMX host for this connector.
+     *
      * @param host the JMX host for this connector
      */
     public void setHost(String host) {
@@ -152,6 +155,7 @@
 
     /**
      * Sets the JMX port for this connector.
+     *
      * @param port the JMX port for this connector
      */
     public void setPort(int port) {
@@ -161,6 +165,7 @@
     /**
      * Gets the path within the target server to look for the connection.  This is commonly
      * /jndi/rmi://localhost:1099/JMXConnector
+     *
      * @return the path used to loacate the connector on the target server
      */
     public String getUrlPath() {
@@ -170,6 +175,7 @@
     /**
      * Sets the path within the target server to look for the connection.  This is commonly
      * /jndi/rmi://localhost:1099/JMXConnector
+     *
      * @param urlPath the path used to loacate the connector on the target server
      */
     public void setUrlPath(String urlPath) {
@@ -179,7 +185,7 @@
     public void doStart() throws Exception {
         jmxServiceURL = new JMXServiceURL(protocol, host, port, urlPath);
         Authenticator authenticator = null;
-        Map env = new HashMap();
+        Map<String, Object> env = new HashMap<String, Object>();
         if (applicationConfigName != null) {
             authenticator = new Authenticator(applicationConfigName, classLoader);
             env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
@@ -194,21 +200,27 @@
         filter.enableType(JMXConnectionNotification.CLOSED);
         filter.enableType(JMXConnectionNotification.FAILED);
         server.addNotificationListener(authenticator, filter, null);
-        server.start();
+        ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(classLoader);
+        try {
+            server.start();
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
+        }
         log.debug("Started JMXConnector " + server.getAddress());
     }
 
     public void doStop() throws Exception {
         try {
-              server.stop();
+            server.stop();
         } catch (IOException e) {
-              // java.io.IOException is expected.
+            // java.io.IOException is expected.
         } catch (Exception e) {
-              // Otherwise, something bad happened.  Rethrow the exception.
-              throw e;
+            // Otherwise, something bad happened.  Rethrow the exception.
+            throw e;
         } finally {
-          server = null;
-          log.debug("Stopped JMXConnector " + jmxServiceURL);
+            server = null;
+            log.debug("Stopped JMXConnector " + jmxServiceURL);
         }
     }
 
@@ -236,7 +248,7 @@
         infoFactory.addAttribute("applicationConfigName", String.class, true, true);
 
         infoFactory.addInterface(JMXConnectorInfo.class);
-        
+
         infoFactory.setConstructor(new String[]{"MBeanServerReference", "objectName", "classLoader"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }