Bonjour,

J'ai développer une application MDI utilisant JPA (architecture 2-tiers). Vu que le fait d'avoir une implémentation JPA pour chaque client n'est pas top (beaucoup d'utilisateurs), je suis passé sur une architecture 3-tiers avec Glasssifsh V3.
Mes EJB sont créés et sont fonctionnels, le problème vient du fait que je n'arrive pas à y accéder avec mon client.
J'ai quelques petites questions:

1- Les lib à importer dans le client sont-elles bien le j2ee.jar et gf-client.jar de Glassfish?
2- En quoi faire un client J2EE serait mieux qu'un stand alone à part pour le déploiement web start?
3- En initialisant le contexte avec les propriétés adéquates, je n'arrive toujours pas à acceder aux EJB avec un ServiceLocator. J'ai également ajouter le projet EJB en tant qu'import pour le client (je bosse sur NetBeans).

Voici l'initialisation dans le constructeur du ServiceLocator:
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
 
private ServiceLocator() throws NamingException {
 
        Properties props = new Properties();
 
        props.setProperty("java.naming.factory.initial",
                "com.sun.enterprise.naming.SerialInitContextFactory");
 
        props.setProperty("java.naming.factory.url.pkgs",
                "com.sun.enterprise.naming");
 
        props.setProperty("java.naming.factory.state",
                "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
 
 
        // optional.  Defaults to localhost.  Only needed if web server is running
        // on a different host than the appserver
        props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.1.4");
 
        // optional.  Defaults to 3700.  Only needed if target orb port is not 3700.
        props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
 
        ic = new InitialContext(props);
        cache = Collections.synchronizedMap(new HashMap<String, Object>());
    }
Voici un petit main pour tester:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
public static void main(String[] args) throws NamingException {
        // TODO code application logic here
        IDaoReportingRemote dao = (IDaoReportingRemote)vision20.dao.ServiceLocator.getInstance().getEJB("ejb.daoreporting");
        Personne p = dao.getPersonne("john.smith", "pass");
        System.out.println("personne: "+p);
    }
Voici mon exception:
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
 
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/RemoveException
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:698)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.privateGetPublicMethods(Class.java:2547)
        at java.lang.Class.privateGetPublicMethods(Class.java:2557)
        at java.lang.Class.privateGetPublicMethods(Class.java:2557)
        at java.lang.Class.getMethods(Class.java:1410)
        at com.sun.corba.ee.impl.presentation.rmi.IDLTypesUtil.validateRemoteInterface(IDLTypesUtil.java:92)
        at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.<init>(IDLNameTranslatorImpl.java:234)
        at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.<init>(IDLNameTranslatorImpl.java:67)
        at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl$2.run(IDLNameTranslatorImpl.java:177)
        at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl$2.run(IDLNameTranslatorImpl.java:175)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.get(IDLNameTranslatorImpl.java:174)
        at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl$ClassDataImpl.<init>(PresentationManagerImpl.java:153)
        at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl.getClassData(PresentationManagerImpl.java:125)
        at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:93)
        at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:827)
        at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:248)
        at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:402)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:70)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at vision20.dao.ServiceLocator.lookup(ServiceLocator.java:73)
        at vision20.dao.ServiceLocator.getEJB(ServiceLocator.java:80)
        at vision20.Main.main(Main.java:23)
Si quelqu'un peut m'aider à résoudre cette énigme, cela m'enlèverait une grosse épine du pied! ^^
Merci