|
Walking through the necessary steps to
deploy a J2EE application on the Weblogic Application server...
While some Application
Servers might deploy code differently, each Application Server's container will run the code the
same, meaning
that you should be able to package and write your application virtually the same with only minor modifications in order
for it to run on different servers. Your code should be
able to run on ANY Application Server with minimal enhancements to your
code. And the deployment of an application has been made into much easier thanks in part to the ANT buildtool. Coincidentally you should be able to use the same ANT build script to build your application for any server - the only thing that may need to be changed is where the file(s) is actually deployed or copied to on the server.
For configuring and deploying an application, a good place to start
looking at BEA documents is at the Developing
WebLogic Server Applications page where it takes you through all of
the components that Weblogic needs to deploy an application, and how to
create them.
To deploy an application on Weblogic is a very standard process, and one that
is common to almost all Application servers today because of the J2EE standards that
have been put in place. It might be helpful to look at the Weblogic 6.0 document
sections that describe how to package
and deploy
an enterprise application on a Weblogic server.
NOTE: The ANT buildtool will be used to to create the proper format of the packaged .ear file.
Typically there is a .jar file contained in the .ear file that will
have an Enterprise Session JavaBean This .jar file will
contain the EJBHome interface, EJBRemote interface, the
EJBBean class, and the ejb-jar.xml and weblogic-ejb-jar.xml files. For
a Session EJB, the .xml files contain information regarding the
correctly packaged name of the EJB to be deployed, and the JNDI name of
the EJB that will be used to remotely identify and lookup the remote
interface of that EJB. If the .xml files are being used for an Entity
EJB, they will contain other information about the attributes of the EJB
and how they map to a database table for persistence. The .xml files
reside in the META-INF directory under the EJB staging directory where the
EJB Java files reside.
However, the EJBs could be contained in the same .jar file as the rest of your
application code, instead of having a separate .jar file for each EJB. The XML files for each
EJB will tell Weblogic which classes to remotely deploy on the server.
A single EJB deployment file structure might look like
this: CommonHome.class CommonRemote.class CommonEJB.class META-INF/ejb-jar.xml /weblogic-ejb-jar.xml
The next step is to create
a .war file to hold the JSPs, .HTML and Servlets A .war file is a
Web Archive and consists of any .HTML, JSPs, Servlets, Struts files, and a web.xml and
optionally a weblogic.xml file The web.xml file contains information
regarding the names of the Servlets that will be deployed and and
mapping information. The .xml files reside in the WEB-INF directory
under the directory where the JSPs and other files are. The file
structure would look like
this: JSPs .HTML Servlets WEB-INF/web.xml
Also need to create a struts-config.xml file that holds all of the mappings for the Servlets and navigation pages (JSPs).
Create
an .ear file to hold the previous .jar file and .war file. This is best done with the ANT
build tool, but you could do it manually if you had to.
An .ear file
is an Enterprise Archive and contains the previoulsy created .jar file and
the .war file, along with an application.xml file. The application.xml
file resides in the META-INF directory under the EAR staging directory,
where the .jar and .war files will be kept. A file structure could
look like this: .jar .war META-INF/application.xml
When you have finished packaging the .ear file you can copy it to your
BEA installation directory where your Weblogic server has been installed,
and put it into the YourDomain/applications directory. Once the server is
restarted and the .ear file is deployed from the YourDomain/application
directory, Weblogic will create or modify your config.xml
file. |