Précédent   Forum du club des développeurs et IT Pro > Java > Développement Web en Java > Frameworks
Frameworks Forum d'entraide sur les frameworks Web Java (Struts, JSF, Seam, GWT, Wicket, Tapestry, etc.)
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 02/11/2012, 15h22   #1
theboss0
Invité de passage
 
Homme gille
Développeur Java
Inscription : avril 2012
Messages : 10
Détails du profil
Informations personnelles :
Nom : Homme gille
Localisation : France, Landes (Aquitaine)

Informations professionnelles :
Activité : Développeur Java
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : avril 2012
Messages : 10
Points : 0
Points : 0
Par défaut Intégration Spring Hibernate JSF avec Maven

Bonjour tout le monde ,

je veux utiliser les Framework Oracel+Spring+ hibernate+ jsf a l aide de maven

,mais je galère depuis 3 jours dans la configuration et je suis bloqué.

est ce que vous des conseils des tutos ou un petit projet pret pour démarer...

etc ça sera la bienvenue.

merci d'avance.
theboss0 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/11/2012, 05h56   #2
Khaled.Noordin
Membre éprouvé
 
Avatar de Khaled.Noordin
 
Homme Khaled Noordin Abou Imran
Inscription : janvier 2005
Messages : 341
Détails du profil
Informations personnelles :
Nom : Homme Khaled Noordin Abou Imran
Localisation : France, Hauts de Seine (Île de France)

Informations forums :
Inscription : janvier 2005
Messages : 341
Points : 468
Points : 468
Salut,
Met ton pom.xml(en utilisant la balise code) pour avoir une idée de la ou tu en es.
__________________
Ce que l'on conçoit bien s'énonce clairement,
Et les mots pour le dire arrivent aisément. Nicolas Boileau

Si c'est résolu, cliquez, cliquez, cliquez!!!!
Khaled.Noordin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/11/2012, 11h30   #3
theboss0
Invité de passage
 
Homme gille
Développeur Java
Inscription : avril 2012
Messages : 10
Détails du profil
Informations personnelles :
Nom : Homme gille
Localisation : France, Landes (Aquitaine)

Informations professionnelles :
Activité : Développeur Java
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : avril 2012
Messages : 10
Points : 0
Points : 0
Bonjour voici mon Pom.xml :

Code :
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>Console</groupId>
	<artifactId>console</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>console Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<repositories>
		<repository>
			<id>prime-repo</id>
			<name>PrimeFaces Maven Repository</name>
			<url>http://repository.primefaces.org</url>
			<layout>default</layout>
		</repository>
	</repositories>
 
	<properties>
		<spring.version>3.1.1.RELEASE</spring.version>
	</properties>
 
	<dependencies>
 
		<!-- Spring 3 dependencies -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
 
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>	
 
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>
 
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>
 
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${spring.version}</version>
		</dependency>
 
		<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
        </dependency>
 
		<!-- JSF library -->
		<dependency>
		  <groupId>com.sun.faces</groupId>
		  <artifactId>jsf-api</artifactId>
		  <version>2.1.6</version>
		</dependency>
 
		<dependency>
		  <groupId>com.sun.faces</groupId>
		  <artifactId>jsf-impl</artifactId>
		  <version>2.1.6</version>
		</dependency>
 
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
 
		<!-- Primefaces library -->
 		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>3.1.1</version>
		</dependency>
 
		<!-- Hibernate library -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.1.0.Final</version>
		</dependency>
 
		<dependency>
			<groupId>javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.12.1.GA</version>
		</dependency>
 
		<!-- MySQL Java Connector library -->
		<dependency>
            <groupId>oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.2</version>
        </dependency>
 
		<dependency>
			<groupId>c3p0</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.1.2</version>
		</dependency>            
 
		<!-- Log4j library -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
 
        <dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>6.4</version>
		</dependency>
 
	</dependencies>
 
 
</project>
theboss0 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/11/2012, 11h57   #4
tchize_
Expert Confirmé Sénior
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 18 284
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 18 284
Points : 32 759
Points : 32 759
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
Citation:
Envoyé par theboss0 Voir le message
,mais je galère depuis 3 jours dans la configuration et je suis bloqué.
Q'est-ce qui te bloque exactement?
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
Laisse entrer le jour après une nuit sombre. Si tu es toujours là, tu n'es pas faite pour mourir.
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/11/2012, 12h39   #5
theboss0
Invité de passage
 
Homme gille
Développeur Java
Inscription : avril 2012
Messages : 10
Détails du profil
Informations personnelles :
Nom : Homme gille
Localisation : France, Landes (Aquitaine)

Informations professionnelles :
Activité : Développeur Java
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : avril 2012
Messages : 10
Points : 0
Points : 0
quand je veux tester mes services avec junit j ai l'erreur suivante :
Code :
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
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at mar.tetra.test.PivottraceTest.setUpBeforeClass(PivottraceTest.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:207)
	at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1778)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:189)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:350)
	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:335)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
	... 28 more
 
