If you wish to test your deployed EJB module on the JBoss application server, package it with a test client.
To package EJB components for testing
info
. This creates a
method on the EJB that can be invoked in the EJB test application.
C:\JBoss-3.0.4\client
, and are
used to test an EJB deployed within JBoss.
info
. This creates a
method on the EJB that can be invoked in the EJB test application.
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
env.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces" );
setInfo
and getInfo
methods previously added by the EJB Class Designer. For example, the
test application is modified to invoke these methods:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
Context ctx = new InitialContext(env);
MySessionEJBHome mySessionEJBHome = (MySessionEJBHome)ctx.lookup("MySessionEJB");
// Use one of the create() methods below to create a new instance
MySessionEJB mySessionEJB = mySessionEJBHome.create( );
// Call any of the Remote methods below to access the EJB
mySessionEJB.setInfo( "Hello World" );
System.out.println( MySessionEJB.getInfo() );
To test the EJB in JBoss
For more information, see the JBoss website at
www.jboss.org
.
About J2EE Deployment
About J2EE Archive Formats
About
Deployment Profiles
About
Deployment Descriptors
Packaging
J2EE Applications
Deploying J2EE
Applications
Deploying Applications
to J2EE Application Servers
Copyright © 1997, 2004, Oracle. All rights reserved.