Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. Properties jndiProps = new Properties();
  2. jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  3. jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
  4. jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
  5. jndiProps.put(Context.SECURITY_PRINCIPAL, "testuser");
  6. jndiProps.put(Context.SECURITY_CREDENTIALS, "testpasswort");
  7. Context ctx = new InitialContext(jndiProps);
  8. HelloWorldRemote hello = (HelloWorldRemote) ctx.lookup("java:global[/ejbproject1]/ejbproject1/HelloWorldBean[/HelloWorldRemote]");
  9.  
  10. @Stateless(name="hello")
  11. public class HelloWorldBean implements HelloWorldRemote{
  12.  
  13. @Override
  14. public String hello(String value) {
  15. System.out.println("Say hello to "+value);
  16. return "Hello " + value;
  17. }
  18.  
  19. 18:19:07,464 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named hello in deployment unit deployment "ejbproject1.jar" are as follows:
  20.  
  21. java:global/ejbproject1/hello!interfaces.HelloWorldRemote
  22. java:app/ejbproject1/hello!interfaces.HelloWorldRemote
  23. java:module/hello!interfaces.HelloWorldRemote
  24. java:jboss/exported/ejbproject1/hello!interfaces.HelloWorldRemote
  25. java:global/ejbproject1/hello
  26. java:app/ejbproject1/hello
  27. java:module/hello
  28.  
  29. javax.naming.NameNotFoundException: global[/ejbproject1]/ejbproject1/HelloWorldBean[/HelloWorldRemote] -- service jboss.naming.context.java.jboss.exported.global[.ejbproject1].ejbproject1.HelloWorldBean[.HelloWorldRemote]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement