Bonjour,
je vous énonce mon problème.
Je travaille sur un service existant et lui ai affecté une nouvelle fonctionnalité (maMethode(Date, Date)).
J'ai donc modifié toutes mes interfaces comme il se devait et j'ai implémenté mon business.
Jusque là tout va bien. Mes tests d'intégration sur les controlleurs fonctionnent correctements. Mes tests unitaires aussi.
Cependant, il existe un test de supervision (comprendre, des tests sur les services eux mêmes) qui était fonctionnel (du moins, je le pense puisque c'est l'architecte qui travaillait avec moi qui l'a mis en place. Et le connaissant, il a surement du le tester) mais qui ne l'est plus.
En debuggant le test, je m'apercois que j'ai bien accès au service, mais que celui ci ne contient rien d'autre comme méthode que le toString() O_o !?!??
Voici la stacktrace rencontrée, ici en essayant d'appeler la méthode getVersion() de mon service.
Voici le code de mon ejb et de ses interfaces si nécessaire:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Exception in thread "main" java.lang.reflect.UndeclaredThrowableException at $Proxy0.getVersion(Unknown Source) at mon.package.frontend.control.MonitoringFrontEndServiceSupervisionForDevelopersMain.testMonitoringFrontendService(MonitoringFrontEndServiceSupervisionForDevelopersMain.java:54) at mon.package.frontend.control.MonitoringFrontEndServiceSupervisionForDevelopersMain.main(MonitoringFrontEndServiceSupervisionForDevelopersMain.java:76) Caused by: java.lang.NoSuchMethodException: mon.package.monitoring.ejb.MonitoringFrontendService_gq9ya8_MonitoringFrontendServiceImpl_1033_WLStub.getVersion() at java.lang.Class.getMethod(Class.java:1605) at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.getTargetMethod(RemoteBusinessIntfProxy.java:162) at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:53) ... 3 more
Interfaces
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 public interface DistributedComponent { /** * @param deeply indicates if a rapid test should be executed, or a more deeply test * @return true when the remote component works */ boolean testMe(boolean deeply); /** * @return The version of the component */ String getVersion(); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 public interface MonitoringFrontendController { // ... other stuff /** * @param beginDate * @param endDate * @return blablabla javadoc */ Map<String, Set<Object>> maMethode(Date beginDate, Date endDate); }EJB
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 public interface MonitoringFrontendService extends MonitoringFrontendController, DistributedComponent { // Just implements those two interfaces. }
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 @Stateless(name = "MonitoringFrontendService") @Remote(MonitoringFrontendService.class) public class MonitoringFrontendServiceBean implements MonitoringFrontendService { private static final MonLogger LOGGER = new MonLogger(MonitoringFrontendServiceBean.class); private MonitoringFrontendController monitoringFrontendController; private RequestBusinessFunctionsController requestBusinessFunctionsController; private String version; /** * Ejb create. */ @PostConstruct public void ejbCreate() { MonLogger.initMonLogger(2152, "monProjet", "NOT SET", "projetx-ejb"); try { final BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator.getInstance("mon-fichier-de-config-spring.xml"); final BeanFactoryReference bfr = bfl.useBeanFactory("MonitoringFrontendService"); this.monitoringFrontendController = (MonitoringFrontendController) bfr.getFactory().getBean("monitoringFrontendController"); // other stuff this.version = (String) bfr.getFactory().getBean("version"); } catch (RuntimeException e) { LOGGER.error(e); throw e; } MonLogger.initMonLogger(2152, "monProjet", this.version, "projetx-ejb"); } /** * @see mon.package.ejb.DistributedComponent#getVersion() */ @Override @RolesAllowed({ "Monitoring", "Manager" }) public String getVersion() { return this.version; } [... autres méthodes ...] /** * @see mon.package.monitoring.control.MonitoringFrontendController#maMethode(java.util.Date, java.util.Date) */ @Override @RolesAllowed("Manager") public Map<String, Set<Object>> maMethode(Date beginDate, Date endDate) { MonLogger.initMonLogger(2152, "monProjet", this.version, "projetx-ejb"); return this.monitoringFrontendController.maMethode(beginDate, endDate); }(Pour des raisons de confidentialité, vous comprendrez que je ne mette pas tout le contenu des méthodes. Aussi la méthode testMe(), n'apparait pas ici au sein de l'ejb. Il se peut aussi que quelques erreurs se soient glisser dans les noms suite à la modification du code afin de pouvoir le publier ici.)
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 public class MonitoringFrontEndServiceSupervisionForDevelopersMain extends TEST_BasicServiceSupervision { private static final String SERVER_URL = "url_de_mon_serveur"; private static final String LOOKUP_NAME = "ejb/Monitoring/MonitoringFrontendService"; // Used for security if necessary // private static final String SECURITY_PRINCIPAL = "123456789@00@12345678910"; // private static final String SECURITY_CREDENTIALS = "my!credential"; /** * Default constructor. */ public MonitoringFrontEndServiceSupervisionForDevelopersMain() { super(); } private MonitoringFrontendService connectToEjb() { MonitoringFrontendService service = (MonitoringFrontendService) lookup(); return service; } /** * This simple test assures the good work of the service. * * @throws Exception */ public void testMonitoringFrontendService() throws Exception { MonitoringFrontendService service = connectToEjb(); System.out.println("Service version: " + service.getVersion()); Calendar beginDate = Calendar.getInstance(); Calendar endDate = Calendar.getInstance(); beginDate.set(2010, 4, 1); endDate.set(2010, 9, 27); service.maMethode(beginDate.getTime(), endDate.getTime()); } /** * Main method to test the service. * * @param inArgs none required. * @throws Exception */ public static void main(String[] inArgs) throws Exception { MonitoringFrontEndServiceSupervisionForDevelopersMain testService = new MonitoringFrontEndServiceSupervisionForDevelopersMain(); testService.setServer(SERVER_URL); testService.setJndiName(LOOKUP_NAME); testService.testMonitoringFrontendService(); System.out.println("Successfully executed!"); } }
Pensant à un problème de version, j'ai plusieurs fois redéployé, en supprimant l'ancien service.
Ensuite, j'ai regarder dans la console si je n'avais pas 2 ear déployés sous 2 noms différents, mais non. A mon sens, aucun autre projet déployé sur le serveur pointé ne distribue ce service puisque je recois une exception (Exception in thread "main" java.util.MissingResourceException: Unable to resolve 'ejb.Monitoring.MonitoringFrontendService'.) une fois le service désinstallé.
Une idée?
Partager