O'Reilly logo

Java Servlet & JSP Cookbook by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.3. Deploying an Individual Servlet on WebLogic

Problem

You want to take your compiled servlet and install it in BEA WebLogic Server 7.0 to find out if it is working.

Solution

Copy and paste the class file into WebLogic's default web application (or into a web application that you have already installed). Use the WebLogic Administration Console to alter the web.xml file and give the servlet a sensible name with which to request it in a browser, or use an Ant build file to move the file temporarily into the WebLogic default web application.

Discussion

WebLogic 7.0's default web application is located on the following path: <WebLogic-installation-directory>/user_projects/<mydomain>/applications/DefaultWebApp. In the default installation of the WebLogic 7.0 server, not much exists in the default web application but a web.xml deployment descriptor, and some image files. To add a servlet to the default application, paste your servlet class, including its package-related directories, into the DefaultWebApp/WEB-INF/classes directory. You might have to create a classes directory the first time you do this. Change the web.xml file to give the servlet a name (which is easier through the Administration Console) before redeploying the web application as described in Recipe 2.4.

Use the Administration Console to edit the web.xml file in order to give the new servlet a registered name and servlet-mapping element. You can also use another available tool, such as WebLogic Builder (Recipe 2.9) or ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required