B Developing SIP Servlets Using Eclipse

This appendix describes how to use Eclipse to develop SIP Servlets for use with Oracle WebLogic Server SIP Container, in the following sections:

B.1 Overview

This document provides detailed instructions for using the Eclipse IDE as a tool for developing and deploying SIP Servlets with Oracle WebLogic Server SIP Container. The full development environment requires the following components, which you must obtain and install before proceeding:

  • Oracle WebLogic Server SIP Container

  • JDK 1.6.05

  • Eclipse version 3.4 or Eclipse 3.3 Europe. This includes a CVS client and server (required only for version control).

B.1.1 SIP Servlet Organization

Building a SIP Servlet produces a Web Archive (WAR file or directory) as an end product. A basic SIP Servlet WAR file contains the subdirectories and contents described in Figure B-1.

Figure B-1 SIP Servlet WAR Contents

WAR contents
Description of "Figure B-1 SIP Servlet WAR Contents"

B.2 Setting Up the Development Environment

Follow these steps to set up the development environment for a new SIP Servlet project:

  1. Create a new Oracle WebLogic Server SIP Container Domain.

  2. Create a new Eclipse project.

The sections that follow describe each step in detail.

B.2.1 Creating a Oracle WebLogic Server SIP Container Domain

In order to deploy and test your SIP Servlet, you need access to a Oracle WebLogic Server SIP Container domain that you can reconfigure and restart as necessary. Follow the instructions in Oracle WebLogic Server SIP Container Installation Guide to create a new domain using the Configuration Wizard. When generating a new domain:

  • Select Development Mode as the startup mode for the new domain.

  • Select Sun SDK 1.6.05 as the SDK for the new domain.

B.2.2 Verifying the Default Eclipse JVM

Eclipse 3.4 uses the required version Java 6 (1.6) by default. Follow these steps to verify the configured JVM:

  1. Start Eclipse.

  2. Select Window >Preferences.

  3. Expand the Java category in the left pane, and select Installed JREs.

  4. Verify that Java 6 (1.6) is configured. If it is, proceed to step 10.

  5. If not configured correctly, click Add... to add a new JRE.

  6. Enter a name to use for the new JRE in the JRE name field.

  7. Click the Browse... button next to the JRE home directory field. Then navigate to the MIDDLEWARE_HOME/jdk160_05 directory and click OK.

  8. Click OK to add the new JRE.

  9. Select the check box next to the new JRE to make it the default.

  10. Click OK to dismiss the preferences dialog.

B.2.3 Creating a New Eclipse Project

Follow these steps to create a new Eclipse project for your SIP Servlet development, adding the Oracle WebLogic Server SIP Container libraries required for building and deploying the application:

  1. Start Eclipse.

  2. Select File > New > Project...

  3. Select Java Project and click Next.

  4. Enter a name for your project in the Project Name field.

  5. In the Location field, select "Create project in workspace" if you have not yet begun writing the SIP Servlet code. If you already have source code available in another location, select "Create project at external location" and specify the directory. Click Next.

  6. Click the Libraries tab and follow these steps to add required JARs to your project:

    1. Click Add External JARs...

    2. Use the JAR selection dialog to add the MIDDLEWARE_HOME/server/lib/weblogic.jar file to your project.

    3. Repeat the process to add the MIDDLEWARE_HOME/server/lib/wlss/sipservlet.jar and MIDDLEWARE_HOME/server/lib/wlss/wlssapi.jar files to your project.

  7. Add any additional JAR files that you may require for your project.

  8. To enable deploying directly from eclipse, change the build folder from /src/build to /src/WebContent/WEB-INF/classes. This means that you do not have to package the application before deploying it.

  9. Click Finish to create the new project. Eclipse displays your new project name in the Package Explorer.

  10. Right-click on the name of your project and use the New >Folder command to recreate the directory structure shown in Figure B-1, "SIP Servlet WAR Contents".

B.3 Building and Deploying the Project

The build.xml file that you created compiles your code, packages the WAR, and copies the WAR file to the /applications subdirectory of your development domain. Oracle WebLogic Server SIP Container automatically deploys valid applications located in the /applications subdirectory.

B.4 Debugging SIP Servlets

In order to debug SIP Servlets, you must enable certain debug options when you start Oracle WebLogic Server SIP Container. Follow these steps to add the required debug options to the script used to start Oracle WebLogic Server SIP Container, and to attachthe debugger from within Eclipse:


On Linux, debug is enabled by default if you install in developer mode. However, the port is set to 8453.
  1. Use a text editor to open the StartWebLogic.cmd script for your development domain.

  2. Beneath the line that reads:

    Enter the following line:
    set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n
  3. In the last line of the file, add the %DEBUG_OPTS% variable in the place indicated below:

    -Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER% 
    -Djava.security.policy="%MIDDLEWARE_HOME%\server\lib\weblogic.policy" weblogic.Server
  4. Save the file and use the script to restart Oracle WebLogic Server SIP Container.

  5. To attach the debugger from within Eclipse select the Run > Open debug dialog.

  6. Create a new "Remote Java Application".

  7. Enter the host and port corresponding to the DEBUG_OPTS.