bonjour,

j'ai développé un projet jboss à partir d'un tuto de Mr TAHE(récupéré sur developpez.com), projet qui gère le salaire d'assistantes sociales.
il y a des entités JPA, une couche DAO, une classe client, et le tout marche sous JBoss (version standalone cad que le projet n'est pas lié à jboss dans netbeans, je veux dire que quand je lance le projet, jboss n'est pas lancé par netbeans automatiquement mais par des instructions dans le client, on les identifie facilement dans le code qui suit).

mon problème c'est que j'ai deux versions du même client: une version du genre main(), classique, et une version sous forme d'un test JUnit.
la version main() s'exécute bien alors que la version JUnit bogue.

voici les deux versions et le message d'erreur:

version main():
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
 
public class monTestJBoss {
 
    //private static IEmployeDaoLocal employeDao = null;
    private static IIndemniteDaoLocal indemniteDao = null;
    private static ICotisationDaoLocal cotisationDao = null;
    private static IEmployeDaoLocal employeDao=null;
 
    public static void main(String[] args) throws NamingException {
 
        //démarrage EJB3
        EJB3StandaloneBootstrap.boot(null);
        EJB3StandaloneBootstrap.deployXmlResource("META-INF/jboss-config.xml");
        //EJB3StandaloneBootstrap.scanClasspath("bin".replace("/", File.separator));
        EJB3StandaloneBootstrap.scanClasspath();
 
        // init du ctx JNDI
        InitialContext initialContext = new InitialContext();     
 
        java.lang.Object refe=initialContext.lookup("EmployeDao/local");
        employeDao = (IEmployeDaoLocal)
                PortableRemoteObject.narrow((java.lang.Object)refe,IEmployeDaoLocal.class);
 
 
        java.lang.Object refi=initialContext.lookup("IndemniteDao/local");
        indemniteDao = (IIndemniteDaoLocal)
                PortableRemoteObject.narrow(refi,IIndemniteDaoLocal.class);
 
        java.lang.Object refc=initialContext.lookup("CotisationDao/local");
        cotisationDao = (ICotisationDaoLocal)
                PortableRemoteObject.narrow(refc,ICotisationDaoLocal.class);
 
 
        //vidage base + remplissage
        for (Employe employe : employeDao.findAll()) {
            employeDao.destroy(employe);
        }
        for (Cotisation cotisation : cotisationDao.findAll()) {
            cotisationDao.destroy(cotisation);
        }
        for (Indemnite indemnite : indemniteDao.findAll()) {
            indemniteDao.destroy(indemnite);
        }
 
 
        Indemnite ind1 = indemniteDao.create(new Indemnite(1L, 1.93, 2, 3, 12));
        Indemnite ind2 = indemniteDao.create(new Indemnite(2L, 2.1, 2.1, 3.1, 15));
 
        Employe employe2 = employeDao.create(new Employe("254104940426058", "Jouveinal", "Marie", "5 rue oiseaux", "St Corentin", 49203, ind2));
        Employe employe1 = employeDao.create(new Employe("260124402111742", "Laverti", "Justine", "Lades brûlerie", "St Marcel", 49014, ind1));
 
        Cotisation cotisation1 = cotisationDao.create(new Cotisation(3.49, 6.15, 9.39, 7.88));
 
 
        //le test
        System.out.println("Employes ---------------------");
        for (Employe employe : employeDao.findAll()){
            System.out.println(employe);
        }
 
        System.out.println("Indemnités -------------------");
        for (Indemnite indemnite : indemniteDao.findAll()){
            System.out.println(indemnite);
        }
 
        System.out.println("Cotisations ------------------");
        for (Cotisation cotisation : cotisationDao.findAll()){
            System.out.println(cotisation);
        }
 
        //after
 
 
        EJB3StandaloneBootstrap.shutdown();
    }
}
version JUnit:
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
 
public class initDBLocal {
 
    private static IEmployeDaoLocal employeDao = null;
    private static IIndemniteDaoLocal indemniteDao = null;
    private static ICotisationDaoLocal cotisationDao = null;
 
