jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Kalkhoff ...@ninan.info>
Subject Re: Did I miss the point about CND?
Date Fri, 29 Jun 2007 14:28:13 GMT
Hi Felix,

thank you a lot. Finally I got it working. For reference see my config:

	<bean id="sessionFactory"
		class="org.springmodules.jcr.jackrabbit.JackrabbitSessionFactory">
		<property name="repository" ref="repository" />
		<property name="contentType" value="text/x-jcr-cnd" />
		<property name="nodeDefinitions">
			<list>
				<value>classpath:/jcr/base.cnd</value>
				<value>classpath:/jcr/blog.cnd</value>
			</list>
		</property>
	</bean>

Please note that I had to use the constant value since Spring does  
not replace constants (AFAIK).

Anyway that isnĀ“t to problematic I guess. Now I will splay with the  
JcrTemplate... :-D

Regards

Christian

Am 29.06.2007 um 08:55 schrieb Felix Meschberger:

> Hi Christian,
>
> The CND file is not XML and it seems that the JackrabbitSessionFactory
> defaults to XML, you should probably set the session factory's  
> contentType
> property to  JackrabbitNodeTypeManager.TEXT_X_JCR_CND. This may help.
>
> Regards
> Felix
>
> PS: And yes, I just looked at the source code and no, I do not more of
> SpringModules :-)
>
> On 6/28/07, Christian Kalkhoff <me@ninan.info> wrote:
>>
>> Hi,
>> today I tried to build my first node types. I integrate jackrabbit  
>> 1.3using spring-modules
>> 0.8.
>>
>> I defined my base.cnd:
>>
>> /*
>>  * Basic types for ninan.info
>>  */
>> <ninan="http://ninan.info/">
>>
>> [ninan:Content]
>> > mix:referenceable, mix:versionable
>>
>> - ninan:hidden (BOOLEAN) = TRUE
>> - ninan:urlTitle (STRING)
>> - ninan:startDate (DATE)
>> - ninan:endDate (DATE)
>> - ninan:tags (STRING) multiple
>>
>> Starting my tomcat I get:
>>
>> [Fatal Error] :1:1: Content is not allowed in prolog.
>> 2007-06-28 22:24:34,013 [main] ERROR org.springframework.
>> web.context.ContextLoader - Context initialization failed
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'blogService' defined in class path resource [
>> applicationContext.xml]: Cannot create inner bean '
>> info.ninan.blog.impl.JcrBlogDAO#48e385' of type [
>> info.ninan.blog.impl.JcrBlogDAO] while setting bean property  
>> 'blogDAO';
>> nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'info.ninan.blog.impl.JcrBlogDAO#48e385' defined in  
>> class
>> path resource [applicationContext.xml]: Cannot resolve reference  
>> to bean
>> 'jcrTemplate' while setting bean property 'template'; nested  
>> exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'jcrTemplate' defined in class path resource [
>> applicationContext.xml]: Cannot resolve reference to bean  
>> 'sessionFactory'
>> while setting bean property 'sessionFactory'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'sessionFactory' defined in class path resource [
>> applicationContext.xml]: Invocation of init method failed; nested
>> exception is java.io.IOException: Content is not allowed in prolog.
>> Caused by:
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'info.ninan.blog.impl.JcrBlogDAO#48e385' defined in  
>> class
>> path resource [applicationContext.xml]: Cannot resolve reference  
>> to bean
>> 'jcrTemplate' while setting bean property 'template'; nested  
>> exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'jcrTemplate' defined in class path resource [
>> applicationContext.xml]: Cannot resolve reference to bean  
>> 'sessionFactory'
>> while setting bean property 'sessionFactory'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'sessionFactory' defined in class path resource [
>> applicationContext.xml]: Invocation of init method failed; nested
>> exception is java.io.IOException: Content is not allowed in prolog.
>> Caused by:
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'jcrTemplate' defined in class path resource [
>> applicationContext.xml]: Cannot resolve reference to bean  
>> 'sessionFactory'
>> while setting bean property 'sessionFactory'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'sessionFactory' defined in class path resource [
>> applicationContext.xml]: Invocation of init method failed; nested
>> exception is java.io.IOException: Content is not allowed in prolog.
>> Caused by:
>> org.springframework.beans.factory.BeanCreationException: Error  
>> creating
>> bean with name 'sessionFactory' defined in class path resource [
>> applicationContext.xml]: Invocation of init method failed; nested
>> exception is java.io.IOException: Content is not allowed in prolog.
>> Caused by:
>> java.io.IOException: Content is not allowed in prolog.
>>         at org.apache.jackrabbit.core.util.DOMWalker.<init> 
>> (DOMWalker.java
>> :65)
>>         at  
>> org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader.<init>(
>> NodeTypeReader.java:90)
>>         at
>> org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.registerNodeT 
>> ypes(
>> NodeTypeManagerImpl.java:224)
>>         at
>> org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl.registerNodeT 
>> ypes(
>> NodeTypeManagerImpl.java:475)
>>         at
>> org.springmodules.jcr.jackrabbit.JackrabbitSessionFactory.registerNod 
>> eTypes
>> (JackrabbitSessionFactory.java:67)
>>         at  
>> org.springmodules.jcr.JcrSessionFactory.afterPropertiesSet(
>> JcrSessionFactory.java:126)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.invokeInitMethods
>> (AbstractAutowireCapableBeanFactory.java:1202)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.initializeBean
>> (AbstractAutowireCapableBeanFactory.java:1172)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.createBean
>> (AbstractAutowireCapableBeanFactory.java:428)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory 
>> $1.getObject(
>> AbstractBeanFactory.java:251)
>>         at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr 
>> y.getSingleton
>> (DefaultSingletonBeanRegistry.java:156)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:248)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:160)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveReference
>> (BeanDefinitionValueResolver.java:261)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveValueIfNecessary
>> (BeanDefinitionValueResolver.java:109)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.applyPropertyValues
>> (AbstractAutowireCapableBeanFactory.java:1100)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.populateBean
>> (AbstractAutowireCapableBeanFactory.java:862)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.createBean
>> (AbstractAutowireCapableBeanFactory.java:424)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory 
>> $1.getObject(
>> AbstractBeanFactory.java:251)
>>         at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr 
>> y.getSingleton
>> (DefaultSingletonBeanRegistry.java:156)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:248)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:160)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveReference
>> (BeanDefinitionValueResolver.java:261)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveValueIfNecessary
>> (BeanDefinitionValueResolver.java:109)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.applyPropertyValues
>> (AbstractAutowireCapableBeanFactory.java:1100)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.populateBean
>> (AbstractAutowireCapableBeanFactory.java:862)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.createBean
>> (AbstractAutowireCapableBeanFactory.java:424)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveInnerBean
>> (BeanDefinitionValueResolver.java:215)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver 
>> .resolveValueIfNecessary
>> (BeanDefinitionValueResolver.java:122)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.applyPropertyValues
>> (AbstractAutowireCapableBeanFactory.java:1100)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.populateBean
>> (AbstractAutowireCapableBeanFactory.java:862)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBean 
>> Factory.createBean
>> (AbstractAutowireCapableBeanFactory.java:424)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory 
>> $1.getObject(
>> AbstractBeanFactory.java:251)
>>         at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistr 
>> y.getSingleton
>> (DefaultSingletonBeanRegistry.java:156)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:248)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean 
>> (
>> AbstractBeanFactory.java:160)
>>         at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory. 
>> preInstantiateSingletons
>> (DefaultListableBeanFactory.java:287)
>>         at
>> org.springframework.context.support.AbstractApplicationContext.refres 
>> h(
>> AbstractApplicationContext.java:352)
>>         at org.springframework.
>> web.context.ContextLoader.createWebApplicationContext 
>> (ContextLoader.java
>> :244)
>>         at org.springframework.
>> web.context.ContextLoader.initWebApplicationContext 
>> (ContextLoader.java
>> :187)
>>         at org.springframework.
>> web.context.ContextLoaderListener.contextInitialized(
>> ContextLoaderListener.java:49)
>>         at org.apache.catalina.core.StandardContext.listenerStart(
>> StandardContext.java:3763)
>>         at org.apache.catalina.core.StandardContext.start(
>> StandardContext.java:4211)
>>         at org.apache.catalina.core.ContainerBase.start 
>> (ContainerBase.java
>> :1013)
>>         at org.apache.catalina.core.StandardHost.start 
>> (StandardHost.java
>> :718)
>>         at org.apache.catalina.core.ContainerBase.start 
>> (ContainerBase.java
>> :1013)
>>         at org.apache.catalina.core.StandardEngine.start(
>> StandardEngine.java:442)
>>         at org.apache.catalina.core.StandardService.start(
>> StandardService.java:450)
>>         at org.apache.catalina.core.StandardServer.start(
>> StandardServer.java:709)
>>         at org.apache.catalina.startup.Catalina.start 
>> (Catalina.java:551)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native  
>> Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:39)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:585)
>>         at org.apache.catalina.startup.Bootstrap.start 
>> (Bootstrap.java:294)
>>         at org.apache.catalina.startup.Bootstrap.main 
>> (Bootstrap.java:432)
>> Caused by: org.xml.sax.SAXParseException: Content is not allowed in
>> prolog.
>>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
>> Source)
>>         at javax.xml.parsers.DocumentBuilder.parse 
>> (DocumentBuilder.java
>> :98)
>>         at org.apache.jackrabbit.core.util.DOMWalker.<init> 
>> (DOMWalker.java
>> :60)
>>         ... 55 more
>>
>> As far as I can see jackrabbit is reading the cnd file as xml. But  
>> it is
>> the CND format. On the website I found a reference to the "OLD"  
>> XML format
>> and the new CND format. So in the stable release 1.3 is there  
>> support for
>> the new CND format or am I stuck to that XML based definitions?
>>
>> I hope you can help me get things clear.
>>
>> Regards
>>
>> Christian
>> --
>> Christian Kalkhoff <me@ninan.info>
>> Softwareentwickler und Administrator
>> http://ninan.info
>> http://www.kalkhoff.net
>>
>>
>>
>>

--
Christian Kalkhoff <me@ninan.info>
Softwareentwickler und Administrator
http://ninan.info
http://www.kalkhoff.net



Mime
View raw message