Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-1833

make core type registration raise informative exception message to help the developers pinpoint configuration problems more quickly

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 5.1.2
    • Fix Version/s: 5.1.x, 5.2 M4
    • Component/s: None

      Description

      For instance when registering a type that depends on a non registered schema (e.g. because of a typo in the schema name), the following exception is raised:

      org.nuxeo.ecm.core.api.ClientException: Failed to initialize repository
      at org.nuxeo.ecm.core.api.ejb.EJBExceptionHandler.wrapException(EJBExceptionHandler.java:70)
      at org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.getSession(DocumentManagerBean.java:191)
      at org.nuxeo.ecm.core.api.AbstractSession.connect(AbstractSession.java:171)
      at org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.connect(DocumentManagerBean.java:168)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      [snipped 100KB of useless stacktrace]

      Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: org.nuxeo.ecm.core.api.DocumentException. message: Failed to initialize repository
      at org.nuxeo.ecm.core.repository.jcr.JCRRepository.initialize(JCRRepository.java:161)
      at org.nuxeo.ecm.core.repository.jcr.JCRRepository.getSession(JCRRepository.java:98)
      at org.nuxeo.ecm.core.jca.JCAConnectionFactory.getSession(JCAConnectionFactory.java:81)
      at org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.createSession(DocumentManagerBean.java:201)
      at org.nuxeo.ecm.core.api.ejb.DocumentManagerBean.getSession(DocumentManagerBean.java:188)
      ... 392 more
      Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: java.lang.NullPointerException. message: null
      at org.nuxeo.ecm.core.repository.jcr.TypeAdapter.getSchemaName(TypeAdapter.java:87)
      at org.nuxeo.ecm.core.repository.jcr.TypeImporter.createDocTypeDefinition(TypeImporter.java:481)
      at org.nuxeo.ecm.core.repository.jcr.TypeImporter.collectDocTypes(TypeImporter.java:432)
      at org.nuxeo.ecm.core.repository.jcr.TypeImporter.registerTypes(TypeImporter.java:117)
      at org.nuxeo.ecm.core.repository.jcr.BuiltinTypes.registerUserTypes(BuiltinTypes.java:155)
      at org.nuxeo.ecm.core.repository.jcr.BuiltinTypes.registerTypes(BuiltinTypes.java:131)
      at org.nuxeo.ecm.core.repository.jcr.JCRRepository.initialize(JCRRepository.java:157)
      at org.nuxeo.ecm.core.repository.jcr.JCRRepository.getSession(JCRRepository.java:98)
      at org.nuxeo.ecm.core.jca.JCAConnectionFactory.getSession(JCAConnectionFactory.java:81)

      TypeAdapter should have raised a meaningful message such as :

      throw new InvalidConfigurationException(String.format("type '%s' could not be registered because schema '%s' was not found", typeName, schemaName));

      and then JCRRepository.initialize should catch that exception a rewrapped it as something like:

      throw new ClientException("Failed to initialize repository: " + e.getMessage(), e);

      so that the developers sees directly the top level error message:

      Failed to initialize repository: type 'MyType' could not be registered because schema 'my_schema_with_a_typo' was not found

      and then not have to parse hundreds of logs to know at which line of which class to put an eclipse breakpoint and restart jboss just to get the offending schema name.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified