Results 1 to 9 of 9

Thread: I'm having problem setting my cache using Spring version 2.5 and spring-modules-0.8

  1. #1
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    14

    Default I'm having problem setting my cache using Spring version 2.5 and spring-modules-0.8

    Hi,
    I'm having problem setting my cache using Spring version 2.5 and spring-modules-0.8-all: this the error i get :
    org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/applicationContex
    t-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The element type "META" must be terminated by the matching end-tag "</M
    ETA>".

    this is my Xml config:



    <!-- Cach -->
    <bean id="cacheManager"
    class="org.springframework.cache.ehcache.EhCacheMa nagerFactoryBean">
    <property name="configLocation" value="classpath:/ehcache.xml" />
    </bean>

    <!-- Cache provider -->
    <bean id="cacheProvider"
    class="org.springmodules.cache.provider.ehcache.Eh CacheFacade">
    <property name="cacheManager" ref="cacheManager" />
    </bean>

    <ehcache:annotations>
    <ehcache:caching id="testCaching"
    cacheName="getLocationCache" />
    </ehcache:annotations>


    this my ehcache.xml:

    <ehcache>
    <diskStore path="java.io.tmpdir" />
    <defaultCache maxElementsInMemory="10" eternal="false"
    timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" />

    <cache name="getLocationCache" maxElementsInMemory="50" eternal="false"
    overflowToDisk="true" timeToIdleSeconds="0" timeToLiveSeconds="86400" />

    </ehcache>

  2. #2

    Default

    It looks like the xml parser is having an issue parsing your "applicationContext-security.xml" file.

    Can you post the entire file?

  3. #3
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    14

    Default

    Quote Originally Posted by joshr View Post
    It looks like the xml parser is having an issue parsing your "applicationContext-security.xml" file.

    Can you post the entire file?
    Good day,
    this is the Xml file:

    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:ehcache="http://www.springmodules.org/schema/ehcache"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                               http://www.springmodules.org/schema/ehcache
                               http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd">
    
    	<!-- Cach -->
    	<bean id="cacheManager"
    		class="org.springframework.cache.ehcache.EhCacheMa nagerFactoryBean">
    		<property name="configLocation" value="classpath:/ehcache.xml" />
    	</bean>
    
    	<!-- Cache provider -->
    	<bean id="cacheProvider"
    		class="org.springmodules.cache.provider.ehcache.Eh CacheFacade">
    		<property name="cacheManager" ref="cacheManager" />
    	</bean>
    
    	<ehcache:annotations>
    		<ehcache:caching id="testCaching" cacheName="getLocationCache" />
    	</ehcache:annotations>
    
    </beans>

  4. #4

    Default

    I think that the xml parser is having problems with this portion of your xml file.


    Code:
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                               http://www.springmodules.org/schema/ehcache
                               http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd">
    try putting all of the schemaLocation on one line.

    Code:
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springmodules.org/schema/ehcache http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd">
    At least that should hopefully take care of the error that was given (Looks like where line 8 is in your file)?

    Code:
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/applicationContext-security.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The element type "META" must be terminated by the matching end-tag "</META>".

  5. #5
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    14

    Default

    Hi,
    Still same problem.
    any more advices.
    Regards

  6. #6

    Default

    the only other thing I can think of is there was a problem with the schema being recognized in previous spring-modules version's. Try upgrading to 0.9?

    Let me know if that works... If it doesn't I'll see if I can come up with a demo-application for you.

  7. #7
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    14

    Default

    Hi,
    I have tried with the new version but still same problem.
    Thanks for your help and advises.
    Regards.

  8. #8
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    14

    Default

    Quote Originally Posted by tagabd View Post
    Hi,
    I have tried with the new version but still same problem.
    Thanks for your help and advises.
    Regards.
    hi,
    I have fixed by adding the spring-modules-cache.jar not spring-modules-0.9-all.jar.
    one question how do i know my values are cached.
    Regards

  9. #9

    Default

    you can do a simple test with a controller and a log file...

    i.e. have an interface method annotated with the cache, and then from the web controller call that method (So you can just refresh the page). Have an id or something in the web link that you can change by hand. In the method just have something that prints to the log file when the method is called and returns a random number. So that if you pass the same id and you get the same number instead of another random number it should be getting it from the cache. Turn on debug level too, so you can see what's going on.

    OR

    Of course if you want to be more informed you should look into writing some unit test's that fits with whatever you are trying to accomplish. And actually look in the cache to see if the value was cached and correctly, etc...
    Last edited by joshr; Jan 22nd, 2009 at 05:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •