Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Spring modules jcr support error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring modules jcr support error

    Hi.
    This is my environment:
    • Jackrabbit 1.5.3
    • Spring 2.5.6
    • SpringModules 0.9
    • Tomcat 6
    • JVM 6 update 11


    I try to use springmodules for my own repository; these are my config files:

    gallery-jcr-base-namespace-nodetype-registration.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans>
    	
    	<bean id="jackrabbitSessionFactory" class="org.springmodules.jcr.jackrabbit.JackrabbitSessionFactory">
      		<property name="repository" ref="repository" />
    		<property name="credentials">
    			<bean class="javax.jcr.SimpleCredentials">
    				<constructor-arg index="0" value="bogus" />
     				<constructor-arg index="1">
    					<bean factory-bean="password" factory-method="toCharArray" />
    				</constructor-arg>
    			</bean>
    		</property>
    		
    		<property name="namespaces">
      			<props>
        			<prop key="dc">http://dublincore.org/documents/dcmi-namespace</prop>
        			<prop key="ocm">http://jackrabbit.apache.org/ocm</prop>
        			<prop key="eng">http://www.eng.it</prop>
       			</props>
     		</property>
    
    
    	</bean>
    
    </beans>

    gallery-jcr-configuration.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans>	
    
    	<bean id="repository" class="org.springmodules.jcr.jackrabbit.RepositoryFactoryBean" >
    		  <property name="configuration" value="classpath:repository.xml"/>
    		  <property name="homeDir" value="file:./tmp/repository"/>	
    	</bean>
    	<bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
    		<property name="repository" ref="repository" />
    		<property name="credentials">
    			<bean class="javax.jcr.SimpleCredentials">
    				<constructor-arg index="0" value="bogus" />
     				<constructor-arg index="1">
    					<bean factory-bean="password" factory-method="toCharArray" />
    				</constructor-arg>
    			</bean>
    		</property>
    		
    	</bean>
    	<bean id="password" class="java.lang.String">
    		<constructor-arg index="0" value="pass" />
    	</bean>
    	<bean id="jcrTransactionManager" class="org.springmodules.jcr.jackrabbit.LocalTransactionManager">
    	  <property name="sessionFactory" ref="jcrSessionFactory"/>
    	</bean>
    	<bean id="jcrtxProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    	    <property name="proxyTargetClass">
    	    	<value>true</value>
    	    </property>
    	    <property name="transactionManager" ref="jcrTransactionManager"/>
         	<property name="transactionAttributes">
    	      	<props>
    	        	<prop key="save*">PROPAGATION_REQUIRED</prop>
    	        	<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
    	       	</props>
         	</property>
    	</bean>
    	<bean id="transactionRepository" class="org.springmodules.jcr.TransactionAwareRepository">
        	<property name="allowNonTxRepository" value="true"/>
        	<property name="targetFactory" ref="jcrSessionFactory"/>
    	</bean>
    	<bean id="pages" class="org.springframework.beans.factory.config.ListFactoryBean">
      		<property name="sourceList">
          		<list>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFileResource</value>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFile</value>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFolder</value>
          		</list>
      		</property>
    	</bean>
    
    	<bean id="jcrMapper" class="org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl">
       		<constructor-arg index="0" ref="pages"/>
    	</bean>
    	<bean id="jcrMappingTemplate" class="org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate">
       		<property name="sessionFactory" ref="jcrSessionFactory"/>
       		<property name="mapper" ref="jcrMapper"/>
       		<property name="allowCreate" value="true"/>
    	</bean>
    </beans>
    gallery-jcr-manager.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans >
    
    	<bean id="jcrOcmObjManager" parent="jcrtxProxyTemplate">
    		<property name="target">
    			<bean class="it.eng.gallery2.manager.impl.JcrOcmObjManagerImpl">
    				<property name="jcrMappingTemplate" ref="jcrMappingTemplate"/>
    			</bean>
    		</property>
    	</bean>
    		
    </beans>

    In my web-app i have this web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app>
    
    	
    	<servlet>
    		<servlet-name>GalleryWeb</servlet-name>
    		<servlet-class>
    			org.springframework.web.servlet.DispatcherServlet
    		</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>GalleryWeb</servlet-name>
    		<url-pattern>*.controller</url-pattern>
    	</servlet-mapping>
      	<servlet-mapping>
        	<servlet-name>GalleryWeb</servlet-name>
        	<url-pattern>/galleryHome.htm</url-pattern>
     	</servlet-mapping>
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    					classpath:config/spring/gallery-view-controller.xml,
    					classpath:gallery-jcr-manager.xml,
    					classpath:gallery-jcr-configuration.xml
    		</param-value>
    	</context-param>	
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>
    	<servlet>
    		<servlet-name>ViewRendererServlet</servlet-name>
    		<servlet-class>
    			org.springframework.web.servlet.ViewRendererServlet
    		</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>ViewRendererServlet</servlet-name>
    		<url-pattern>/WEB-INF/servlet/view</url-pattern>
    	</servlet-mapping>
    </web-app>

    When i start my web application i get this error (i report the full stack trace):
    Code:
    ...
    2009-04-09 17:01:33,281 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'galleryHomeCTRL' defined in class path resource [config/spring/gallery-view-controller.xml]: 
    Cannot resolve reference to bean 'jcrOcmObjManager' while setting bean property 'jcrOcmObjManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jcrOcmObjManager' defined in class path resource [gallery-jcr-manager.xml]: Cannot resolve reference to bean 'jcrTransactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'jcrTransactionManager' defined in class path resource [gallery-jcr-configuration.xml]: Cannot resolve reference to bean 'jcrSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jcrSessionFactory' defined in class path resource [gallery-jcr-configuration.xml]: Cannot resolve reference to bean 'repository' while setting bean property 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repository' defined in class path resource [gallery-jcr-configuration.xml]: Invocation of init method failed; nested exception is javax.jcr.RepositoryException: The repository home C:\pr5sit\eclipse\tmp\repository appears to be in use since the file named .lock is already locked by the current process.

    It seems like if the repository is started twice......can anybody help me? Where am i missing anything?

    Thnx
    Angelo

    PS: I have posted the same thread in Spring Web; sorry i didn't see this forum section

  • #2
    Hi guys
    I'm still blocked here...
    I have tried to configure JackRabbit to access in JNDI way.
    My environment is always this one:
    • Jackrabbit 1.5.3
    • Spring 2.5.6
    • SpringModules 0.9
    • Tomcat 6
    • JVM 6 update 11

    In my ${web_app}/WEB-INF/META-INF/context.xml i have this context definition:

    Code:
    <Context path="GalleryWeb" crossContext="true">
    <Resource
    		name="jcr/galleryRepository"
    		auth="Container"
    		type="javax.jcr.Repository"
    		factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"	
    		configFilePath="${catalina.home}/jcr/repository.xml"  
    		repHomeDir="${catalina.home}/jcr/data"
    	/>	
    </Context>
    My gallery-jcr-configuration.xml is this one:


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    	                    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
    	                    http://www.springframework.org/schema/tx 
    	                    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
    	                    http://www.springframework.org/schema/aop 
    	                    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">	
    	<bean id="repository" class="org.springframework.jndi.JndiObjectFactoryBean">
     	 <property name="jndiName" value="java:comp/env/jcr/galleryRepository"/>
    	</bean>
    	<bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
    		<property name="repository" ref="repository" />
    		<property name="credentials">
    			<bean class="javax.jcr.SimpleCredentials">
    				<constructor-arg index="0" value="bogus" />
     				<constructor-arg index="1">
    					<bean factory-bean="password" factory-method="toCharArray" />
    				</constructor-arg>
    			</bean>
    		</property>
    		
    	</bean>
    	
    	<bean id="password" class="java.lang.String">
    		<constructor-arg index="0" value="pass" />
    	</bean>
    
    	<bean id="jcrTransactionManager" class="org.springmodules.jcr.jackrabbit.LocalTransactionManager">
    	  <property name="sessionFactory" ref="jcrSessionFactory"/>
    	</bean>
    
    	<bean id="jcrtxProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    	    <property name="proxyTargetClass">
    	    	<value>true</value>
    	    </property>
    	    <property name="transactionManager" ref="jcrTransactionManager"/>
         	<property name="transactionAttributes">
    	      	<props>
    	        	<prop key="save*">PROPAGATION_REQUIRED</prop>
    	        	<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
    	       	</props>
         	</property>
    	</bean>
    
    	<bean id="transactionRepository" class="org.springmodules.jcr.TransactionAwareRepository">
        	<property name="allowNonTxRepository" value="true"/>
        	<property name="targetFactory" ref="jcrSessionFactory"/>
    	</bean>
    
    	<bean id="pages" class="org.springframework.beans.factory.config.ListFactoryBean">
      		<property name="sourceList">
          		<list>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFileResource</value>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFile</value>
    				<value>it.eng.gallery2.manager.ocm.mapping.OcmFolder</value>
          		</list>
      		</property>
    	</bean>
    
    	<bean id="jcrMapper" class="org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl">
       		<constructor-arg index="0" ref="pages"/>
    	</bean>
    	
    	<!-- JCR Template Mapping Manager -->
    	<bean id="jcrMappingTemplate" class="org.springmodules.jcr.jackrabbit.ocm.JcrMappingTemplate">
       		<property name="sessionFactory" ref="jcrSessionFactory"/>
       		<property name="mapper" ref="jcrMapper"/>
       		<property name="allowCreate" value="true"/>
    	</bean>
    </beans>
    When i try to start my web app now i get this error:

    Code:
    Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.springmodules.jcr.jackrabbit.LocalTransactionManager] to required type [org.springframework.transaction.PlatformTransactionManager] for property 'transactionManager': no matching editors or conversion strategy found
    	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
    	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
    	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
    	... 55 more
    I need to solve this problem....how can i do?
    Does anybody try this kind of configuration?

    Comment

    Working...
    X