    @BeforeClass
    public static void init()throws NamingException{
 
        //démarrage EJB3
        EJB3StandaloneBootstrap.boot(null);
        EJB3StandaloneBootstrap.deployXmlResource("META-INF/jboss-config.xml");
        //EJB3StandaloneBootstrap.scanClasspath("bin".
        //        replace("/", File.separator));
        EJB3StandaloneBootstrap.scanClasspath();
 
 
        // init du ctx JNDI
        InitialContext initialContext = new InitialContext();
 
 
 
 
        java.lang.Object refe=initialContext.lookup("EmployeDao/local");
        employeDao = (IEmployeDaoLocal)
                PortableRemoteObject.narrow((java.lang.Object)refe,IEmployeDaoLocal.class);
 
        java.lang.Object refi=initialContext.lookup("IndemniteDao/local");
        indemniteDao = (IIndemniteDaoLocal)
                PortableRemoteObject.narrow((java.lang.Object)refi,IIndemniteDaoLocal.class);
 
        java.lang.Object refc=initialContext.lookup("CotisationDao/local");
        cotisationDao = (ICotisationDaoLocal)
                PortableRemoteObject.narrow((java.lang.Object)refc,ICotisationDaoLocal.class);
 
 
 
 
        //vidage base + remplissage
        for(Employe employe:employeDao.findAll()){
            employeDao.destroy(employe);
        }
        for(Cotisation cotisation:cotisationDao.findAll()){
            cotisationDao.destroy(cotisation);
        }
        for(Indemnite indemnite : indemniteDao.findAll()){
            indemniteDao.destroy(indemnite);
        }
 
 
        Indemnite ind1=indemniteDao.create(new Indemnite(1L, 1.93, 2, 3,12));
        Indemnite ind2=indemniteDao.create(new Indemnite(2L, 2.1, 2.1, 3.1, 15));
 
        Employe employe2=employeDao.create(new Employe("254104940426058","Jouveinal","Marie","5 rue oiseaux","St Corentin",49203,ind2));
        Employe employe1=employeDao.create(new Employe("260124402111742","Laverti","Justine","Lades brûlerie","St Marcel",49014,ind1));
 
        Cotisation cotisation1=cotisationDao.create(new Cotisation(3.49, 6.15, 9.39, 7.88));
 
 
 
 
 
    }
 
    @AfterClass
    public static void terminate(){
        EJB3StandaloneBootstrap.shutdown();
 
    }
 
    @Test
    public void initDB(){
 
        System.out.println("Employes ---------------------");
        for (Employe employe : employeDao.findAll()){
            System.out.println(employe);
        }
 
        System.out.println("Indemnités -------------------");
        for (Indemnite indemnite : indemniteDao.findAll()){
            System.out.println(indemnite);
        }
 
        System.out.println("Cotisations ------------------");
        for (Cotisation cotisation : cotisationDao.findAll()){
            System.out.println(cotisation);
        }
 
 
    }
 
 
 
 
 
}
erreur:
WARNING: multiple versions of ant detected in path for junit
jar:file:/Applications/NetBeans/NetBeans%206.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
and jar:file:/Users/oliviersaint-eve/Downloads/apache-ant-1.7.1/lib/ant.jar!/org/apache/tools/ant/Project.class
Testsuite: daoJboss.initDBLocal
java.lang.RuntimeException: Not a valid URL: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at org.jboss.util.file.ArchiveBrowser.getBrowser(Unknown Source)
at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:370)
Tests run: 0, Failures: 0, Errors: 1, Time elapsed: 2,63 sec

------------- Standard Error -----------------
java.lang.RuntimeException: Not a valid URL: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at org.jboss.util.file.ArchiveBrowser.getBrowser(Unknown Source)
at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:370)
at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:350)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:305)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:440)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:273)
at daoJboss.initDBLocal.init(initDBLocal.java:40)
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.ParentRunner.run(ParentRunner.java:236)
at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
Caused by: java.net.URISyntaxException: Illegal character in path at index 36: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
... 21 more
------------- ---------------- ---------------
Testcase: daoJboss.initDBLocal: Caused an ERROR
java.lang.RuntimeException: Not a valid URL: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:350)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:305)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:440)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:273)
at daoJboss.initDBLocal.init(initDBLocal.java:40)
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.ParentRunner.run(ParentRunner.java:236)
at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
java.lang.RuntimeException: java.lang.RuntimeException: Not a valid URL: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:279)
at daoJboss.initDBLocal.init(initDBLocal.java:40)
Caused by: java.lang.RuntimeException: Not a valid URL: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at org.jboss.util.file.ArchiveBrowser.getBrowser(Unknown Source)
at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:370)
at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:350)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:305)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:440)
at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:273)
Caused by: java.net.URISyntaxException: Illegal character in path at index 36: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
Caused by: java.net.URISyntaxException: Illegal character in path at index 36: file:/Applications/NetBeans/NetBeans 6.7.1.app/Contents/Resources/NetBeans/java2/ant/lib/ant.jar
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
... 21 more
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)


Test daoJboss.initDBLocal FAILED
/Users/oliviersaint-eve/Dropbox/prog°/projets/netbeans/projet_pam_hib_jboss_1/nbproject/build-impl.xml:624: Some tests failed; see details above.
ÉCHEC DE LA GÉNÉRATION (durée totale* 4 secondes)
le warning prévient que il y a deux versions de ant; j'ai en effet téléchargé ant et j'ai essayé de l'inclure dans le classpath de l'appli.
mais sans succès.

merci d'avance pour toute aide,

olivier.