JBoss 7: recherche JNDI
après un certain temps, j'ai fait de l'accès à distance à un EJB stateless exécuter sous JBoss 7.1.1. en utilisant les Propriétés de l'objet:
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
jndiProps.put(Context.SECURITY_PRINCIPAL, "remote");
jndiProps.put(Context.SECURITY_CREDENTIALS, "remotepwd");
jndiProps.put("jboss.naming.client.ejb.context", true);
Context ctx = new InitialContext(jndiProps);
String lookupString = "//HelloWorld/HelloWorldBean!org.acme.test.HelloWorld";
HelloWorld hw = (HelloWorld) ctx.lookup(lookupString);
System.out.println("Response: "+ hw.sayHello("Hi there"));
Donc cela fonctionne bien mais maintenant, je veux mettre de la JNDI chose dans jndi.fichier de propriétés, mais a échoué, c'est la façon dont le fichier ressemble à ceci:
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
java.naming.provider.url=remote://localhost:4447
java.naming.security.principal=remote
java.naming.security.credentials=remotepwd
L'exception:
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:HelloWorld,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@108c175
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at $Proxy0.sayHello(Unknown Source)
at de.brockhaus.test.client.TestClient.main(TestClient.java:35)
J'ai déjà allés à travers plusieurs doco, mais a échoué, alors comment a-t-elle de ressembler alors?
Vous devez vous connecter pour publier un commentaire.
OK, donc j'ai trouvé la réponse moi-même ...
Vous devez d'abord avoir deux des fichiers de propriétés, jndi.les propriétés de plus de jboss-ejb-client.les propriétés.
jndi.propriétés:
jboss-ejb-client.propriétés:
Avoir tous les deux sur le chemin de la classe va rendre le code à exécuter comme un charme, même sans spécifier les propriétés dans le code.
Toujours déroutant, c'est la construction de la recherche de chaîne de caractères ...