Changes reverted from 2.1 and trunk.
-Donald
Jarek Gawor wrote:
No. This is a client socket factory. All it should do is just open a
socket to the host and port specified.
If the server is bound to a specific interface the user (on the client
side) must specify the right ip address on the request.
I think the problem with the 'localhost' is that the 'host' parameter
passed into the client socket factory is incorrect. I expected it to
be what the user specified but instead it's the public ip address of
the local host. I think JVM RMI code does that switch but I'm not 100%
sure. And this switch issue seems to happen only when 'localhost' is
used (it works on a specific ip address).
With this patch I'm unable to do any remote JMX operations (without
changing any configuration) so this should be reverted soon.
Jarek
On Wed, Jan 21, 2009 at 10:18 AM, Donald Woods <[email protected]> wrote:
So, should the createSocket() default to localhost? That way, if a user has
mapped the server to bind to a specific interface (like 192.168.1.x) then
they should expect to have to supply the IP address/hostname of the server?
-Donald
Jarek Gawor wrote:
Donald,
I was looking at this patch but I didn't have a chance to test it and
comment on the bug but I think this fix is not right. It effectively
ignores the host parameter passed in the createSocket() call. So if
you have two running servers one local and one remote and both have
set sub. property hostname=127.0.0.1 and you issue shutdown -h <remote
server host> command on the local machine, the local server will be
shutdown!
Jarek
On Tue, Jan 20, 2009 at 12:19 PM, <[email protected]> wrote:
Author: dwoods
Date: Tue Jan 20 09:19:57 2009
New Revision: 736042
URL: http://svn.apache.org/viewvc?rev=736042&view=rev
Log:
GERONIMO-4518 Can't shutdown the server when host was set to 127.0.0.1 in
config-substitutions.properties. Applied patch from Shawn Jiang.
Modified:
geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
Modified:
geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
URL:
http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java?rev=736042&r1=736041&r2=736042&view=diff
==============================================================================
---
geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
(original)
+++
geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/JMXConnector.java
Tue Jan 20 09:19:57 2009
@@ -188,7 +188,7 @@
} else {
log.warn("Starting unauthenticating JMXConnector for " +
jmxServiceURL);
}
- RMIClientSocketFactory socketFactory = new
GeronimoRMIClientSocketFactory(2 * 60 * 1000, 5 * 60 * 1000);
+ RMIClientSocketFactory socketFactory = new
GeronimoRMIClientSocketFactory(host, 2 * 60 * 1000, 5 * 60 * 1000);
env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
socketFactory);
RMIServerSocketFactory serverSocketFactory = new
GeronimoRMIServerSocketFactory(host);
env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
serverSocketFactory);
Modified:
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
URL:
http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java?rev=736042&r1=736041&r2=736042&view=diff
==============================================================================
---
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
(original)
+++
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/rmi/GeronimoRMIClientSocketFactory.java
Tue Jan 20 09:19:57 2009
@@ -31,15 +31,20 @@
private int connectionTimeout = -1;
private int readTimeout = -1;
+ private String host=null;
- public GeronimoRMIClientSocketFactory(int connectionTimeout, int
readTimeout) {
+ public GeronimoRMIClientSocketFactory(String _host,int
connectionTimeout, int readTimeout) {
+ this.host=_host;
this.connectionTimeout = connectionTimeout;
this.readTimeout = readTimeout;
}
- public Socket createSocket(String host, int port) throws IOException
{
+ public Socket createSocket(String _host, int port) throws
IOException {
Socket socket = new Socket();
- socket.bind(null);
+ socket.bind(null);
+ if(host==null){
+ host=_host;
+ }
socket.connect(new InetSocketAddress(host, port),
(this.connectionTimeout > 0) ? this.connectionTimeout : 0);
if (this.readTimeout >= 0) {
socket.setSoTimeout(this.readTimeout);