[ http://issues.apache.org/jira/browse/JCR-291?page=all ]

Felix Meschberger updated JCR-291:
----------------------------------

    Attachment: RMIRegistry_fm_051211.diff

Attaching a patch to RepositoryStartupServlet relative to the 
contrib/jcr-server/webapp directory.

This patch fixes the issue as follows (also see the added class comment 
regarding RMI registration):

  - If neither rmi-uri, nor rmi-port, nor rmi-host is configured, RMI 
registration does not take place (as today)
  - If rmi-uri is configured, rmi-host and rmi-port are ignored. 
Repository-name is ignored if rmi-uri contains a name

If the host name - either from rmi-uri or rmi-host parameter - is empty or 
null, the local host is used.
If the port number is negative, zero or higher than 65535, the default port 
number 1099 is used.

After gathering the information, a Registry instance has to be retrieved. First 
LocalRegistry.createRegistry is called. If the host name is not empty or null a 
custom RMIServerSocketFactory is created which is enabled to create server 
sockets to a specific interface, otherwise the standard RMIServerSocketFactory 
is used, which simply creates a server socket binding to all interfaces on the 
local host.

If creating the registry fails - e.g. because host is a remote host or a 
registry is already active - LocalRegistry.getRegistry is called with the host 
and port.

Finally the registry retrieved above is used to bind the repository.

If there is no opposition or further enhancement, I will commit the fix 
sometime next week.

> jcr-server-webapp: RMI Registration unstable
> --------------------------------------------
>
>          Key: JCR-291
>          URL: http://issues.apache.org/jira/browse/JCR-291
>      Project: Jackrabbit
>         Type: Improvement
>  Environment: SVN Rev. 355696
>     Reporter: Felix Meschberger
>     Priority: Minor
>  Attachments: RMIRegistry_fm_051211.diff
>
> Registration of the repository to a RMI registry in 
> RepositoryStartupServlet.registerRMI uses web application parameters 
> inconsistently and may not always succeed registering the repository.
> Today, the registerRMI uses these parameters for registration to RMI:
>     rmi-host : The name of the host on which the registry is running
>     rmi-port : The port on which the registry is running
>     rmi-uri : An RMI URI to use for registration
>     repository-name : The name to bind the repository to
> The problem is, that rmi-port is used to try to create the registry to make 
> sure a registry is running on the local host. The rmi-uri is used to register 
> the repository using the static Naming.bind method. If the rmi-uri is not 
> configured, the URI is created from rmi-host, rmi-port and repository-name.
> This may now create a bunch of problems: If the rmi-port and rmi-uri 
> configurations do not match, registration fails, if rmi-host does not resolve 
> to an IP address to which the registry is bound, registration fails.
> I encounter this issue, when trying to register the repository to an RMI 
> registry using default rmi-port configuration (rmi-host and rmi-uri not 
> configured) when running the web app in Jetty.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to