Hi,

as discussed in Thread http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/2723 I managed to Run Jackrabbit on Websphere. I am also using Websphere as client for the Jackrabbit-RMI Server. I defined a Resource Provider in WAS Admin console, represented in the config file (resources.xml) as:

<resources.env:ResourceEnvironmentProvider xmi:id="ResourceEnvironmentProvider_1120984557445" name="JackrabbitRepository"> <factories xmi:type="resources.env:ResourceEnvEntry" xmi:id="ResourceEnvEntry_1120984728292" name="jcr/repository" jndiName="jcr/repository" referenceable="Referenceable_1120984634775" />
  <propertySet xmi:id="J2EEResourcePropertySet_1120984805341">
<resourceProperties xmi:id="J2EEResourceProperty_1120984805341" name="url" type="java.lang.String" value="rmi://srv-entw/repository" required="false" />
  </propertySet>
<referenceables xmi:id="Referenceable_1120984634775" factoryClassname="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory" classname="javax.jcr.Repository" />
</resources.env:ResourceEnvironmentProvider>

After starting the Jackrabbit-RMI Server, it is no problem to access this resource from within a servlet or portlet:

InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("jcr/repository");
Session session = repository.login(new SimpleCredentials("userid", "".toCharArray()), null);


But when I shut down the Jackrabbit-RMI Server and start it again, my servlets or portlets are not able to connect to the resource again and I get an RMI Error.

When restarting the WAS everything works fine again. Perhaps anybody using Jackrabbit-RMI Server with Tomcat another Container?

Anybody can tell me what is the source of the Problem? Is it the ClientRepositoryFactory, does WAS cache the connection?

Another Question: Is there a disadvantage when accessing the Repository directly from within the servlet (instead of using a JNDI Resource):

ClientRepositoryFactory factory = new ClientRepositoryFactory();
Repository r = factory.getRepository("rmi://srv-entw/repository");
Session session = r.login(new SimpleCredentials("userid", "".toCharArray()), null);

Thank you for your answers.
-Florian



Reply via email to