Author: rob.stryker(a)jboss.com
Date: 2012-04-19 17:26:15 -0400 (Thu, 19 Apr 2012)
New Revision: 40358
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java
trunk/jmx/plugins/org.jboss.tools.jmx.ui/src/org/jboss/tools/jmx/ui/internal/controls/AttributeControlFactory.java
Log:
JBIDE-11064 more fixes, better error message, etc
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java 2012-04-19
21:12:38 UTC (rev 40357)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java 2012-04-19
21:26:15 UTC (rev 40358)
@@ -19,13 +19,17 @@
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.ServerDelegate;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.server.IManagementPortProvider;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.jmx.integration.JMXUtil.CredentialException;
import org.jboss.tools.jmx.core.ExtensionManager;
import org.jboss.tools.jmx.core.IConnectionProvider;
+import org.jboss.tools.jmx.core.JMXException;
public class JBoss71ServerConnection extends JBossServerConnection {
public JBoss71ServerConnection(IServer server) {
@@ -62,12 +66,17 @@
MBeanServerConnection connection = connector.getMBeanServerConnection();
return connection;
} catch(IOException ioe) {
+ return null;
+ } catch( RuntimeException re) {
+ IStatus stat = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ "Runtime Exception contacting JBoss instance. Please ensure your server is up
and exposes its management ports via the -Djboss.bind.address.management=yourwebsite.com
system property", re);
+ throw new JMXException(stat);
+ } finally {
if( connector != null ) {
try {
connector.close();
} catch(Exception e) { /* Ignore */ }
}
- return null;
}
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java 2012-04-19
21:12:38 UTC (rev 40357)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java 2012-04-19
21:26:15 UTC (rev 40358)
@@ -51,7 +51,7 @@
this.server = server;
this.isConnected = false;
this.isLoading = false;
- checkState(); // prime the state
+ checkState(server); // prime the state
((AbstractJBossJMXConnectionProvider)getProvider()).addListener(this);
server.addServerListener(this);
}
@@ -138,9 +138,13 @@
if( connection != null ) {
r.run(connection);
}
+ } catch(JMXException jmxe) {
+ // rethrow
+ throw jmxe;
} catch( Exception e ) {
+ // wrap all others
throw new JMXException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- e.getMessage() == null ? e.getClass().getName() : e.getMessage(), e));
+ "Error connecting to remote JMX. Please ensure your server is properly
configured for JMX access.", e));
} finally {
getProvider2().getClassloaderRepository().removeConcerned(s, r);
Thread.currentThread().setContextClassLoader(currentLoader);
@@ -177,21 +181,15 @@
if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
// server change event
if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- new Job("Connecting to " + event.getServer().getName() + " via
JMX") { //$NON-NLS-1$ //$NON-NLS-2$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- checkState();
- return Status.OK_STATUS;
- }
- }.schedule();
+ checkState(event.getServer());
}
}
}
- protected void checkState() {
+ protected void checkState(IServer server) {
IDeployableServer jbs = ServerConverter.getDeployableServer(server);
if( server.getServerState() == IServer.STATE_STARTED && jbs != null &&
jbs.hasJMXProvider()) {
- connectToStartedServer();
+ launchConnectionJob(server);
} else {
root = null;
if( isConnected ) {
@@ -201,6 +199,16 @@
}
}
}
+
+ protected void launchConnectionJob(IServer server) {
+ new Job("Connecting to " + server.getName() + " via JMX") {
//$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ connectToStartedServer();
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
protected void connectToStartedServer() {
try {
Modified:
trunk/jmx/plugins/org.jboss.tools.jmx.ui/src/org/jboss/tools/jmx/ui/internal/controls/AttributeControlFactory.java
===================================================================
---
trunk/jmx/plugins/org.jboss.tools.jmx.ui/src/org/jboss/tools/jmx/ui/internal/controls/AttributeControlFactory.java 2012-04-19
21:12:38 UTC (rev 40357)
+++
trunk/jmx/plugins/org.jboss.tools.jmx.ui/src/org/jboss/tools/jmx/ui/internal/controls/AttributeControlFactory.java 2012-04-19
21:26:15 UTC (rev 40358)
@@ -94,6 +94,8 @@
}
public static Control createControl(final Composite parent, final Object value) {
+ if( value == null )
+ return null;
return createControl(parent, value, value.getClass().getSimpleName(),
null, null, false, null, null);
}
Show replies by date