Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Properties jndiProps = new Properties();
- jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
- jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
- jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
- jndiProps.put(Context.SECURITY_PRINCIPAL, "testuser");
- jndiProps.put(Context.SECURITY_CREDENTIALS, "testpasswort");
- Context ctx = new InitialContext(jndiProps);
- HelloWorldRemote hello = (HelloWorldRemote) ctx.lookup("java:global[/ejbproject1]/ejbproject1/HelloWorldBean[/HelloWorldRemote]");
- @Stateless(name="hello")
- public class HelloWorldBean implements HelloWorldRemote{
- @Override
- public String hello(String value) {
- System.out.println("Say hello to "+value);
- return "Hello " + value;
- }
- 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:
- java:global/ejbproject1/hello!interfaces.HelloWorldRemote
- java:app/ejbproject1/hello!interfaces.HelloWorldRemote
- java:module/hello!interfaces.HelloWorldRemote
- java:jboss/exported/ejbproject1/hello!interfaces.HelloWorldRemote
- java:global/ejbproject1/hello
- java:app/ejbproject1/hello
- java:module/hello
- 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