Bonjour,

j'ai réalisé des tests sans aucun problème sur des ejb distant et rencontre des erreurs sur l'utilisation d'EJB local.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 Object objref = initialContext.lookup("java:comp/env/ejb/toto"); 
 TestLocalHome testHome = (TestLocalHome)objref ;
lorsque je fais un objref .getClass() j'obtiens EJSLocalStatelessTestHome_a0865691

j'ai lu ceci mais je n'y comprend pas grand chose mais que mon problème serait lie au classLoader

The different EAR contained each an own copy of the jar with the local and remote interfaces of the EJB. The Problem is caused by the separate classloaders of the EARs in an application server. Each EAR Classloader loads his own version of the interface classes. Is the same class loaded by different classloaders, the JVM handles this classes as different classes. An example if you create an instance of a class in one classloader and try to reference the created instance by the same class from another classloader, the association will fail, because of different classloaders in the same JVM.

The solution in an application server where you have deployed two projects and want to use local interfaces is, store the interfaces(and only the interfaces) in an directory, where it is found by the parent classloader of the EAR classloaders. Remove the Jar with the interface from the EARs. The EAR Classloaders will then search in the their parent classloader for the interfaces. The interfaces will be loaded by the parent classloader and will recognized as compatible by the JVM.
Est ce que quelqu'un serait comment mettre en application ce qui est expliqué ici.

merci