JBoss V7 + EJB3 + JUNIT : problème EJBContainer.createEJBContainer()
Bonjour à tous,
Ma configuration est la suivante :
- JBoss V7.0.2 Final
- EJB3 (3.1)
- JUNIT V4
- Eclipse Indigo
Le serveur JBoss déploie mon petit programme démarre correctement.
J'ai créé une classe de test (JUNIT) :
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
|
package test;
import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;
import javax.naming.NamingException;
import main.java.org.domos.application.dao.PremierEJB3;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class PremierEJB3Test {
private EJBContainer container;
private Context context;
private PremierEJB3 monBean;
@Before
public void setUp() throws NamingException {
container = EJBContainer.createEJBContainer();
context = container.getContext();
monBean = (PremierEJB3) context.lookup("java:global/bin/PremierEJB3Bean");
}
@After
public void tearDown() {
if (container != null) {
container.close();
}
}
@Test
public void test() {
monBean.ditBonjour("Nassa");
}
} |
Quand je lance le test une exception est lancé :
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
|
javax.ejb.EJBException: Unable to instantiate container with factories []
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:97)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:75)
at test.PremierEJB3Test.setUp(PremierEJB3Test.java:21)
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.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.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
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) |
Pour l'implémentation du test je me suis inspiré de : http://www.eclipsetotale.com/article...c_Eclipse.html
Si quelqu'un à une idée du problème...
Merci.
Nassa.
Complètement découragé...
Je suis un peut largué dans le monde de JEE, (je viens du monde de l'informatique l'embarqué) ça fait deux bonnes semaines que j'essais différentes configurations :
- Spring, Hibernate
- JBoss 5, EJB3, Hibernate
...
Je ne parviens pas à faire fonctionner correctement quoi que ce soit !!!
Je passent mon temps à essayer de configurer ces p... de framworks, et j'ai pas écrit un ligne de code !!!
En fait ce que je veux c'est coder mes DAO avec EBJ et JPA et pouvoir les tester avec JUNIT.
Quel version de JBoss support EJB embedded ?
Merci.
Pour info : ce que je ne souhaite pas utiliser : Embedded JBoss