Hi John,
John Mazzitelli wrote:
> I tried that but failed due to the repository impl. class not being
serializable:
Have you taken a look at the BindableRepository class ? This class is
Referencable - a requirement fo some JNDI context providers - and
serializable.
<init-param>
<param-name>jndi-bind-remote</param-name>
<param-value>true</param-value>
</init-param>
If true, the servlet would then know that it should bind the *remote* repo
object to the JNDI context, as opposed to the repository object reference
itself.
I do not think registering the remote object to the JNDI is in general a
good idea - as always your mileage may vary. Especially considering that
most of the applications accessing resources from JNDI within an
application server are running locally to the application server and use
JNDI to access deployed resources such as JDBC data sources - as always,
there are exceptions if you for example access an LDAP server using the
JNDI-API.
Regarding the startup of the repository, I think, that starting it from
within a web application is a workaround for servlet containers without
resource management support. In the case of JBoss I would suggest
deploying the repository as a resource archive.
In general, this will allow you to bind the remote repo object to *any* JNDI
tree - which would be useful if that JNDI tree is remotely accessible.
In my case, it would allow me to bind the remoted interface (which is inherently serializable) to a JBoss JNP naming service (which then automatically gives you remote access since you could then use the JNP client from a remote VM to get the repo).
As it stands, it looks like you have no choice wrt where you bind the remote object - the RMI Registry (via the rmi-XXX servlet init parameters). The rmi-XXX options trigger the servlet to end up calling "LocateRegistry.createRegistry" - this under the covers uses the SUN JNDI impl
I suppose you mean "SUN RMI impl" and not "SUN JNDI impl", as
RegistryImpl is part of the RMI implementation.
"sun.rmi.registry.RegistryImpl" when running with SUN's JRE). I don't want to
use that - I want the JNP service to be my remote registry.
Unless I'm missing something, which is entirely possible :-) I can't see how I
can get the remote repo unless I register it in the RMI Registry.
Well, IMHO the RepositoryStartupServlet serves two purposes: It shows
how to write a servlet to start a repository and register it with JNDI
and/or RMI registries and second it is the basis for the contributed
WebDAV servers. Using the RepositoryStartupServlet is by no means the
only way to start, access and deploy a repository from within a web
application.
Rather, I would suggest to use application server resource deployment
functionality wherever possible. This would also resolve the issue of
cross-web application dependencies, which I consider unstable.
So, if you create your own resource deployment, you are of course free
to deploy whatever object you like (RepositoryImpl, BindableRepository,
ServerRepository) to whatever registry you like :-)
Hope, this sheds some lights on the issues - and I did not pack too many
errors into the message.
Regards
Felix