Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: jackrabbit-jca
    • Labels:
      None
    • Environment:
      oc4j 10.1.3

      Description

      I run jackrabbit jca on oc4j 10.1.3.
      First time the server is started I execute the following code on the empty repository :

      JackrabbitNodeTypeManager manager =
      (JackrabbitNodeTypeManager)session.getWorkspace().getNodeTypeManager();
      InputStream nodeTypes = this.getClass().getClassLoader().getResourceAsStream(res);
      manager.registerNodeTypes(nodeTypes, JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
      session.save();

      This works fine. I can create nodes of custom type. However when restarting the server I get the following error:

      Error creating a Connection Factory from class 'org.apache.jackrabbit.jca.JCAManagedConnectionFactory'. Reason: javax.resource.ResourceException: Failed to create session: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml:

      custom_nodetypes.xml exists but is empty.

        Activity

        Magnus Grimsell created issue -
        Jukka Zitting made changes -
        Field Original Value New Value
        Workflow jira [ 12387926 ] no-reopen-closed, patch-avail [ 12467945 ]
        Hide
        Davide Maestroni added a comment -

        This bug is still present in version 2.0.

        I am working with Sling (checkedout from SVN trunk with revision number 958559) deployed into an instance of Jetty (version 7.1.4.v20100610), and got the same issue when restarting the server.
        Below the exception traced in the log file:

        30.06.2010 14:46:00.551 INFO [SCR Component Actor] org.apache.felix.scr Running task: Enable Component: org.apache.sling.jcr.jackrabbit.server.SlingServerRepository (9)
        30.06.2010 14:46:00.600 INFO [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Using configuration URL file:/usr/share/jetty/cms/jackrabbit/repository.xml
        30.06.2010 14:46:00.783 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Starting repository...
        30.06.2010 14:46:00.787 INFO [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path /usr/share/jetty/cms/jackrabbit/repository
        30.06.2010 14:46:01.392 ERROR [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml javax.jcr.RepositoryException: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.loadCustomNodeTypeDefs(NodeTypeRegistry.java:837)
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.<init>(NodeTypeRegistry.java:749)
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.create(NodeTypeRegistry.java:126)
        at org.apache.jackrabbit.core.RepositoryImpl.createNodeTypeRegistry(RepositoryImpl.java:660)
        at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:332)
        at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
        at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.acquireRepository(SlingServerRepository.java:141)
        at org.apache.sling.jcr.base.AbstractSlingRepository.startRepository(AbstractSlingRepository.java:831)
        at org.apache.sling.jcr.base.AbstractSlingRepository.activate(AbstractSlingRepository.java:640)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213)
        at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
        at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542)
        at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434)
        at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:138)
        at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226)
        at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
        at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:991)
        at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:298)
        at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:138)
        at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67)
        at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96)
        at java.lang.Thread.run(Thread.java:636)
        Caused by: java.io.IOException: Premature end of file.
        at org.apache.jackrabbit.core.util.DOMWalker.<init>(DOMWalker.java:65)
        at org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.<init>(NodeTypeReader.java:108)
        at org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.read(NodeTypeReader.java:77)
        at org.apache.jackrabbit.core.nodetype.NodeTypeDefStore.load(NodeTypeDefStore.java:63)
        at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.loadCustomNodeTypeDefs(NodeTypeRegistry.java:831)
        ... 25 more
        Caused by: org.xml.sax.SAXParseException: Premature end of file.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
        at org.apache.jackrabbit.core.util.DOMWalker.<init>(DOMWalker.java:60)
        ... 29 more
        30.06.2010 14:46:01.394 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Shutting down repository...
        30.06.2010 14:46:01.398 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Repository has been shutdown

        Show
        Davide Maestroni added a comment - This bug is still present in version 2.0. I am working with Sling (checkedout from SVN trunk with revision number 958559) deployed into an instance of Jetty (version 7.1.4.v20100610), and got the same issue when restarting the server. Below the exception traced in the log file: 30.06.2010 14:46:00.551 INFO [SCR Component Actor] org.apache.felix.scr Running task: Enable Component: org.apache.sling.jcr.jackrabbit.server.SlingServerRepository (9) 30.06.2010 14:46:00.600 INFO [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Using configuration URL file:/usr/share/jetty/cms/jackrabbit/repository.xml 30.06.2010 14:46:00.783 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Starting repository... 30.06.2010 14:46:00.787 INFO [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path /usr/share/jetty/cms/jackrabbit/repository 30.06.2010 14:46:01.392 ERROR [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl failed to start Repository: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml javax.jcr.RepositoryException: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.loadCustomNodeTypeDefs(NodeTypeRegistry.java:837) at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.<init>(NodeTypeRegistry.java:749) at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.create(NodeTypeRegistry.java:126) at org.apache.jackrabbit.core.RepositoryImpl.createNodeTypeRegistry(RepositoryImpl.java:660) at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:332) at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673) at org.apache.sling.jcr.jackrabbit.server.impl.SlingServerRepository.acquireRepository(SlingServerRepository.java:141) at org.apache.sling.jcr.base.AbstractSlingRepository.startRepository(AbstractSlingRepository.java:831) at org.apache.sling.jcr.base.AbstractSlingRepository.activate(AbstractSlingRepository.java:640) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:213) at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38) at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:542) at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:434) at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:138) at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226) at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118) at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:991) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:298) at org.apache.felix.scr.impl.manager.AbstractComponentManager$1.doRun(AbstractComponentManager.java:138) at org.apache.felix.scr.impl.ComponentActivatorTask.run(ComponentActivatorTask.java:67) at org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:96) at java.lang.Thread.run(Thread.java:636) Caused by: java.io.IOException: Premature end of file. at org.apache.jackrabbit.core.util.DOMWalker.<init>(DOMWalker.java:65) at org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.<init>(NodeTypeReader.java:108) at org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.read(NodeTypeReader.java:77) at org.apache.jackrabbit.core.nodetype.NodeTypeDefStore.load(NodeTypeDefStore.java:63) at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.loadCustomNodeTypeDefs(NodeTypeRegistry.java:831) ... 25 more Caused by: org.xml.sax.SAXParseException: Premature end of file. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at org.apache.jackrabbit.core.util.DOMWalker.<init>(DOMWalker.java:60) ... 29 more 30.06.2010 14:46:01.394 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Shutting down repository... 30.06.2010 14:46:01.398 INFO [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Repository has been shutdown
        Hide
        Marek Slama added a comment -

        Still present in 2.4.0. Only workaround I found is to modify directly jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd. In my case I only needed to add small modification of nt:unstructured. I added new type directly to builtin_nodetypes.cnd. I know it is only workaround till this issue is fixed.

        Show
        Marek Slama added a comment - Still present in 2.4.0. Only workaround I found is to modify directly jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd. In my case I only needed to add small modification of nt:unstructured. I added new type directly to builtin_nodetypes.cnd. I know it is only workaround till this issue is fixed.
        Hide
        Stefano Padovan added a comment -

        Another workaround: have a script that checks if custom_nodetypes.xml becomes 0-byte. When it does, replace it with the last read non o-byte found. At the next restart issue will not be present.

        This means that sling restart is successful when xml file is not empty. Then sometimes it becomes empty, but the system will keppe running fine until the next restart. If the file is restored in between, issue will not be resent at next restart.

        Just a tip for whoever is looking into this issue....

        Show
        Stefano Padovan added a comment - Another workaround: have a script that checks if custom_nodetypes.xml becomes 0-byte. When it does, replace it with the last read non o-byte found. At the next restart issue will not be present. This means that sling restart is successful when xml file is not empty. Then sometimes it becomes empty, but the system will keppe running fine until the next restart. If the file is restored in between, issue will not be resent at next restart. Just a tip for whoever is looking into this issue....

          People

          • Assignee:
            Unassigned
            Reporter:
            Magnus Grimsell
          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development