0 Replies Latest reply on May 16, 2018 9:04 AM by gerhard.stummer

    Different behavior of JNDIRepositoryLookup and UrlRepositoryLookup in JcrRepositoriesContainer.java (NoSuchRepositoryException)


      I get NoSuchRepositoryException on every query in ModeShapeEngine.java, version 5.4.1, line 259 when "org.modeshape.jcr.URL" for RepositoryFactory is defined by jndi entry.


      Two ModeShapeEngine objects will be created on application startup. The first one in my businnes-logik, the second in modeshape-web-jcr-rest.jar.

      The second one is unitialized, configuration is loaded by jndi but in JcrRepositoriesContainer.JNDIRepositoryLookup I'm missing these lines from UrlRepositoryLookup

      (JcrRepositoriesContainer.java UrlRepositoryLookup, line 209).

                  // Now deploy the new repository ...
                  try {
                      repository = ENGINE.deploy(configuration);
                      // The name might not match the configuration's name ...
                      if (StringUtil.isBlank(repositoryName) || repository.getName().equals(repositoryName)) {
                          return repository;
                      LOG.warn(JcrI18n.repositoryNotFound, repositoryName, repositoryURL, parameters);
                      return null;
                  } catch (RepositoryException re) {
                      throw re;
                  } catch (Exception e) {
                      throw new RepositoryException(e);

      These lines do not exist in JNDIRepositoryLookup. So the configuration will be loaded again for every query because the repository will not be found in ModeShapeEngine (NoSuchRepositoryException) and furthermore internal modeshape caches will not work.