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

Hibernate Java Discussion :

Error creating bean with name 'sessionFactory'


Sujet :

Hibernate Java

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut Error creating bean with name 'sessionFactory'
    bonjour
    je suis en train de développer une application web avec JSF-SPRING-Hibernate j'ai eu une erreur d'exécution un peu bizar
    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
     
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: class net.geoloc.business.object.Users not found while looking for property: id_soc
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    	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:423)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:312)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	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:566)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: org.hibernate.MappingException: class net.geoloc.business.object.Users not found while looking for property: id_soc
    	at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:81)
    	at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:275)
    	at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:1841)
    	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1827)
    	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1728)
    	at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:318)
    	at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:236)
    	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:152)
    	at org.hibernate.cfg.Configuration.add(Configuration.java:362)
    	at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:400)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:623)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    	... 30 more
    Caused by: java.lang.ClassNotFoundException: net.geoloc.business.object.Users
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
    	at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:77)
    	... 42 more
    sachant que tous les dossiers de mappings hibernate existe et voila le fichier proximite.hbm.xml
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC 
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping package="net.geoloc.business.object">
    	<class name="Proximite" table="proximite" lazy="false">
    		<id name="id_prox" column="Id_prox" type="integer">
    			<generator class="increment" />
    		</id>
    		<property name="id_soc" column="Id_soc" />
    		<property name="lieu_prox" column="Lieu_prox" />
    		<property name="longitude_prox" column="Longitude_prox" />
    		<property name="lattitude_prox" column="Lattitude_prox" />
    		<property name="addresse" column="Addresse" />
    	</class>
    </hibernate-mapping>
    voila le fichier applicationcontext.xml
    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
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "file:/C:/Bin/spring122/dist/spring-beans.dtd">
     
    <beans>
    	<!--
    		========================= Start of PERSISTENCE DEFINITIONS
    		=========================
    	-->
     
    	<!-- DataSource Definition -->
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql://127.0.0.1:3306/base_local</value>
    		</property>
    		<property name="username">
    			<value>root</value>
    		</property>
    		<property name="password">
    			<value>wise</value>
    		</property>
    	</bean>
     
    	<!-- Hibernate SessionFactory Definition -->
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="mappingResources">
    			<list>
    				<value>net/geoloc/business/object/proximite.hbm.xml</value>
    				<value>net/geoloc/business/object/users.hbm.xml</value>
    				<value>net/geoloc/business/object/engin.hbm.xml</value>
    				<value>net/geoloc/business/object/message.hbm.xml</value>
    				<value>net/geoloc/business/object/affectation.hbm.xml</value>
    				<value>net/geoloc/business/object/chauffeur.hbm.xml</value>
    				<value>net/geoloc/business/object/societe.hbm.xml</value>
    				<value>net/geoloc/business/object/vidange.hbm.xml</value>
     
    			</list>
    		</property>
     
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.HSQLDialect
    				</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.cglib.use_reflection_optimizer">
    					true
    				</prop>
    				<prop key="hibernate.cache.provider_class">
    					org.hibernate.cache.HashtableCacheProvider
    				</prop>
    			</props>
    		</property>
     
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<!-- Spring Data Access Exception Translator Defintion -->
     
    		<bean id="jdbcExceptionTranslator"
    		class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
     
    	<!-- Hibernate Template Defintion -->
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property> 
    		<property name="jdbcExceptionTranslator">
    			<ref bean="jdbcExceptionTranslator" />
    		</property>
     
    	</bean>
     
    	<!-- Hibernate Transaction Manager Definition -->
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref local="sessionFactory" />
    		</property>
    	</bean>
     
    	<!--
    		========================= Start of DAO DEFINITIONS
    		=========================
    	-->
     
    	<!-- TODO DAO Definition: Hibernate implementation -->
    	<bean id="ServiceDao" class="net.geoloc.dao.Impl.ServiceDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="EnginDao" class="net.geoloc.dao.Impl.EnginDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="MessageDao" class="net.geoloc.dao.Impl.MessageDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="ProximiteDao" class="net.geoloc.dao.Impl.ProximiteDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="UsersDao" class="net.geoloc.dao.Impl.UsersDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="AffectationDao" class="net.geoloc.dao.Impl.AffectationDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="SocieteDao" class="net.geoloc.dao.Impl.SocieteDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="VidangeDao" class="net.geoloc.dao.Impl.VidangeDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="ChauffeurDao" class="net.geoloc.dao.Impl.ChauffeurDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<!--
    		========================= Start of SERVICE DEFINITIONS
    		=========================
    	-->
     
    	<!-- TODO Service Definition -->
    	<bean id="ServiceTarget" class="net.geoloc.business.service.Impl.ServiceImpl">
    		<property name="serviceDao">
    			<ref local="ServiceDao" />
    		</property>
    	</bean>
    	<bean id="EnginServiceTarget" class="net.geoloc.business.service.Impl.EnginServiceImpl">
    		<property name="enginDao">
    			<ref local="EnginDao" />
    		</property>
    	</bean>
    	<bean id="UsersServiceTarget" class="net.geoloc.business.service.Impl.UsersServiceImpl">
    		<property name="usersDao">
    			<ref local="UsersDao" />
    		</property>
    	</bean>
    	<bean id="ProximiteServiceTarget" class="net.geoloc.business.service.Impl.ProximiteServiceImpl">
    		<property name="proximiteDao">
    			<ref local="ProximiteDao" />
    		</property>
    	</bean>
    	<bean id="MessageServiceTarget" class="net.geoloc.business.service.Impl.MessageServiceImpl">
    		<property name="messageDao">
    			<ref local="MessageDao" />
    		</property>
    	</bean>
    	<bean id="AffectationServiceTarget" class="net.geoloc.business.service.Impl.AffectationServiceImpl">
    		<property name="affectationDao">
    			<ref local="AffectationDao" />
    		</property>
    	</bean>
    	<bean id="SocieteServiceTarget" class="net.geoloc.business.service.Impl.SocieteServiceImpl">
    		<property name="societeDao">
    			<ref local="SocieteDao" />
    		</property>
    	</bean>
    	<bean id="VidangeServiceTarget" class="net.geoloc.business.service.Impl.VidangeServiceImpl">
    		<property name="vidangeDao">
    			<ref local="VidangeDao" />
    		</property>
    	</bean>
    	<bean id="ChauffeurServiceTarget" class="net.geoloc.business.service.Impl.ChauffeurServiceImpl">
    		<property name="chauffeurDao">
    			<ref local="ChauffeurDao" />
    		</property>
    	</bean>
    	<!-- Transactional proxy for the Service -->
    	<bean id="Service"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="EnginService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="EnginServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="UsersService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="UsersServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="ProximiteService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ProximiteServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="MessageService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="MessageServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="AffectationService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="AffectationServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="SocieteService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="SocieteServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
     
    	<bean id="VidangeService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="VidangeServiceTarget" />
    		</property>
    	</bean>
     
    	<bean id="ChauffeurService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ChauffeurServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    </beans>
    merci pour votre réponse

  2. #2
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    151
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 151
    Points : 85
    Points
    85
    Par défaut
    Le message d'erreur fait référence à la table :

    net.geoloc.business.object.Users mais le mapping que tu as mis correspond à net.geoloc.business.object.Proximite ?

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par gargantua Voir le message
    Le message d'erreur fait référence à la table :

    net.geoloc.business.object.Users mais le mapping que tu as mis correspond à net.geoloc.business.object.Proximite ?
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC 
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping package="net.geoloc.business.object">
    	<class name="Users" table="users" lazy="false">
    		<id name="id" column="Id" type="integer">
    			<generator class="increment" />
    		</id>
    		<property name="id_soc" column="Id_soc" />
    		<property name="id_role" column="Id_role" />
    		<property name="login" column="Login" />
    		<property name="pass" column="Pass" />
    		<property name="actif" column="Actif" />
    		<property name="nom" column="Nom" />
    		<property name="prenom" column="Prenom" />
    		<property name="email" column="Email" />
    	</class>
    </hibernate-mapping>
    dans une autre exécution le message affiché comporte la source proximite c'est pour ça j'ai mis le proximite.hbm.xml
    svp aidez moi je suis planté.

  4. #4
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    151
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 151
    Points : 85
    Points
    85
    Par défaut
    Le message indique qu'il ne trouve pas ta classe Java.

    Tu as fait le mapping, mais as-tu bien tes classes ?
    (a voir aussi avec le chemin complet avec le nom des packages)

  5. #5
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par gargantua Voir le message
    Le message indique qu'il ne trouve pas ta classe Java.

    Tu as fait le mapping, mais as-tu bien tes classes ?
    (a voir aussi avec le chemin complet avec le nom des packages)
    le chemin des packages sont vrais mais les classes n'éxistent pas alors qu'est ce que je peux faire??

  6. #6
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    151
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 151
    Points : 85
    Points
    85
    Par défaut
    Heu, créer tes classes ?

    Le but d'Hibernate et de mapper tes tables à tes classes Java. Si tu n'a pas tes classes alors forcement il y a un problème !

  7. #7
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par gargantua Voir le message
    Heu, créer tes classes ?

    Le but d'Hibernate et de mapper tes tables à tes classes Java. Si tu n'a pas tes classes alors forcement il y a un problème !
    les classes existent je les ai déjà trouvé le probleme persiste encore dsl pour toute à l'heure j'ai cherché dans la mauvaise directoire.
    alors maintenant que j'ai les classes et le chemin des packages est juste qu'est ce que peut etre mon probleme ???
    Ce meme projet a été en marche hier j'ai fait clean de serveur est ce que ne sera pas ça mon probleme. et si oui qu'est ce que je peux faire.??

  8. #8
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    151
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 151
    Points : 85
    Points
    85
    Par défaut
    Tu peux remettre ton mapping corrigé ?

  9. #9
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par gargantua Voir le message
    Tu peux remettre ton mapping corrigé ?
    voila
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC 
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping package="net.geoloc.business.object">
    	<class name="Proximite" table="proximite" lazy="false">
    		<id name="id_prox" column="Id_prox" type="integer">
    			<generator class="increment" />
    		</id>
    		<property name="id_soc" column="Id_soc" />
    		<property name="lieu_prox" column="Lieu_prox" />
    		<property name="longitude_prox" column="Longitude_prox" />
    		<property name="lattitude_prox" column="Lattitude_prox" />
    		<property name="addresse" column="Addresse" />
    	</class>
    </hibernate-mapping>
    c'est celui de proximite.hbm.xml
    le fichier applicationContext.xml est le suivant
    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
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "file:/C:/Bin/spring122/dist/spring-beans.dtd">
     
    <beans>
    	<!--
    		========================= Start of PERSISTENCE DEFINITIONS
    		=========================
    	-->
     
    	<!-- DataSource Definition -->
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    		destroy-method="close">
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql://127.0.0.1:3306/base_local</value>
    		</property>
    		<property name="username">
    			<value>root</value>
    		</property>
    		<property name="password">
    			<value>wise</value>
    		</property>
    	</bean>
     
    	<!-- Hibernate SessionFactory Definition -->
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="mappingResources">
    			<list>
    				<value>net/geoloc/business/object/proximite.hbm.xml</value>
    				<value>net/geoloc/business/object/users.hbm.xml</value>
    				<value>net/geoloc/business/object/engin.hbm.xml</value>
    				<value>net/geoloc/business/object/message.hbm.xml</value>
    				<value>net/geoloc/business/object/affectation.hbm.xml</value>
    				<value>net/geoloc/business/object/chauffeur.hbm.xml</value>
    				<value>net/geoloc/business/object/societe.hbm.xml</value>
    				<value>net/geoloc/business/object/vidange.hbm.xml</value>
     
    			</list>
    		</property>
     
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.HSQLDialect
    				</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.cglib.use_reflection_optimizer">
    					true
    				</prop>
    				<prop key="hibernate.cache.provider_class">
    					org.hibernate.cache.HashtableCacheProvider
    				</prop>
    			</props>
    		</property>
     
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<!-- Spring Data Access Exception Translator Defintion -->
    	<bean id="jdbcExceptionTranslator"
    		class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<!-- Hibernate Template Defintion -->
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
    		<property name="jdbcExceptionTranslator">
    			<ref bean="jdbcExceptionTranslator" />
    		</property>
    	</bean>
     
    	<!-- Hibernate Transaction Manager Definition -->
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref local="sessionFactory" />
    		</property>
    	</bean>
     
    	<!--
    		========================= Start of DAO DEFINITIONS
    		=========================
    	-->
     
    	<!-- TODO DAO Definition: Hibernate implementation -->
    	<bean id="ServiceDao" class="net.geoloc.dao.Impl.ServiceDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="EnginDao" class="net.geoloc.dao.Impl.EnginDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="MessageDao" class="net.geoloc.dao.Impl.MessageDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="ProximiteDao" class="net.geoloc.dao.Impl.ProximiteDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="UsersDao" class="net.geoloc.dao.Impl.UsersDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="AffectationDao" class="net.geoloc.dao.Impl.AffectationDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="SocieteDao" class="net.geoloc.dao.Impl.SocieteDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="VidangeDao" class="net.geoloc.dao.Impl.VidangeDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<bean id="ChauffeurDao" class="net.geoloc.dao.Impl.ChauffeurDaoImpl">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	<!--
    		========================= Start of SERVICE DEFINITIONS
    		=========================
    	-->
     
    	<!-- TODO Service Definition -->
    	<bean id="ServiceTarget" class="net.geoloc.business.service.Impl.ServiceImpl">
    		<property name="serviceDao">
    			<ref local="ServiceDao" />
    		</property>
    	</bean>
    	<bean id="EnginServiceTarget" class="net.geoloc.business.service.Impl.EnginServiceImpl">
    		<property name="enginDao">
    			<ref local="EnginDao" />
    		</property>
    	</bean>
    	<bean id="UsersServiceTarget" class="net.geoloc.business.service.Impl.UsersServiceImpl">
    		<property name="usersDao">
    			<ref local="UsersDao" />
    		</property>
    	</bean>
    	<bean id="ProximiteServiceTarget" class="net.geoloc.business.service.Impl.ProximiteServiceImpl">
    		<property name="proximiteDao">
    			<ref local="ProximiteDao" />
    		</property>
    	</bean>
    	<bean id="MessageServiceTarget" class="net.geoloc.business.service.Impl.MessageServiceImpl">
    		<property name="messageDao">
    			<ref local="MessageDao" />
    		</property>
    	</bean>
    	<bean id="AffectationServiceTarget" class="net.geoloc.business.service.Impl.AffectationServiceImpl">
    		<property name="affectationDao">
    			<ref local="AffectationDao" />
    		</property>
    	</bean>
    	<bean id="SocieteServiceTarget" class="net.geoloc.business.service.Impl.SocieteServiceImpl">
    		<property name="societeDao">
    			<ref local="SocieteDao" />
    		</property>
    	</bean>
    	<bean id="VidangeServiceTarget" class="net.geoloc.business.service.Impl.VidangeServiceImpl">
    		<property name="vidangeDao">
    			<ref local="VidangeDao" />
    		</property>
    	</bean>
    	<bean id="ChauffeurServiceTarget" class="net.geoloc.business.service.Impl.ChauffeurServiceImpl">
    		<property name="chauffeurDao">
    			<ref local="ChauffeurDao" />
    		</property>
    	</bean>
    	<!-- Transactional proxy for the Service -->
    	<bean id="Service"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="EnginService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="EnginServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="UsersService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="UsersServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="ProximiteService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ProximiteServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="MessageService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="MessageServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="AffectationService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="AffectationServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    	<bean id="SocieteService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="SocieteServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
     
    	<bean id="VidangeService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="VidangeServiceTarget" />
    		</property>
    	</bean>
     
    	<bean id="ChauffeurService"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref local="transactionManager" />
    		</property>
    		<property name="target">
    			<ref local="ChauffeurServiceTarget" />
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    			</props>
    		</property>
    	</bean>
    </beans>

  10. #10
    Membre régulier
    Inscrit en
    Juin 2007
    Messages
    151
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 151
    Points : 85
    Points
    85
    Par défaut
    Je ne vois pas la différence.

    T'es classe Javasont dans le package : net.geoloc.business.object ?

    Au même endroit que tes .hbm.xml si j'en crois ton applicationContext ?

  11. #11
    Futur Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2011
    Messages
    20
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Mars 2011
    Messages : 20
    Points : 9
    Points
    9
    Par défaut
    Citation Envoyé par gargantua Voir le message
    Je ne vois pas la différence.

    T'es classe Javasont dans le package : net.geoloc.business.object ?

    Au même endroit que tes .hbm.xml si j'en crois ton applicationContext ?

    merci mon ami c'est résolu mon problème et tout marche maintenant.
    Le problème etait dans le déploiment de projet les classes ne sont pas crées à cause d'un malfonctionnement du tomcat.
    merciiiii gargantua

Discussions similaires

  1. Erreur "BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext
    Par ichoualane dans le forum Plateformes (Java EE, Jakarta EE, Spring) et Serveurs
    Réponses: 1
    Dernier message: 26/05/2015, 09h39
  2. Error creating bean with name 'sessionFactory'
    Par achbend dans le forum Spring
    Réponses: 2
    Dernier message: 30/12/2013, 14h02
  3. Réponses: 2
    Dernier message: 02/03/2012, 14h46
  4. Error creating bean with name 'sessionFactory'
    Par poitou82 dans le forum Spring
    Réponses: 2
    Dernier message: 20/06/2011, 13h42
  5. Error creating bean with name
    Par MASSAKA dans le forum Spring
    Réponses: 1
    Dernier message: 07/05/2008, 19h32

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