Announcement Announcement Module
No announcement yet.
Node type registration and namespaces Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Node type registration and namespaces


    I'm getting some troubles registering node types (in CND format) when they belong to certain namespaces.

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'jcrSessionFactory' defined in class path resource [application-context.xml]: 
    Invocation of init method failed; nested exception is 
    Error while parsing 'simbel:newsletter' (cnd input stream, line 1)
    Caused by: Error while parsing 'simbel:newsletter' (cnd input stream, line 1)
    Here is the part of the configuration file
      <bean id="jcrSessionFactory" class="org.springframework.extensions.jcr.jackrabbit.JackrabbitSessionFactory">
        <property name="repository" ref="repository"/>
        <property name="credentials">
          <bean class="javax.jcr.SimpleCredentials">
            <constructor-arg index="0" value="name"/>
            <constructor-arg index="1" value="pass"/>
        <property name="namespaces">
            <prop key="simbel">http://be.yp5/jcr/simbel</prop>
        <property name="contentType" value="text/x-jcr-cnd"/>
        <property name="nodeDefinitions">
    And the cnd file :
    [simbel:newsletter] > nt:base
        - name (String)
            primary mandatory
        + * (simbel:issue)
    [simbel:issue] > nt:base
        - name (String)
           primary mandatory
        - number (Long)
        - publicationDate (Date)
        - status (String)
        - archived (Boolean)
    If I remove the simbel namespace from the node types names, I don't get any exception.

    So I've looked into the code and found this in JcrSessionFactory :
    in the afterPropertiesSet method.

    Shouldn't the calls be inverted in order to first register the namespaces and the the node types ?

    Also, I've tried to apply the patches attached to SEJCR-17 and SEJCR-18, but I get errors.
    The first patch (SEJCR-17) is ok, everything is well patched. But when I try to apply those attached to SEJCR-18, patch tells me :
    $ patch -p0 < /home/bdusauso/Downloads/session_not_closed_after_registerNamespace.patch 
    patching file src/main/java/org/springframework/extensions/jcr/
    Reversed (or previously applied) patch detected!  Assume -R? [n] 
    Apply anyway? [n] 
    Skipping patch.
    10 out of 10 hunks ignored -- saving rejects to file src/main/java/org/springframework/extensions/jcr/
    $ patch -p0 < /home/bdusauso/Downloads/jcrsessionfactorytest.patch
    patching file src/test/java/org/springframework/extensions/jcr/
    Hunk #1 FAILED at 15.
    Hunk #2 FAILED at 63.
    Hunk #3 FAILED at 77.
    Hunk #4 FAILED at 87.
    Hunk #5 FAILED at 98.
    Hunk #6 FAILED at 106.
    Hunk #7 FAILED at 135.
    Hunk #8 FAILED at 165.
    Hunk #10 FAILED at 226.
    Hunk #11 FAILED at 256.
    Hunk #12 FAILED at 294.
    Hunk #13 FAILED at 315.
    Hunk #14 FAILED at 325.
    Hunk #15 FAILED at 357.
    14 out of 15 hunks FAILED -- saving rejects to file src/test/java/org/springframework/extensions/jcr/
    Could someone shed some light on this ?

  • #2
    I messed up when creating a patch for 18 and it ended up including changes for 17 as well.

    I just attached a clean patch to 18 (Session_not_close_after_registerNamespaces.patch) that applies cleanly on top of 17.

    Give it a try and let me know if it solves your issues.


    • #3
      This Issue was resolved in