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 Java Discussion :

configuration applicationContext spring avec hibernate [Data]


Sujet :

Spring Java

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Février 2007
    Messages
    120
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 120
    Points : 83
    Points
    83
    Par défaut configuration applicationContext spring avec hibernate
    Bonjour, voici mon fichier applicationContaxt d'une application Spring avec Hibernate mais j'ai une erreur au démarrage du context...cela peut il provenir d'une erreur de mon fichier?

    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
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    <?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:p="http://www.springframework.org/schema/p"
           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/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     
        <!-- Propriétés de Connection -->
        <bean id="dataSource"
    	class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    	destroy-method="close">
            <property name="driverClassName">
                <value>com.mysql.jdbc.Driver</value>
            </property>
            <property name="url">
                <value>jdbc:mysql://localhost/calendat</value>
            </property>
            <property name="username">
                <value>root</value>
            </property>
            <property name="password">
                <value></value>
            </property>
        </bean>
     
        <!-- Propriétés d'Hibernate -->
        <bean id="myHibernateProperties"
    	class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="properties">
                <props>
                    <prop key="hibernate.dialect">
    				org.hibernate.dialect.MySQLDialect
                    </prop>
                    <prop key="hibernate.show_sql">true</prop>
                </props>
            </property>
        </bean>
     
        <!-- Session Factory -->
        <bean id="sessionFactory"
    	class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="annotatedClasses">
                <list>
                    <value>beans.Users</value>
                </list>
            </property>
            <property name="hibernateProperties">
                <ref bean="myHibernateProperties" />
            </property>
            <property name="dataSource">
                <ref bean="dataSource" />
            </property>
        </bean>
     
        <!-- Hibernate Template -->
        <bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
            <property name="dataSource">
                <ref bean="dataSource" />
            </property>
        </bean>
        <bean
    	id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
            <property name="sessionFactory">
                <ref bean="sessionFactory" />
            </property>
            <property name="jdbcExceptionTranslator">
                <ref bean="jdbcExceptionTranslator" />
            </property>
        </bean>
     
        <!-- UserDao -->
        <bean id="UserDAO" class="dao.UserDAO">
            <property name="hibernateTemplate">
                <ref bean="hibernateTemplate" />
            </property>
        </bean>
     
        <!-- Service -->
        <bean id="UserBO" class="service.UserService">
            <property name="userDAO">
                <ref local="UserDAO" />
            </property>
        </bean>
     
        <bean id="transactionManager"
    	class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory">
                <ref local="sessionFactory" />
            </property>
        </bean>
        <bean id="UserService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager">
                <ref local="transactionManager" />
            </property>
            <property name="proxyTargetClass" value="true" />
            <property name="target">
                <ref local="UserBO" />
            </property>
            <property name="transactionAttributes">
                <props>
                    <prop key="changePassword">PROPAGATION_REQUIRED</prop>
                </props>
            </property>
        </bean>
     
    </beans>

  2. #2
    Membre actif Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Points : 268
    Points
    268
    Par défaut
    bonjour,
    est ce que tu peux poster le log pour qu'on puisse t'aider?

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Février 2007
    Messages
    120
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 120
    Points : 83
    Points
    83
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    25 mai 2009 14:48:48 org.apache.catalina.core.StandardContext stop
    INFO: Le conteneur org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/WebApplication2] n'a pas été démarré
    25 mai 2009 14:48:48 org.apache.catalina.startup.HostConfig checkResources
    INFO: Repli (undeploy) de l'application web ayant pour chemin de contexte /WebApplication2
    25 mai 2009 14:48:49 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    25 mai 2009 14:48:49 org.apache.catalina.core.StandardContext start
    GRAVE: Erreur de démarrage du contexte [/WebApplication2] suite aux erreurs précédentes
    25 mai 2009 14:48:49 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    25 mai 2009 14:48:49 org.apache.catalina.core.StandardContext start
    GRAVE: Erreur de démarrage du contexte [/WebApplication2] suite aux erreurs précédentes
    Le problème survient lorsque je configure mon "dataSource" dans mon "applicationContext"

    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
    <!-- Propriétés de Connection -->
        <bean id="dataSource"
    	class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    	destroy-method="close">
            <property name="driverClassName">
                <value>com.mysql.jdbc.Driver</value>
            </property>
            <property name="url">
                <value>jdbc:mysql://localhost//calendat</value>
            </property>
            <property name="username">
                <value>root</value>
            </property>
            <property name="password">
                <value></value>
            </property>
        </bean>

  4. #4
    Membre actif Avatar de aymen83
    Inscrit en
    Décembre 2007
    Messages
    271
    Détails du profil
    Informations forums :
    Inscription : Décembre 2007
    Messages : 271
    Points : 268
    Points
    268
    Par défaut
    tu peux aussi la configurer dans le fichier context.xml de tomcat. Je crois que ça marchera comme ça. Mais au cas ou j'ai cru comprendre la Spring team a développez un petit module dont j'ai oublié le nom exacte "spring-tomcat-weaver" je crois, ça pouurait t'aider. Mais n'oublie pas tout de meme d'ajouter ton driver JDBC au libs de tomcat

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Février 2007
    Messages
    120
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 120
    Points : 83
    Points
    83
    Par défaut
    J'ai vérifié ma version du jar mysql connector et en effet c'était cela...Merci bien je vais jeter un coup d'oeil à ce module également.

    Cordialement.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Configuration datasource Spring + jpa + hibernate
    Par lapin_hobbit dans le forum Spring
    Réponses: 0
    Dernier message: 20/02/2014, 11h35
  2. [Framework] Spring avec Hibernate
    Par Feres_agent1116 dans le forum Spring
    Réponses: 2
    Dernier message: 19/04/2013, 19h20
  3. [Data] Probléme lors de l'intégration de spring avec hibernate
    Par imyJava dans le forum Spring
    Réponses: 3
    Dernier message: 07/06/2010, 15h22
  4. [EhCache] Configuration avec Hibernate & Spring
    Par kilicool dans le forum Hibernate
    Réponses: 9
    Dernier message: 23/09/2009, 13h44
  5. Spring avec hibernate?
    Par prugne dans le forum Spring
    Réponses: 11
    Dernier message: 30/06/2009, 19h52

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