私は EJB と JBoss の世界に不慣れで、リモート インターフェイスでステートレス Bean を実行しようとすると問題に直面しています。
私はStruts ActionSupportでこれをやっています:
public String inscrire() {
System.out.println("########### Inscrire Action #############");
Candidat c = new Candidat(nom, prenom, mail, telephone, ecole);
try {
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
org.jboss.naming.remote.client.InitialContextFactory.class
.getName());
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
env.put(Context.SECURITY_PRINCIPAL, "UserApp");
//env.put("jboss.naming.client.ejb.context", "true");
env.put(Context.SECURITY_CREDENTIALS, "password");
InitialContext remoteContext = new InitialContext(env);
System.out.println("########## Initial Context OK ##########");
servicecandidat = (CandidatSessionRemote) remoteContext
.lookup("java:global/EtestEAProject/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionRemote");
System.out.println("########## LookUp OK ##########");
if (servicecandidat.inscrireCandidat(c))
return SUCCESS;
else
return ERROR;
}catch (Exception lookupError) {
System.out.println("########## LookUp Echec ##########");
lookupError.printStackTrace();
return ERROR;
}
メソッドを実行しようとすると、コンソールに次の命名例外が表示されます
15:01:45,474 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ########## Initial Context OK ##########
15:01:45,680 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ########## LookUp Exchec ##########
15:01:45,682 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) javax.naming.NameNotFoundException: global/EtestEAProject/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionRemote -- service jboss.naming.context.java.jboss.exported.global.EtestEAProject.EtestMetier."CandidatSession!sessions.candidat.CandidatSessionRemote"
15:01:45,685 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
15:01:45,687 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
...........................
そして、ejb jar デプロイメントは次のように述べています。
java:global/EtestEAProject/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionRemote
java:app/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionRemote
java:module/CandidatSession!sessions.candidat.CandidatSessionRemote
java:jboss/exported/EtestEAProject/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionRemote
java:global/EtestEAProject/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionLocal
java:app/EtestMetier/CandidatSession!sessions.candidat.CandidatSessionLocal
java:module/CandidatSession!sessions.candidat.CandidatSessionLocal