In the JDeveloper integrated development environment, you can create generic J2EE EJBs. JDeveloper also supports direct deployment of EJB applications to a standalone OC4J instance, Oracle Application Server, and WebLogic 6.1 or 7.0SP1. In addition, JDeveloper supports creation of a J2EE EJB JAR file for deployment to JBoss 3.0.4 (with Tomcat 4.1.12).
To deploy EJB JARs to JBoss:
On UNIX (Bourne Shell), set the JAVA_HOME
environment variable
and add the Java2 SDK's bin directory to your PATH. For example:
export JAVA_HOME=/usr/java/jdk1.4
export PATH=${PATH}:${JAVA_HOME}/bin
JBoss\bin
directory. For example:C:\JBoss-3.0.4\bin
After JBoss is started, several lines appear in the command shell.
C:\JBoss-3.0.4\client
, and are used to test an EJB deployed within
JBoss. See Including
Libraries in a Project.info
.
This creates a method on the EJB that can be invoked in the EJB test application.jboss.xml
file if
you want to support JBoss-specific configuration options for the EJBs. For
example, you can modify the JNDI name of your EJB resources or include custom
containers in jboss.xml. See Creating
a jboss.xml file.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() );
ejb1.deploy
.
ejb1.deploy
and choose
Deploy to JAR file from the context menu.
The EJB module is packaged as an EJB JAR file and saved to the local directory
or mapped network drive which you specified in the EJB deployment profile
settings panel. .jar
file. For example:
Beginning to deploy to the EJB JAR file...
Wrote EJB .jar file to D:\jdev\mywork\Workspace2\Project1\ejb1.jar
---- Deployment finished. ---- July 6, 2002 2:58:05 PM
JBoss/deploy
directory.
See Also:
http://www.jboss.org
http://www.jboss.org/online-manual/HTML/index.html