8173607: JMX RMI connector should be in its own module

The JMX RMI connector is moved to a new java.management.rmi module.

Reviewed-by: mchung, erikj
This commit is contained in:
Daniel Fuchs 2017-02-02 16:50:46 +00:00
parent 00a5fb9183
commit 9f9a6ec666
91 changed files with 501 additions and 196 deletions

View File

@ -39,8 +39,8 @@ JMX_RMI_CLASSES := javax.management.remote.rmi.RMIConnectionImpl \
# into the stub classes dir.
$(eval $(call SetupRMICompilation,RMI_GEN, \
CLASSES := $(JMX_RMI_CLASSES), \
CLASSES_DIR := $(CLASSES_DIR)/java.management, \
STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
CLASSES_DIR := $(CLASSES_DIR)/java.management.rmi, \
STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management.rmi, \
RUN_V12 := true, \
KEEP_GENERATED := true, \
))

View File

@ -150,7 +150,7 @@ module java.base {
java.desktop;
exports jdk.internal.module to
java.instrument,
java.management,
java.management.rmi,
jdk.jartool,
jdk.jlink;
exports jdk.internal.misc to
@ -235,6 +235,7 @@ module java.base {
java.desktop,
java.datatransfer,
java.management,
java.management.rmi,
java.rmi,
java.sql.rowset,
java.xml,

View File

@ -23,7 +23,7 @@
* questions.
*/
package com.sun.jmx.remote.internal;
package com.sun.jmx.remote.internal.rmi;
import java.io.IOException;
import java.io.ObjectInput;

View File

@ -23,7 +23,7 @@
* questions.
*/
package com.sun.jmx.remote.internal;
package com.sun.jmx.remote.internal.rmi;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;

View File

@ -23,7 +23,7 @@
* questions.
*/
package com.sun.jmx.remote.internal;
package com.sun.jmx.remote.internal.rmi;
import java.io.IOException;
import java.rmi.MarshalledObject;

View File

@ -48,7 +48,7 @@ import javax.management.remote.NotificationResult;
import javax.security.auth.Subject;
import sun.reflect.misc.ReflectUtil;
import static com.sun.jmx.mbeanserver.Util.cast;
import static javax.management.remote.rmi.RMIConnector.Util.cast;
import com.sun.jmx.remote.internal.ServerCommunicatorAdmin;
import com.sun.jmx.remote.internal.ServerNotifForwarder;
import com.sun.jmx.remote.security.JMXSubjectDomainCombiner;

View File

@ -25,11 +25,10 @@
package javax.management.remote.rmi;
import com.sun.jmx.mbeanserver.Util;
import com.sun.jmx.remote.internal.ClientCommunicatorAdmin;
import com.sun.jmx.remote.internal.ClientListenerInfo;
import com.sun.jmx.remote.internal.ClientNotifForwarder;
import com.sun.jmx.remote.internal.ProxyRef;
import com.sun.jmx.remote.internal.rmi.ProxyRef;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import java.io.ByteArrayInputStream;
@ -106,6 +105,7 @@ import jdk.internal.module.Modules;
import sun.reflect.misc.ReflectUtil;
import sun.rmi.server.UnicastRef2;
import sun.rmi.transport.LiveRef;
import java.io.NotSerializableException;
/**
* <p>A connection to a remote RMI connector. Usually, such
@ -124,6 +124,24 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
private static final long serialVersionUID = 817323035842634473L;
static final class Util {
private Util() {}
/* This method can be used by code that is deliberately violating the
* allowed checked casts. Rather than marking the whole method containing
* the code with @SuppressWarnings, you can use a call to this method for
* the exact place where you need to escape the constraints. Typically
* you will "import static" this method and then write either
* X x = cast(y);
* or, if that doesn't work (e.g. X is a type variable)
* Util.<X>cast(y);
*/
@SuppressWarnings("unchecked")
public static <T> T cast(Object x) {
return (T) x;
}
}
private RMIConnector(RMIServer rmiServer, JMXServiceURL address,
Map<String, ?> environment) {
if (rmiServer == null && address == null) throw new
@ -1390,7 +1408,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
throws ClassNotFoundException, IOException {
// specially treating for an UnmarshalException
if (ioe instanceof UnmarshalException) {
throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
NotSerializableException nse = new NotSerializableException();
nse.initCause(ioe);
throw nse; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
// fetch one by one with UnmarshalException
}
@ -1935,12 +1955,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
The byte code below encodes the following class, compiled using
J2SE 1.4.2 with the -g:none option.
package com.sun.jmx.remote.internal;
package jdk.jmx.remote.internal.rmi;
import java.lang.reflect.Method;
import java.rmi.Remote;
import java.rmi.server.RemoteRef;
import com.sun.jmx.remote.internal.ProxyRef;
import com.sun.jmx.remote.internal.rmi.ProxyRef;
public class PRef extends ProxyRef {
public PRef(RemoteRef ref) {
@ -1962,22 +1982,22 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
RMIConnection.class.getName() + "Impl_Stub";
private static final Class<?> rmiConnectionImplStubClass;
private static final String pRefClassName =
"jdk.jmx.remote.internal.PRef";
"jdk.jmx.remote.internal.rmi.PRef";
private static final Constructor<?> proxyRefConstructor;
static {
final String pRefByteCodeString =
"\312\376\272\276\0\0\0\60\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17"+
"\312\376\272\276\0\0\0\65\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17"+
"\0\20\7\0\21\7\0\22\1\0\6<init>\1\0\36(Ljava/rmi/server/Remote"+
"Ref;)V\1\0\4Code\1\0\6invoke\1\0S(Ljava/rmi/Remote;Ljava/lang/"+
"reflect/Method;[Ljava/lang/Object;J)Ljava/lang/Object;\1\0\12E"+
"xceptions\7\0\23\14\0\6\0\7\14\0\24\0\25\7\0\26\14\0\11\0\12\1"+
"\0\34jdk/jmx/remote/internal/PRef\1\0$com/sun/jmx/remote/inter"+
"nal/ProxyRef\1\0\23java/lang/Exception\1\0\3ref\1\0\33Ljava/rm"+
"i/server/RemoteRef;\1\0\31java/rmi/server/RemoteRef\0!\0\4\0\5"+
"\0\0\0\0\0\2\0\1\0\6\0\7\0\1\0\10\0\0\0\22\0\2\0\2\0\0\0\6*+\267"+
"\0\1\261\0\0\0\0\0\1\0\11\0\12\0\2\0\10\0\0\0\33\0\6\0\6\0\0\0"+
"\17*\264\0\2+,-\26\4\271\0\3\6\0\260\0\0\0\0\0\13\0\0\0\4\0\1\0"+
"\14\0\0";
"\0 jdk/jmx/remote/internal/rmi/PRef\1\0(com/sun/jmx/remote/int"+
"ernal/rmi/ProxyRef\1\0\23java/lang/Exception\1\0\3ref\1\0\33Lj"+
"ava/rmi/server/RemoteRef;\1\0\31java/rmi/server/RemoteRef\0!\0"+
"\4\0\5\0\0\0\0\0\2\0\1\0\6\0\7\0\1\0\10\0\0\0\22\0\2\0\2\0\0\0"+
"\6*+\267\0\1\261\0\0\0\0\0\1\0\11\0\12\0\2\0\10\0\0\0\33\0\6\0"+
"\6\0\0\0\17*\264\0\2+,-\26\4\271\0\3\6\0\260\0\0\0\0\0\13\0\0\0"+
"\4\0\1\0\14\0\0";
final byte[] pRefByteCode =
NoCallStackClassLoader.stringToBytes(pRefByteCodeString);
PrivilegedExceptionAction<Constructor<?>> action =

View File

@ -37,7 +37,7 @@ import java.util.Map;
import java.util.Collections;
import javax.security.auth.Subject;
import com.sun.jmx.remote.internal.RMIExporter;
import com.sun.jmx.remote.internal.rmi.RMIExporter;
import com.sun.jmx.remote.util.EnvHelp;
import java.io.ObjectStreamClass;
import java.lang.reflect.Method;

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Defines the RMI Connector for the Java Management Extensions (JMX) Remote API.
* <P>
* The {@linkplain javax.management.remote.rmi RMI connector} is a connector
* for the JMX Remote API that uses RMI to transmit client requests to a remote
* MBean server.
*
* @provides javax.management.remote.JMXConnectorProvider
* A provider of {@code JMXConnector} for the RMI protocol.<br>
* Instances of {@code JMXConnector} using the RMI protocol
* are usually created by the {@link
* javax.management.remote.JMXConnectorFactory} which will locate
* and load the appropriate {@code JMXConnectorProvider} service
* implementation for the given protocol.
*
* @provides javax.management.remote.JMXConnectorServerProvider
* A provider of {@code JMXConnectorServer} for the RMI protocol.<br>
* Instances of {@code JMXConnectorServer} using the RMI protocol
* are usually created by the {@link
* javax.management.remote.JMXConnectorServerFactory} which will locate
* and load the appropriate {@code JMXConnectorServerProvider} service
* implementation for the given protocol.
*
*/
module java.management.rmi {
requires transitive java.management;
requires transitive java.rmi;
requires java.naming;
exports javax.management.remote.rmi;
// The qualified export below is required to preserve backward
// compatibility for the legacy case where an ordered list
// of package prefixes can be specified to the factory.
exports com.sun.jmx.remote.protocol.rmi to java.management;
// jdk.management.agent needs to create an RMIExporter instance.
exports com.sun.jmx.remote.internal.rmi to jdk.management.agent;
// The java.management.rmi module provides implementations
// of the JMXConnectorProvider and JMXConnectorServerProvider
// services supporting the RMI protocol.
provides javax.management.remote.JMXConnectorProvider
with com.sun.jmx.remote.protocol.rmi.ClientProvider;
provides javax.management.remote.JMXConnectorServerProvider
with com.sun.jmx.remote.protocol.rmi.ServerProvider;
}

View File

@ -52,7 +52,6 @@ import javax.management.remote.TargetedNotification;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import java.lang.reflect.UndeclaredThrowableException;
import java.rmi.UnmarshalException;
import java.util.concurrent.RejectedExecutionException;
@ -633,7 +632,7 @@ public abstract class ClientNotifForwarder {
}
return nr;
} catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) {
} catch (ClassNotFoundException | NotSerializableException e) {
logger.trace("NotifFetcher.fetchNotifs", e);
return fetchOneNotif();
} catch (IOException ioe) {
@ -705,7 +704,7 @@ public abstract class ClientNotifForwarder {
try {
// 1 notif to skip possible missing class
result = cnf.fetchNotifs(startSequenceNumber, 1, 0L);
} catch (ClassNotFoundException | NotSerializableException | UnmarshalException e) {
} catch (ClassNotFoundException | NotSerializableException e) {
logger.warning("NotifFetcher.fetchOneNotif",
"Failed to deserialize a notification: "+e.toString());
if (logger.traceOn()) {

View File

@ -27,13 +27,17 @@ package javax.management.remote;
import com.sun.jmx.mbeanserver.Util;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.reflect.Module;
import java.net.MalformedURLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.ServiceLoader.Provider;
import java.util.StringTokenizer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import java.security.AccessController;
import java.security.PrivilegedAction;
@ -332,25 +336,32 @@ public class JMXConnectorFactory {
IOException exception = null;
if (provider == null) {
Predicate<Provider<?>> systemProvider =
JMXConnectorFactory::isSystemProvider;
// Loader is null when context class loader is set to null
// and no loader has been provided in map.
// com.sun.jmx.remote.util.Service class extracted from j2se
// provider search algorithm doesn't handle well null classloader.
JMXConnector connection = null;
if (loader != null) {
try {
JMXConnector connection =
getConnectorAsService(loader, providerURL, envcopy);
if (connection != null)
return connection;
connection = getConnectorAsService(loader,
providerURL,
envcopy,
systemProvider.negate());
if (connection != null) return connection;
} catch (JMXProviderException e) {
throw e;
} catch (IOException e) {
exception = e;
}
}
provider = getProvider(protocol, PROTOCOL_PROVIDER_DEFAULT_PACKAGE,
JMXConnectorFactory.class.getClassLoader(),
providerClassName, targetInterface);
connection = getConnectorAsService(
JMXConnectorFactory.class.getClassLoader(),
providerURL,
Collections.unmodifiableMap(envcopy),
systemProvider);
if (connection != null) return connection;
}
if (provider == null) {
@ -437,13 +448,6 @@ public class JMXConnectorFactory {
return instance;
}
static <T> Iterator<T> getProviderIterator(final Class<T> providerClass,
final ClassLoader loader) {
ServiceLoader<T> serviceLoader =
ServiceLoader.load(providerClass, loader);
return serviceLoader.iterator();
}
private static ClassLoader wrap(final ClassLoader parent) {
return parent != null ? AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
@ -459,44 +463,265 @@ public class JMXConnectorFactory {
}) : null;
}
/**
* Checks whether the given provider is our system provider for
* the RMI connector.
* If providers for additional protocols are added in the future
* then the name of their modules may need to be added here.
* System providers will be loaded only if no other provider is found.
* @param provider the provider to test.
* @return true if this provider is a default system provider.
*/
static boolean isSystemProvider(Provider<?> provider) {
Module providerModule = provider.type().getModule();
return providerModule.isNamed()
&& providerModule.getName().equals("java.management.rmi");
}
/**
* Creates a JMXConnector from the first JMXConnectorProvider service
* supporting the given url that can be loaded from the given loader.
* <p>
* Parses the list of JMXConnectorProvider services that can be loaded
* from the given loader, only retaining those that satisfy the given filter.
* Then for each provider, attempts to create a new JMXConnector.
* The first JMXConnector successfully created is returned.
* <p>
* The filter predicate is usually used to either exclude system providers
* or only retain system providers (see isSystemProvider(...) above).
*
* @param loader The ClassLoader to use when looking up an implementation
* of the service. If null, then only installed services will be
* considered.
*
* @param url The JMXServiceURL of the connector for which a provider is
* requested.
*
* @param filter A filter used to exclude or return provider
* implementations. Typically the filter will either exclude
* system services (system default implementations) or only
* retain those.
* This can allow to first look for custom implementations (e.g.
* deployed on the CLASSPATH with META-INF/services) and
* then only default to system implementations.
*
* @throws IOException if no connector could not be instantiated, and
* at least one provider threw an exception that wasn't a
* {@code MalformedURLException} or a {@code JMProviderException}.
*
* @throws JMXProviderException if a provider for the protocol in
* <code>url</code> was found, but couldn't create the connector
* some reason.
*
* @return an instance of JMXConnector if a provider was found from
* which one could be instantiated, {@code null} otherwise.
*/
private static JMXConnector getConnectorAsService(ClassLoader loader,
JMXServiceURL url,
Map<String, ?> map)
Map<String, ?> map,
Predicate<Provider<?>> filter)
throws IOException {
Iterator<JMXConnectorProvider> providers =
getProviderIterator(JMXConnectorProvider.class, loader);
JMXConnector connection;
IOException exception = null;
while (providers.hasNext()) {
JMXConnectorProvider provider = providers.next();
try {
connection = provider.newJMXConnector(url, map);
return connection;
} catch (JMXProviderException e) {
throw e;
} catch (Exception e) {
if (logger.traceOn())
logger.trace("getConnectorAsService",
"URL[" + url +
"] Service provider exception: " + e);
if (!(e instanceof MalformedURLException)) {
if (exception == null) {
if (e instanceof IOException) {
exception = (IOException) e;
} else {
exception = EnvHelp.initCause(
new IOException(e.getMessage()), e);
final ConnectorFactory<JMXConnectorProvider, JMXConnector> factory =
(p) -> p.newJMXConnector(url, map);
return getConnectorAsService(JMXConnectorProvider.class, loader, url,
filter, factory);
}
/**
* A factory function that can create a connector from a provider.
* The pair (P,C) will be either one of:
* a. (JMXConnectorProvider, JMXConnector) or
* b. (JMXConnectorServerProvider, JMXConnectorServer)
*/
@FunctionalInterface
static interface ConnectorFactory<P,C> {
public C apply(P provider) throws Exception;
}
/**
* An instance of ProviderFinder is used to traverse a
* {@code Stream<Provider<P>>} and find the first implementation of P
* that supports creating a connector C from the given JMXServiceURL.
* <p>
* The pair (P,C) will be either one of: <br>
* a. (JMXConnectorProvider, JMXConnector) or <br>
* b. (JMXConnectorServerProvider, JMXConnectorServer)
* <p>
* The first connector successfully created while traversing the stream
* is stored in the ProviderFinder instance. After that, the
* ProviderFinder::test method, if called, will always return false, skipping
* the remaining providers.
* <p>
* An instance of ProviderFinder is always expected to be used in conjunction
* with Stream::findFirst, so that the stream traversal is stopped as soon
* as a matching provider is found.
* <p>
* At the end of the stream traversal, the ProviderFinder::get method can be
* used to obtain the connector instance (an instance of C) that was created.
* If no connector could be created, and an exception was encountered while
* traversing the stream and attempting to create the connector, then that
* exception will be thrown by ProviderFinder::get, wrapped, if needed,
* inside an IOException.
* <p>
* If any JMXProviderException is encountered while traversing the stream and
* attempting to create the connector, that exception will be wrapped in an
* UncheckedIOException and thrown immediately within the stream, thus
* interrupting the traversal.
* <p>
* If no matching provider was found (no provider found or attempting
* factory.apply always returned null or threw a MalformedURLException,
* indicating the provider didn't support the protocol asked for by
* the JMXServiceURL), then ProviderFinder::get will simply return null.
*/
private static final class ProviderFinder<P,C> implements Predicate<Provider<P>> {
final ConnectorFactory<P,C> factory;
final JMXServiceURL url;
private IOException exception = null;
private C connection = null;
ProviderFinder(ConnectorFactory<P,C> factory, JMXServiceURL url) {
this.factory = factory;
this.url = url;
}
/**
* Returns {@code true} for the first provider {@code sp} that can
* be used to obtain an instance of {@code C} from the given
* {@code factory}.
*
* @param sp a candidate provider for instantiating {@code C}.
*
* @throws UncheckedIOException if {@code sp} throws a
* JMXProviderException. The JMXProviderException is set as the
* root cause.
*
* @return {@code true} for the first provider {@code sp} for which
* {@code C} could be instantiated, {@code false} otherwise.
*/
public boolean test(Provider<P> sp) {
if (connection == null) {
P provider = sp.get();
try {
connection = factory.apply(provider);
return connection != null;
} catch (JMXProviderException e) {
throw new UncheckedIOException(e);
} catch (Exception e) {
if (logger.traceOn())
logger.trace("getConnectorAsService",
"URL[" + url +
"] Service provider exception: " + e);
if (!(e instanceof MalformedURLException)) {
if (exception == null) {
if (e instanceof IOException) {
exception = (IOException) e;
} else {
exception = EnvHelp.initCause(
new IOException(e.getMessage()), e);
}
}
}
}
continue;
}
return false;
}
/**
* Returns an instance of {@code C} if a provider was found from
* which {@code C} could be instantiated.
*
* @throws IOException if {@code C} could not be instantiated, and
* at least one provider threw an exception that wasn't a
* {@code MalformedURLException} or a {@code JMProviderException}.
*
* @return an instance of {@code C} if a provider was found from
* which {@code C} could be instantiated, {@code null} otherwise.
*/
C get() throws IOException {
if (connection != null) return connection;
else if (exception != null) throw exception;
else return null;
}
}
/**
* Creates a connector from a provider loaded from the ServiceLoader.
* <p>
* The pair (P,C) will be either one of: <br>
* a. (JMXConnectorProvider, JMXConnector) or <br>
* b. (JMXConnectorServerProvider, JMXConnectorServer)
*
* @param providerClass The service type for which an implementation
* should be looked up from the {@code ServiceLoader}. This will
* be either {@code JMXConnectorProvider.class} or
* {@code JMXConnectorServerProvider.class}
*
* @param loader The ClassLoader to use when looking up an implementation
* of the service. If null, then only installed services will be
* considered.
*
* @param url The JMXServiceURL of the connector for which a provider is
* requested.
*
* @param filter A filter used to exclude or return provider
* implementations. Typically the filter will either exclude
* system services (system default implementations) or only
* retain those.
* This can allow to first look for custom implementations (e.g.
* deployed on the CLASSPATH with META-INF/services) and
* then only default to system implementations.
*
* @param factory A functional factory that can attempt to create an
* instance of connector {@code C} from a provider {@code P}.
* Typically, this is a simple wrapper over {@code
* JMXConnectorProvider::newJMXConnector} or {@code
* JMXConnectorProviderServer::newJMXConnectorServer}.
*
* @throws IOException if {@code C} could not be instantiated, and
* at least one provider {@code P} threw an exception that wasn't a
* {@code MalformedURLException} or a {@code JMProviderException}.
*
* @throws JMXProviderException if a provider {@code P} for the protocol in
* <code>url</code> was found, but couldn't create the connector
* {@code C} for some reason.
*
* @return an instance of {@code C} if a provider {@code P} was found from
* which one could be instantiated, {@code null} otherwise.
*/
static <P,C> C getConnectorAsService(Class<P> providerClass,
ClassLoader loader,
JMXServiceURL url,
Predicate<Provider<?>> filter,
ConnectorFactory<P,C> factory)
throws IOException {
// sanity check
if (JMXConnectorProvider.class != providerClass
&& JMXConnectorServerProvider.class != providerClass) {
// should never happen
throw new InternalError("Unsupported service interface: "
+ providerClass.getName());
}
ServiceLoader<P> serviceLoader = loader == null
? ServiceLoader.loadInstalled(providerClass)
: ServiceLoader.load(providerClass, loader);
Stream<Provider<P>> stream = serviceLoader.stream().filter(filter);
ProviderFinder<P,C> finder = new ProviderFinder<>(factory, url);
try {
stream.filter(finder).findFirst();
return finder.get();
} catch (UncheckedIOException e) {
if (e.getCause() instanceof JMXProviderException) {
throw (JMXProviderException) e.getCause();
} else {
throw e;
}
}
if (exception == null)
return null;
else
throw exception;
}
static <T> T getProvider(String protocol,

View File

@ -30,13 +30,16 @@ import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.MalformedURLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader.Provider;
import java.util.function.Predicate;
import javax.management.MBeanServer;
import javax.management.remote.JMXConnectorFactory.ConnectorFactory;
/**
* <p>Factory to create JMX API connector servers. There
@ -205,43 +208,15 @@ public class JMXConnectorServerFactory {
}
private static JMXConnectorServer
getConnectorServerAsService(ClassLoader loader,
JMXServiceURL url,
Map<String, ?> map,
MBeanServer mbs)
getConnectorServerAsService(ClassLoader loader, JMXServiceURL url,
Map<String, ?> map, MBeanServer mbs,
Predicate<Provider<?>> filter)
throws IOException {
Iterator<JMXConnectorServerProvider> providers =
JMXConnectorFactory.
getProviderIterator(JMXConnectorServerProvider.class, loader);
IOException exception = null;
while (providers.hasNext()) {
try {
return providers.next().newJMXConnectorServer(url, map, mbs);
} catch (JMXProviderException e) {
throw e;
} catch (Exception e) {
if (logger.traceOn())
logger.trace("getConnectorAsService",
"URL[" + url +
"] Service provider exception: " + e);
if (!(e instanceof MalformedURLException)) {
if (exception == null) {
if (e instanceof IOException) {
exception = (IOException) e;
} else {
exception = EnvHelp.initCause(
new IOException(e.getMessage()), e);
}
}
}
continue;
}
}
if (exception == null)
return null;
else
throw exception;
final ConnectorFactory<JMXConnectorServerProvider,JMXConnectorServer>
factory = (p) -> p.newJMXConnectorServer(url, map, mbs);
return JMXConnectorFactory.getConnectorAsService(
JMXConnectorServerProvider.class,
loader, url, filter, factory);
}
/**
@ -309,18 +284,22 @@ public class JMXConnectorServerFactory {
loader);
IOException exception = null;
JMXConnectorServer connection = null;
if (provider == null) {
Predicate<Provider<?>> systemProvider =
JMXConnectorFactory::isSystemProvider;
// Loader is null when context class loader is set to null
// and no loader has been provided in map.
// com.sun.jmx.remote.util.Service class extracted from j2se
// provider search algorithm doesn't handle well null classloader.
if (loader != null) {
try {
JMXConnectorServer connection =
connection =
getConnectorServerAsService(loader,
serviceURL,
envcopy,
mbeanServer);
mbeanServer,
systemProvider.negate());
if (connection != null)
return connection;
} catch (JMXProviderException e) {
@ -329,13 +308,13 @@ public class JMXConnectorServerFactory {
exception = e;
}
}
provider =
JMXConnectorFactory.getProvider(
protocol,
PROTOCOL_PROVIDER_DEFAULT_PACKAGE,
JMXConnectorFactory.class.getClassLoader(),
providerClassName,
targetInterface);
connection = getConnectorServerAsService(
JMXConnectorFactory.class.getClassLoader(),
serviceURL,
Collections.unmodifiableMap(envcopy),
mbeanServer,
systemProvider);
if (connection != null) return connection;
}
if (provider == null) {

View File

@ -30,8 +30,6 @@
* JVM and other components in the Java runtime.
*/
module java.management {
requires transitive java.rmi;
requires java.naming;
exports java.lang.management;
exports javax.management;
@ -41,10 +39,14 @@ module java.management {
exports javax.management.openmbean;
exports javax.management.relation;
exports javax.management.remote;
exports javax.management.remote.rmi;
exports javax.management.timer;
exports com.sun.jmx.remote.internal to jdk.management.agent;
exports com.sun.jmx.remote.security to jdk.management.agent;
exports com.sun.jmx.remote.internal to
java.management.rmi,
jdk.management.agent;
exports com.sun.jmx.remote.security to
java.management.rmi,
jdk.management.agent;
exports com.sun.jmx.remote.util to java.management.rmi;
exports sun.management to
jdk.jconsole,
jdk.management,

View File

@ -41,13 +41,12 @@ module java.rmi {
exports sun.rmi.registry to
jdk.management.agent;
exports sun.rmi.server to
java.management,
java.management.rmi,
jdk.management.agent,
jdk.jconsole;
exports sun.rmi.transport to
java.management,
java.management.rmi,
jdk.management.agent,
jdk.jconsole;
uses java.rmi.server.RMIClassLoaderSpi;
}

View File

@ -36,6 +36,7 @@ module java.se {
requires transitive java.instrument;
requires transitive java.logging;
requires transitive java.management;
requires transitive java.management.rmi;
requires transitive java.naming;
requires transitive java.prefs;
requires transitive java.rmi;
@ -47,4 +48,3 @@ module java.se {
requires transitive java.xml;
requires transitive java.xml.crypto;
}

View File

@ -26,7 +26,7 @@
module jdk.jconsole {
requires transitive java.desktop;
requires transitive java.management;
requires java.logging;
requires java.management.rmi;
requires java.rmi;
requires jdk.attach;
requires jdk.jvmstat;
@ -35,4 +35,3 @@ module jdk.jconsole {
exports com.sun.tools.jconsole;
uses com.sun.tools.jconsole.JConsolePlugin;
}

View File

@ -25,9 +25,9 @@
module jdk.management.agent {
requires java.management;
requires java.management.rmi;
exports jdk.internal.agent to jdk.jconsole;
uses jdk.internal.agent.spi.AgentProvider;
}

View File

@ -73,7 +73,7 @@ import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
import javax.security.auth.Subject;
import com.sun.jmx.remote.internal.RMIExporter;
import com.sun.jmx.remote.internal.rmi.RMIExporter;
import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
import jdk.internal.agent.Agent;

View File

@ -27,7 +27,7 @@
* @summary Test that JMX classes use fully-qualified class names
* in MBeanNotificationInfo
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean NotificationInfoTest
* @run build NotificationInfoTest
* @run main NotificationInfoTest

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks that exceptions are correctly wired (compared to reference).
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @run main/othervm/timeout=300 -DDEBUG_STANDARD ExceptionTest
*/
@ -368,5 +368,3 @@ public class ExceptionTest {
}
}

View File

@ -97,7 +97,7 @@ import javax.management.remote.JMXServiceURL;
* @bug 5072268
* @summary Test that nothing assumes a post-1.2 MBeanServer
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run main/othervm -ea OldMBeanServerTest
*/

View File

@ -27,7 +27,7 @@
* @summary Test that a RequiredModelMBean operation can have a targetObject
* that is not serializable
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean UnserializableTargetObjectTest
* @run build UnserializableTargetObjectTest
* @run main UnserializableTargetObjectTest

View File

@ -27,7 +27,7 @@
* @summary Test support for arrays in parameterized types.
* @author Luis-Miguel Alventosa
* @key intermittent
* @modules java.management
* @modules java.management.rmi
* @run clean GenericArrayTypeTest
* @run build GenericArrayTypeTest
* @run main GenericArrayTypeTest

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks correct exception and error events from NotificationListener
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanExceptionHandlingTest -timeForNotificationInSeconds 3

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Test all MXBeans available by default on the platform
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanInteropTest1
*/

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks access to test MXBean
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanInteropTest2

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks MXBean proper registration both as its implementation class and interface
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanNotifTest -numOfNotifications 239 -timeForNotificationInSeconds 4

View File

@ -27,7 +27,7 @@
* @summary General MXBean test.
* @author Eamonn McManus
* @author Jaroslav Bachorik
* @modules java.management
* @modules java.management.rmi
* @run clean MXBeanTest MerlinMXBean TigerMXBean
* @run build MXBeanTest MerlinMXBean TigerMXBean
* @run main MXBeanTest

View File

@ -27,7 +27,7 @@
* @summary Checks that a serialized instance is not transmitted from an MXBean.
* All the communication should be done via Open Types
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Tests most of the existing query types.
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @compile TestQuery.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD SupportedQueryTypesTest -mbeanClassName TestQuery
*/

View File

@ -26,7 +26,7 @@
* @bug 6238815
* @summary test the new interface Addressable
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean AddressableTest
* @run build AddressableTest
* @run main AddressableTest

View File

@ -27,7 +27,7 @@
* @summary Tests behaviour when connections break
* @author Eamonn McManus
* @key intermittent
* @modules java.management
* @modules java.management.rmi
* @run clean BrokenConnectionTest
* @run build BrokenConnectionTest
* @run main BrokenConnectionTest

View File

@ -28,7 +28,7 @@
* the method "void close() throws IOException;" extend
* or implement the java.io.Closeable interface.
* @author Luis-Miguel Alventosa
* @modules java.management
* @modules java.management.rmi
* @run clean CloseableTest
* @run build CloseableTest
* @run main CloseableTest

View File

@ -26,7 +26,7 @@
* @bug 4943248
* @summary Tests that NullPointerException is thrown when listener is null.
* @author Daniel Fuchs
* @modules java.management
* @modules java.management.rmi
* @run clean ConnectionListenerNullTest
* @run build ConnectionListenerNullTest
* @run main ConnectionListenerNullTest

View File

@ -26,7 +26,7 @@
* @bug 4865397
* @summary Tests remote JMX connections
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean ConnectionTest
* @run build ConnectionTest
* @run main ConnectionTest

View File

@ -28,7 +28,7 @@
* @summary test the connector server option that causes it not to prevent the
* VM from exiting
* @author Shanliang JIANG, Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run main/othervm DaemonRMIExporterTest
*/
import java.util.Arrays;

View File

@ -26,7 +26,7 @@
* @bug 4951414
* @summary Try to get an IOException.
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean GetConnectionTest
* @run build GetConnectionTest
* @run main GetConnectionTest

View File

@ -26,7 +26,7 @@
* @bug 4886799
* @summary Check that IIOP URLs have /ior/ in the path
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean IIOPURLTest
* @run build IIOPURLTest
* @run main IIOPURLTest

View File

@ -26,7 +26,8 @@
* @bug 4886838 4886830 8025204
* @summary Tests that idle timeouts happen at appropriate times
* @author Eamonn McManus
* @modules java.management/com.sun.jmx.remote.util
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.util
* @run clean IdleTimeoutTest
* @run build IdleTimeoutTest
* @run main IdleTimeoutTest

View File

@ -45,7 +45,7 @@ import javax.management.remote.rmi.RMIConnectorServer;
* @bug 6697180
* @summary test on a client notification deadlock.
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean MultiThreadDeadLockTest
* @run build MultiThreadDeadLockTest
* @run main MultiThreadDeadLockTest

View File

@ -29,7 +29,7 @@
* thrown when constructor is invoked with null class loader as
* an argument.
* @author Amit Sapre
* @modules java.management/javax.management.remote.rmi:open
* @modules java.management.rmi/javax.management.remote.rmi:open
* @run clean ObjectInputStreamWithLoaderNullCheckTest
* @run build ObjectInputStreamWithLoaderNullCheckTest
* @run main ObjectInputStreamWithLoaderNullCheckTest

View File

@ -42,7 +42,7 @@ import javax.security.auth.Subject;
* @bug 6566891
* @summary Check no memory leak on RMIConnector's rmbscMap
* @author Shanliang JIANG
* @modules java.management/javax.management.remote.rmi:open
* @modules java.management.rmi/javax.management.remote.rmi:open
* @run clean RMIConnectorInternalMapTest
* @run build RMIConnectorInternalMapTest
* @run main RMIConnectorInternalMapTest

View File

@ -38,7 +38,7 @@ import javax.management.remote.rmi.RMIConnector;
* @bug 6566891
* @summary Check no memory leak on RMIConnector's nullSubjectConn
* @author Shanliang JIANG
* @modules java.management/javax.management.remote.rmi:open
* @modules java.management.rmi/javax.management.remote.rmi:open
* @run clean RMIConnectorNullSubjectConnTest
* @run build RMIConnectorNullSubjectConnTest
* @run main RMIConnectorNullSubjectConnTest

View File

@ -26,7 +26,7 @@
* @summary NPE IN RMIConnector.connect
* @bug 6984520
* @library /java/rmi/testlibrary
* @modules java.management
* @modules java.management.rmi
* java.rmi/sun.rmi.registry
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
@ -75,4 +75,3 @@ public class RMIConnector_NPETest {
}
}

View File

@ -27,7 +27,7 @@
* @bug 4917237
* @summary test that process exit immediately after stop() / close() called
* @author Jean Francois Denise
* @modules java.management
* @modules java.management.rmi
* @run clean RMIExitTest
* @run build RMIExitTest
* @run main RMIExitTest

View File

@ -26,7 +26,7 @@
* @summary Tests to serialize RMIConnector
* @bug 5032052
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean RMISerializeTest
* @run build RMISerializeTest
* @run main RMISerializeTest

View File

@ -26,7 +26,7 @@
* @bug 6475157
* @summary Tests deadlock in simultaneous connection and connector-server close
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
*/
/* This test is somewhat dependent on implementation details. If it suddenly

View File

@ -27,7 +27,7 @@
* @summary Tests that JNDI bind failure doesn't leave an orphan RMI
* Connector Server object
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean JNDIFailureTest
* @run build JNDIFailureTest
* @run main JNDIFailureTest

View File

@ -27,7 +27,7 @@
* @summary Test that setting an MBeanServerForwarder on an already
* started RMI connector server has the expected behavior.
* @author Luis-Miguel Alventosa
* @modules java.management
* @modules java.management.rmi
* @run clean MBSFPreStartPostStartTest
* @run build MBSFPreStartPostStartTest
* @run main MBSFPreStartPostStartTest

View File

@ -26,7 +26,7 @@
* @bug 5016705
* @summary Tests the use of the RMIExporter class.
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.internal
* @modules java.management.rmi/com.sun.jmx.remote.internal.rmi
* @run clean RMIExporterTest
* @run build RMIExporterTest
* @run main RMIExporterTest
@ -46,7 +46,7 @@ import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;
import com.sun.jmx.remote.internal.RMIExporter;
import com.sun.jmx.remote.internal.rmi.RMIExporter;
public class RMIExporterTest {

View File

@ -27,7 +27,8 @@
* @summary Tests that IllegalArgumentException is thrown when
* MBeanServerForwrder is null.
* @author Daniel Fuchs
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean SetMBeanServerForwarder
* @run build SetMBeanServerForwarder
* @run main SetMBeanServerForwarder

View File

@ -26,7 +26,7 @@
* @bug 4924683
* @summary Check RMI/JRMP stubs can be deserialized using user's loader
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean DeserializeEncodedURLTest SingleClassLoader
* @run build DeserializeEncodedURLTest SingleClassLoader
* @run main DeserializeEncodedURLTest

View File

@ -26,7 +26,7 @@
* @bug 4915825 4921009 4934965 4977469 8019584
* @summary Tests behavior when client or server gets object of unknown class
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean MissingClassTest SingleClassLoader
* @run build MissingClassTest SingleClassLoader
* @run main MissingClassTest

View File

@ -26,7 +26,7 @@
* @bug 5021246
* @summary Check that class downloading is supported by RMI connector
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run main RMIDownloadTest receive without
* @run main RMIDownloadTest send without
* @run main RMIDownloadTest receive with

View File

@ -26,7 +26,7 @@
* @bug 4910428
* @summary Tests target MBean class loader used before JSR 160 loader
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
* @run clean TargetMBeanTest
* @run build TargetMBeanTest
* @run main TargetMBeanTest

View File

@ -26,7 +26,7 @@
* @bug 7120365
* @summary test on Concurrent Modification
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run main ConcurrentModificationTest
*/

View File

@ -25,7 +25,7 @@
* @test
* @bug 6957378
* @summary Test that a listener can be removed remotely from an MBean that no longer exists.
* @modules java.management/javax.management.remote.rmi:open
* @modules java.management.rmi/javax.management.remote.rmi:open
* java.management/com.sun.jmx.remote.internal:+open
* @author Eamonn McManus
* @run main/othervm -XX:+UsePerfData DeadListenerTest

View File

@ -27,7 +27,7 @@
* @summary Check that the expected notification is received by the JMX
* client even when the domain in the ObjectName is not specified
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean EmptyDomainNotificationTest
* @run build EmptyDomainNotificationTest
* @run main EmptyDomainNotificationTest

View File

@ -26,7 +26,7 @@
* @bug 6338874
* @summary Check that notification dispatch is not linear in number of MBeans.
* @author Eamonn McManus
* @modules java.management
* @modules java.management.rmi
*
* @library /lib/testlibrary
* @run build jdk.testlibrary.* ListenerScaleTest

View File

@ -26,7 +26,7 @@
* @summary Tests to send a not serializable notification.
* @bug 5022196 8132003
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean NotSerializableNotifTest
* @run build NotSerializableNotifTest
* @run main NotSerializableNotifTest

View File

@ -26,7 +26,7 @@
* @bug 6199899
* @summary Tests reconnection done by a fetching notif thread.
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean NotifReconnectDeadlockTest
* @run build NotifReconnectDeadlockTest
* @run main NotifReconnectDeadlockTest

View File

@ -26,7 +26,8 @@
* @bug 5106721
* @summary Check the NotificationAccessController methods are properly called.
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean NotificationAccessControllerTest
* @run build NotificationAccessControllerTest
* @run main NotificationAccessControllerTest

View File

@ -26,7 +26,7 @@
* @bug 4934236
* @summary Tests that NotificationBuffer is created when used.
* @author jfd@...
* @modules java.management
* @modules java.management.rmi
* @run clean NotificationBufferCreationTest NotificationSender
* @run build NotificationBufferCreationTest
* @run main NotificationBufferCreationTest

View File

@ -28,7 +28,7 @@
* installed. Test the property "jmx.remote.x.check.notification.emission".
* @author Luis-Miguel Alventosa
* @key intermittent
* @modules java.management
* @modules java.management.rmi
* @run clean NotificationEmissionTest
* @run build NotificationEmissionTest
* @run main NotificationEmissionTest 1

View File

@ -27,7 +27,7 @@
* @summary Tests to receive notifications for opened and closed connections
ions
* @author sjiang
* @modules java.management
* @modules java.management.rmi
* @run clean RMINotifTest
* @run build RMINotifTest
* @run main RMINotifTest

View File

@ -27,7 +27,7 @@
* @summary Tests the reception of the notifications for opened and closed
* connections
* @author sjiang
* @modules java.management
* @modules java.management.rmi
* @run clean ServerNotifs
* @run build ServerNotifs
* @run main ServerNotifs

View File

@ -27,7 +27,7 @@
* @summary Tests whether a listener receives notifs emitted before the
* listener is registered.
* @author Shanliang JIANG
* @modules java.management
* @modules java.management.rmi
* @run clean UnexpectedNotifTest
* @run build UnexpectedNotifTest
* @run main UnexpectedNotifTest

View File

@ -27,7 +27,7 @@
* @summary Tests that MBeanServerFileAccessController supports
* principals other than JMXPrincipal.
* @author Luis-Miguel Alventosa
* @modules java.management
* @modules java.management.rmi
* @run clean NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
* @run build NonJMXPrincipalsTest SimpleStandard SimpleStandardMBean
* @run main NonJMXPrincipalsTest

View File

@ -27,7 +27,7 @@
* @summary Tests the use of the "jmx.remote.x.password.file" and
* "jmx.remote.x.access.file" environment map properties.
* @author Luis-Miguel Alventosa
* @modules java.management
* @modules java.management.rmi
* @run clean PasswordAccessFileTest SimpleStandard SimpleStandardMBean
* @run build PasswordAccessFileTest SimpleStandard SimpleStandardMBean
* @run main PasswordAccessFileTest

View File

@ -26,7 +26,8 @@
* @bug 5016508
* @summary Supplies an alternative JAAS configuration for authenticating RMI clients
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean RMIAltAuthTest
* @run build RMIAltAuthTest SimpleStandard SimpleStandardMBean
* @run main RMIAltAuthTest

View File

@ -26,7 +26,8 @@
* @bug 5016508
* @summary Tests the default JAAS configuration for authenticating RMI clients
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean RMIPasswdAuthTest
* @run build RMIPasswdAuthTest SimpleStandard SimpleStandardMBean
* @run main RMIPasswdAuthTest

View File

@ -24,7 +24,7 @@
/*
* @test ProviderTest.java
* @summary Tests jar services provider are called
* @modules java.management
* @modules java.management.rmi
* @run clean ProviderTest provider.JMXConnectorProviderImpl provider.JMXConnectorServerProviderImpl
* @run build ProviderTest provider.JMXConnectorProviderImpl provider.JMXConnectorServerProviderImpl
* @run main ProviderTest

View File

@ -26,7 +26,8 @@
* @bug 4871761
* @summary Tests that JMXServiceErrorException is correctly emitted.
* @author Daniel Fuchs
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean JMXServerErrorTest
* @run build JMXServerErrorTest
* @run main JMXServerErrorTest

View File

@ -26,7 +26,7 @@
* @bug 7654321
* @summary Tests the use of the custom RMI socket factories.
* @author Luis-Miguel Alventosa
* @modules java.management
* @modules java.management.rmi
* @run clean RMISocketFactoriesTest
* @run build RMISocketFactoriesTest RMIClientFactory RMIServerFactory
* @run main RMISocketFactoriesTest test_server_factory

View File

@ -27,7 +27,8 @@
* @summary Tests the use of the subject delegation feature in the
* RMI connector
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean SubjectDelegation1Test SimpleStandard SimpleStandardMBean
* @run build SubjectDelegation1Test SimpleStandard SimpleStandardMBean
* @run main SubjectDelegation1Test policy11 ok

View File

@ -27,7 +27,8 @@
* @summary Tests the use of the subject delegation feature on the authenticated
* principals within the RMI connector server's creator codebase.
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean SubjectDelegation2Test SimpleStandard SimpleStandardMBean
* @run build SubjectDelegation2Test SimpleStandard SimpleStandardMBean
* @run main SubjectDelegation2Test policy21 ok

View File

@ -28,7 +28,8 @@
* principals within the RMI connector server's creator codebase with
* subject delegation.
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.security
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.security
* @run clean SubjectDelegation3Test SimpleStandard SimpleStandardMBean
* @run build SubjectDelegation3Test SimpleStandard SimpleStandardMBean
* @run main SubjectDelegation3Test policy31 ok

View File

@ -31,7 +31,8 @@
* Check also that null values for keys are not allowed in
* the maps passed to the JMXConnector[Server] factories.
* @author Luis-Miguel Alventosa
* @modules java.management/com.sun.jmx.remote.util
* @modules java.management.rmi
* java.management/com.sun.jmx.remote.util
* @run clean MapNullValuesTest
* @run build MapNullValuesTest
* @run main MapNullValuesTest

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks various authentication behavior from remote jmx client
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile Simple.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials

View File

@ -26,7 +26,7 @@
* @bug 8058865
* @summary Checks various secure ways of connecting from remote jmx client
* @author Olivier Lagneau
* @modules java.management
* @modules java.management.rmi
* @library /lib/testlibrary
* @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials

View File

@ -57,7 +57,7 @@ public class TestManager {
try {
VirtualMachine.attach(pid).startLocalManagementAgent();
} catch (Exception x) {
throw new IOException(x.getMessage());
throw new IOException(x.getMessage(), x);
}
}

View File

@ -147,7 +147,7 @@ public class ListModsTest {
@Test
public void testListWithLimitMods1() throws Exception {
OutputAnalyzer output
= executeTestJava("--limit-modules", "java.management", "--list-modules")
= executeTestJava("--limit-modules", "java.management.rmi", "--list-modules")
.outputTo(System.out)
.errorTo(System.out);
output.shouldContain("java.rmi");