java.lang.NullPointerException
	at mar.tetra.test.PivottraceTest.tearDownAfterClass(PivottraceTest.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

voici le fichier application-context.xml :

Code :
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
<?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:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
 
<!-- Data Source Declaration -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" scope="singleton" >
		<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />	
		<property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:XE" />	
		<property name="user" value="user" />	
		<property name="password" value="password" />	
		<property name="maxPoolSize" value="10" />
		<property name="maxStatements" value="0" />
		<property name="minPoolSize" value="5" /> 
	</bean>
	<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="annotatedClasses">
			<list>
				<value>mar.tetra.model.trace</value>
 
 
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	<!-- Enable the configuration of transactional behavior based on annotations -->
    <tx:annotation-driven transaction-manager="txManager"/>
    <context:annotation-config />
	<context:component-scan base-package="mar.tetra"/>
	<!-- Transaction Manager is defined -->
    <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
       <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
 
</beans>

et voici la classe de teste :

Code :
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
package mar.tetra.test;
 
import static org.junit.Assert.*;
 
import java.util.List;
 
import mar.tetra.model.trace;
import mar.tetra.service.traceService;
 
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
 
public class PivottraceTest {
 
	private static ClassPathXmlApplicationContext context;
	private static PivottraceService pivottraceService;
 
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		context = new ClassPathXmlApplicationContext("applicationContext.xml");
		pivottraceService =(PivottraceService) context.getBean("pivottraceservice");
	}
 
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		context.close();
	}
 
	@Test
	public void testGetSource() {
 
	List<Pivottrace> PivotSource = pivottraceService.getSource();
	System.out.println("PivotSource");
 
	}
 
	@Test
	public void testGetTraceLevel() {
		fail("Not yet implemented");
	}
 
	@Test
	public void testGetTraceType() {
		fail("Not yet implemented");
	}
 
	@Test
	public void testGetPriority() {
		fail("Not yet implemented");
	}
 
	@Test
	public void testGetTrace() {
		fail("Not yet implemented");
	}
 
}
theboss0 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/11/2012, 22h52   #6
Khaled.Noordin
Membre éprouvé
 
Avatar de Khaled.Noordin
 
Homme Khaled Noordin Abou Imran
Inscription : janvier 2005
Messages : 341
Détails du profil
Informations personnelles :
Nom : Homme Khaled Noordin Abou Imran
Localisation : France, Hauts de Seine (Île de France)

Informations forums :
Inscription : janvier 2005
Messages : 341
Points : 468
Points : 468
Salut
en ce qui concerne la stacktrace je vois 'SessionFactory' avec un S majuscule et ensuite dans ton fichier de conf je le vois avec un s minuscule, donc vire les choses générées dans ton repo locale (sûrement sur un chemin du genre /home/theboss0/.m2/repository/Console/console) et le dossier target dans ton projet.
Avant d’intégrer des beans de ton contexte essaye de juste charger ton contexte.
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package foo.bar
 
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestExecutionListeners
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener
 
 
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"classpath:**/applicationContext.xml"
})
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class})
public class BazTest {
 
    @Test
    public void testContext() {
        assert true
    }
 
}
Au moins tu pourra suivre l'output console et voir ce qu'il dit.

D'autre part du coté de ta classe de test essaye d'utiliser les classes et les styles de programmation de spring décrit dans la doc officiel au chapitre des test, et il y a beaucoup ticket de blog en français qui parle de ça donc let's google.
Enfin je te conseil l'utilisation d'une base de donnée en mémoire pour tes tests

Pour conclure je ne peux que te conseiller la lecture de ce livre qui est une mine d'or et en francais
__________________
Ce que l'on conçoit bien s'énonce clairement,
Et les mots pour le dire arrivent aisément. Nicolas Boileau

Si c'est résolu, cliquez, cliquez, cliquez!!!!
Khaled.Noordin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/01/2013, 22h57   #7
af.zakaria
Candidat au titre de Membre du Club
 
Inscription : mars 2012
Messages : 105
Détails du profil
Informations forums :
Inscription : mars 2012
Messages : 105
Points : 11
Points : 11
Quelle Archetype utilisé pour intégrer Hibernate, Spring et Hibernate avec Maven ?
af.zakaria est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/02/2013, 12h28   #8
omarcisses
Membre éclairé
 
Avatar de omarcisses
 
Homme OUMAR CISSE
Développeur Java
Inscription : novembre 2007
Messages : 227
Détails du profil
Informations personnelles :
Nom : Homme OUMAR CISSE
Localisation : France, Val d'Oise (Île de France)

Informations professionnelles :
Activité : Développeur Java
Secteur : Finance

Informations forums :
Inscription : novembre 2007
Messages : 227
Points : 304
Points : 304
Salut j'ai mis en place un tutoriel en place pour ça regarde ce lien : ici et si tu as des problèmes n’hésite pas pas me contacter
__________________
Si ce message vous a aidé, pensez à voter pour lui !
Pensez au si votre problème est résolu

Des chercheurs qui cherchent on en trouve, des chercheurs qui trouvent on en cherche
omarcisses est déconnecté   Envoyer un message privé Réponse avec citation 10
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 03h11.


 
 
 
 
Partenaires

Hébergement Web