Hi,

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

Code:
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 java.io.IOException: 
Error while parsing 'simbel:newsletter' (cnd input stream, line 1)
[...]
Caused by: java.io.IOException: Error while parsing 'simbel:newsletter' (cnd input stream, line 1)
Here is the part of the configuration file
Code:
  <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"/>
      </bean>
    </property>
    <property name="namespaces">
      <props>
        <prop key="simbel">http://be.yp5/jcr/simbel</prop>
      </props>
    </property>
    <property name="contentType" value="text/x-jcr-cnd"/>
    <property name="nodeDefinitions">
      <list>
        <value>classpath:simbel-nodes.cnd</value>
      </list>
    </property>
  </bean>
And the cnd file :
Code:
[simbel:newsletter] > nt:base
    - name (String)
        primary mandatory
    + * (simbel:issue)
        multiple

[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 :
Code:
    registerNodeTypes();
    registerNamespaces();
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 :
Code:
$ patch -p0 < /home/bdusauso/Downloads/session_not_closed_after_registerNamespace.patch 
patching file src/main/java/org/springframework/extensions/jcr/JcrSessionFactory.java
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/JcrSessionFactory.java.rej
$ patch -p0 < /home/bdusauso/Downloads/jcrsessionfactorytest.patch
patching file src/test/java/org/springframework/extensions/jcr/JcrSessionFactoryTest.java
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/JcrSessionFactoryTest.java.rej
Could someone shed some light on this ?