IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Web Java Discussion :

Tomcat ne voit pas ehcache.xml


Sujet :

Spring Web Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    75
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2006
    Messages : 75
    Par défaut Tomcat ne voit pas ehcache.xml
    Bonjour à tous

    Je suis confronté à un problème assez étrange depuis hier matin.

    Je fais une petite appli en spring. Je gère le cache, or lorsque je lance tomcat j'ai une FileNotFoundException à cause de ehcache.xml que tomcat n'arrive pas à trouver.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
     
    GRAVE: Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProcessingFilter' defined in ServletContext resource [/WEB-INF/vadmin-security.xml]: Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager' defined in ServletContext resource [/WEB-INF/vadmin-security.xml]: Cannot resolve reference to bean 'daoAuthenticationProvider' while setting bean property 'providers'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider' defined in ServletContext resource [/WEB-INF/vadmin-security.xml]: Cannot create inner bean 'org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache#186f3b3' of type [org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache] while setting bean property 'userCache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache#186f3b3' defined in ServletContext resource [/WEB-INF/vadmin-security.xml]: Cannot resolve reference to bean 'ehcache' while setting bean property 'cache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in ServletContext resource [/WEB-INF/vadmin-security.xml]: Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager': Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [ehcache.xml] cannot be opened because it does not exist
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
    	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	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:597)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Alors que mon classpath est bien correcte dans le sens où il mène jusqu'à mon fichier ehcache.xml :
    $ echo $CLASSPATH
    ....:/home/redsonic/workspace/vadmin1/war/WEB-INF

    ehcache.xml est bien sous WEB-INF

    Mon fichier vadmin-security.xml fait appel à ehcache.xml comme suit :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
      <property name="configLocation" value="classpath:/ehcache.xml" />
    </bean>
    Autre chose, si je fais appel à un fichier properties (db.properties qui se trouve au même endroit), là ça marche (grâce au classpath).

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <!-- je mets les deux choix : classpath ou chemin complet -->
        <!-- <property name="location" value="classpath:/db.properties" /> -->
     
        <property name="location" value="file:/home/reda/workspace/vadmin1/war/WEB-INF/db.properties" />
     
     
      </bean>
    Pourquoi une fois le classpath m'a été utile pour trouver mon fichier de configuration (db.properties) et une fois il ne l'a pas (ehcache.xml)


    Merci à ceux qui veulent bien m'éclairer.
    Je suis preneur de bonnes solutions et de bonnes méthodes

  2. #2
    Membre expérimenté Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <!-- je mets les deux choix : classpath ou chemin complet -->
        <!-- <property name="location" value="classpath:/db.properties" /> -->
     
        <property name="location" value="file:/home/reda/workspace/vadmin1/war/WEB-INF/db.properties" />
     
     
      </bean>
    c'est normale que ça marche un fichier .properties puisque c'est fait pour.
    pour ehcache, tu peux utiliser quelque chose comme ça:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    		    classpath:ehcache.xml	  
     
    		</param-value>
    	</context-param>
    ça marche pour moi.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    75
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2006
    Messages : 75
    Par défaut
    pour ehcache, tu peux utiliser quelque chose comme ça:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    		    classpath:ehcache.xml	  
     
    		</param-value>
    	</context-param>
    Merci pour ta réponse mais je mets ça ou ?

  4. #4
    Membre expérimenté Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Par défaut
    Citation Envoyé par redsonic Voir le message
    Merci pour ta réponse mais je mets ça ou ?
    dans ton web.xml

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    75
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2006
    Messages : 75
    Par défaut
    Citation Envoyé par aymen83 Voir le message
    dans ton web.xml
    C'est pas bon :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    GRAVE: Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [ehcache.xml]; nested exception is java.io.FileNotFoundException: class path resource [ehcache.xml] cannot be opened because it does not exist
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
    	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
    	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
    	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: class path resource [ehcache.xml] cannot be opened because it does not exist
    	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:142)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    	... 28 more
    29 avr. 2009 13:38:32 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    Je l'ai bien inséré dans mon fichier web.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
     
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
    <!-- /WEB-INF/vadmin-service.xml  -->
         /WEB-INF/vadmin-data.xml     
         /WEB-INF/vadmin-security.xml
         /WEB-INF/vadmin-cache.xml 
         classpath:ehcache.xml   
      </param-value>
    </context-param>

  6. #6
    Membre expérimenté Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <bean id="ehCacheManager"
    		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    		<property name="configLocation" value="classpath:ehcache.xml" />
    	</bean>
    peut qu'en elevant le slash.

Discussions similaires

  1. [TOMCAT] parametrage du fichier web.xml
    Par sebos63 dans le forum Tomcat et TomEE
    Réponses: 12
    Dernier message: 06/05/2010, 12h09
  2. Réponses: 7
    Dernier message: 07/01/2008, 15h56
  3. tomcat ne voit pas un fichier
    Par allstar dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 26/02/2006, 08h23
  4. [Debutant(e)]Eclipse ne voit pas les sources
    Par uliss dans le forum Eclipse Java
    Réponses: 3
    Dernier message: 04/08/2004, 09h34
  5. [TomCat][sécurité]config fichier web.xml
    Par liomac dans le forum Tomcat et TomEE
    Réponses: 6
    Dernier message: 24/09/2003, 15h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo