Bonjour tout le monde,je travaille actuellement sur un projet de fin d'etude utilisant :jboss, eclipse et hibernate,
sachant que mon fichier G:\jboss-4.0.2RC1\server\default\deploy\jboss-hibernate.deployer\META-INF\jboss-service.xml est le suivant:
///////////////////jboss-service.xml////////////////////
le fichier hibernate.cfg.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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE server> <server> <!-- Defines the HAR (Hibernate ARchive) deployer service. See the javadocs for org.jboss.hibernate.har.HARDeployer for more info. --> <!-- | HibernateService MBean for MySQL --> <mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateSessionFactory"> <depends>jboss.jca:service=RARDeployer</depends> <!-- <attribute name="MapResources"> mappings/Map.hbm </attribute> --> <attribute name="JndiName"> java:/HibernateSessionFactory </attribute> <!--<attribute name="Datasource">java:/DefaultDS</attribute>--> <attribute name="Dialect"> net.sf.hibernate.dialect.mySQLDialect </attribute> <attribute name="TransactionStrategy"> net.sf.hibernate.transaction.JTATransactionFactory </attribute> <attribute name="TransactionManagerLookupStrategy"> net.sf.hibernate.transaction.JBossTransactionManagerLookup </attribute> <attribute name="ShowSql">true</attribute> <attribute name="CacheProvider"> net.sf.hibernate.cache.TreeCacheProvider </attribute> <attribute name="UserTransactionName"> UserTransaction </attribute> </mbean> </server>
/////////////////////////hibernate.cfg.xml/////////////////////
et quand j'essaie d'executer un client qui va inserer dans la base j'ai le message 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 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <session-factory > <!-- local connection properties --> <property name="hibernate.connection.url">jdbc:mysql://localhost/Base1</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password"></property> <!-- property name="hibernate.connection.pool_size"></property --> <!-- dialect for PostgreSQL --> <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property> <property name="hibernate.show_sql">false</property> <property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property> <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property> <mapping resource="Map.hbm"/> </session-factory> </hibernate-configuration>
merci pour l'aide
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 Buildfile: D:\eclipse\workspace\SIG\build.xml prepare: compile: ejbjar: run.MapManager: [java] log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment). [java] log4j:WARN Please initialize the log4j system properly. [java] %%%% Error Creating SessionFactory %%%% [java] net.sf.hibernate.HibernateException: Could not locate TransactionManager [java] at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:26) [java] at net.sf.hibernate.transaction.JTATransactionFactory.configure(JTATransactionFactory.java:48) [java] at net.sf.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:48) [java] at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:66) [java] at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155) [java] at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789) [java] at sig.mapping.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:42) [java] at sig.entreprise.MapManager.main(MapManager.java:8) [java] Caused by: javax.naming.NameNotFoundException: TransactionManager not bound [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:491) [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:499) [java] at org.jnp.server.NamingServer.getObject(NamingServer.java:505) [java] at org.jnp.server.NamingServer.lookup(NamingServer.java:278) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [java] at java.lang.reflect.Method.invoke(Unknown Source) [java] at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) [java] at sun.rmi.transport.Transport$1.run(Unknown Source) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at sun.rmi.transport.Transport.serviceCall(Unknown Source) [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) [java] at java.lang.Thread.run(Unknown Source) [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source) [java] at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) [java] at sun.rmi.server.UnicastRef.invoke(Unknown Source) [java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610) [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572) [java] at javax.naming.InitialContext.lookup(Unknown Source) [java] at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23) [java] ... 7 more [java] java.lang.NullPointerException [java] at sig.mapping.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:49) [java] at sig.entreprise.MapManager.main(MapManager.java:8) [java] Exception in thread "main" [java] Java Result: 1 BUILD SUCCESSFUL Total time: 6 seconds
[ Modéré par christopheJ ]
Ajout des balises code : un message lisible est plus agréable
Les Règles du Forum
Partager