Home > Articles > Programming > Java

Development and Deployment for WebLogic and WebSphere

JBuilder's support for multiple application servers makes it among the most versatile IDEs available. This chapter will teach you how to make JBuilder work with WebLogic and WebSphere, noting the particular differences between each application server.
This chapter is from the book

This chapter is from the book

In This Chapter

  • Using WebLogic with JBuilder
  • Using IBM WebSphere with JBuilder

JBuilder's support for multiple application servers makes this the most versatile IDE on the market. The support includes not only the writing of code but deploying, debugging, and wizards also. As we look at the difference between WebLogic and WebSphere, you will notice JBuilder's capability to mask the differences from application server to application server. The following processes are important to examine for each application server:

  • Installing the application server

  • Developing a JSP and/or servlet

  • Creating EJBs

  • Deploying your application

  • Remote debugging your application

Using WebLogic with JBuilder

BEA WebLogic Application Server is a full-featured, standards-based application server providing the foundation on which an enterprise can build its applications. For all the crucial tasks of application development and deployment—from integrating enterprise systems and databases to delivering services and collaborating over the Internet—the starting place is BEA WebLogic Server. With its comprehensive set of features, compliance with open standards, multitiered architecture, and support for component-based development, WebLogic Application Server is the choice of Internet-savvy businesses to develop and deploy best-of-breed applications. As we look at the integration between WebLogic and JBuilder, we will look at the following key elements for using the best-of-breed IDE:

  • Installing WebLogic

  • Configuring JBuilder for WebLogic

  • Developing servlets and JSPs

  • Developing EJBs

  • Deploying your application components

  • Debugging

Installing WebLogic Application Server

To create and install WebLogic Application Server, you typically follow the installation directions provided by BEA. The process for creating a server varies from platform to platform, but this chapter shows specifically how to configure and set up a single server within the Windows environment. To develop and debug your WebLogic application, it is most advantageous to install the server locally with your installation of JBuilder. The following steps are required to set up a WebLogic Application Server—single server.

  1. Install the WebLogic Application Server into the C:\BEA directory. Use the supplied setup either downloaded from the BEA Web site or using the BEA distribution CD.

  2. Create and configure a server using the Configuration Wizard. This wizard is accessed by clicking on Start, All Programs, BEA WebLogic Platform 7.0, Configuration Wizard.

  3. Supply the following properties to the Configuration Wizard:

  4. Property

    Value

    Domain name

    dev

    Server type

    Single Server

    Domain location

    C:\bea\user_projects\


NOTE

From this point forward, the domain location will actually be the domain location plus the name of the domain. For example, in this instance the directory location is actually c:\bea\user_projects\dev.

Configuring JBuilder with WebLogic

JBuilder supports a wide variety of different application servers, WebLogic being one of them. To have JBuilder properly communicate with these environments, you must configure JBuilder to recognize them. When an application server environment is selected, JBuilder then configures the features, code generators and wizards, command-line utilities, classpaths, and deployment and runtime options for the vendor's specific implementation requirements. To access JBuilder's configuration of application servers, you must enter the editor by choosing Tools, Configure Servers from the menu (see Figure 27.1) and enable the application servers you want to use within JBuilder. This is not a one-time setup for each developer's login, but you can change these parameters by reentering the editor anytime.

Figure 27.1Figure 27.1 Application server setup within the JBuilder environment for WebLogic integration.

To enable the desired application server, select it in the list on the left and click the Enable server check box for that application server configuration. You now have full access to the features available within the given application server. For example, if you choose an application server that does not support EJB 2.0 Entity Beans, it will not allow you to build 2.0 Entity Beans within your application.

WebLogic 7.0 is not specifically supported within the JBuilder environment but can easily be configured to work. The following steps set up WebLogic 7.0 within the JBuilder environment:

  1. Click Tools, Configure Servers.

  2. Select WebLogic Application Server 6.x+.

  3. Click the Enable server check box.

  4. Enter the following properties for the WebLogic Application Server:

  5. Property

    Value

    Home directory

    c:\bea\weblogic\server

    Main class

    weblogic.Server

    VM parameters

    -ms64m
    -mx64m
    -Djava.library.path=/bea/wlserver6.0/bin
    -Dbea.home=/bea

    -Dweblogic.Domain=mydomain

    -Dweblogic.Name=myserver

    -Djava.security.policy==/bea/wlserver6.0/lib/weblogic.policy
    -Dweblogic.management.discover=false

    -Dweblogic.ProductionModeEnabled=false

    Working directory

    c:\bea\user_projects\dev

Using Servlets and JSPs with WebLogic

When using JBuilder, the IDE isolates the differences between the application server containers within its wizards. For example, the process for creating JSPs and servlets is exactly the same as that of BES, with one exception. This exception is to specify which container will supply the necessary services for implementation. The following steps are necessary to create a BEA JSP and servlet project:

  1. Select File, New, Project tab from the Object Gallery.

  2. Choose Project.

  3. In the Project Wizard - Step 1 of 3, specify the project name and other important properties.

  4. Select Finish.

  5. Choose Project, Project Properties.

  6. Select the Server tab (see Figure 27.2).

  7. Figure 27.2Figure 27.2 Project Properties window for the newly created project.

    NOTE

    JBuilder not only allows for development and deployment to multiple application servers, but also allows for a mixing of service providers across the same project.

  8. Select the WebLogic Application Server 6.x+ in the combo box.

  9. Compile and save your project.

All other processes for creating JSPs and servlets are exactly the same.

The following process is used to create a Web application using WebLogic Application Server:

  1. Create a Web application. Select File, New, Web tab in the Object Gallery.

  2. Select a Web application. Make sure to choose the check box Generate WAR.

  3. Click File, New, Web tab in the Object Gallery.

  4. Select the JavaServer page.

  5. Compile and save the project.

  6. Right-click on the JSP and select Web Run using <name>.jsp.

Working with EJBs

Creating an EJB-based solution implemented within WebLogic is similar to creating a JSP. The preparatory tasks of specifying the application server are exactly the same. The only difference happens if the version of WebLogic supports varying forms of EJB specification. For example, when using versions of WebLogic prior to version 6.5, you will have a limited feature set available within JBuilder. CMP 2.0 is one such feature that is not available.

Creating a Session Bean

Using the JBuilder EJB Designer, we are going to create a Session Bean that uses the interface implemented in our earlier client application. To build this Session Bean, we will perform a set of steps within JBuilder's IDE:

  1. Double-click on the EJB module you want to use as the container for your new Session Bean.

  2. Right-click on the design window or on the node and select New Session Bean.

  3. Name and configure your Session Bean (see Figure 27.3). Configure the following properties:

  4. Bean name:

    weatherStation

    Interfaces:

    Remote

    Session type:

    Stateless


    Figure 27.3Figure 27.3 Configure your Session Bean by changing the properties through the EJB Designer.

  5. Right-click on the new Session Bean and add a method. This process is similar to adding a new field (see Figure 27.4). The method you want to add is the following (see Figure 27.5):

  6. Method name:

    getCurrentTemp

    Return type:

    int

    Input parameters:

    java.lang.String zipcode

    Interfaces:

    Remote


    Figure 27.4Figure 27.4 Using the context menu to add methods or fields to your Session Bean graphically.

    Figure 27.5Figure 27.5 Configuring your method and assigning the given properties.

  7. Assign the desired names to the generated code for the Bean implementation, as shown in Figure 27.6. For example, change the default package of the Session Beans to com.sams.weatherstation.session. This is accomplished by selecting the classes and packages button on the properties for the entire Bean. If you do not see this button on the properties pop-up panel of the Bean, reselect the title of the Bean.

  8. Figure 27.6Figure 27.6 Change the default package for a Session Bean.

  9. Compile and save your project.

Creating an Entity Bean

Just like Session Beans, the Entity Bean usage does not change dramatically more than the BES development and deployment. The following steps create an Entity Bean using the WebLogic environment:

  1. Import a schema from the data source in the EJB module containing your Session Beans. This is accomplished by right-clicking on the data source node when you are in the EJB Designer and selecting Import Schema from Datasource.

  2. Set the following database parameters:

    • Driver: com.borland.datastore.jdbc.DataStoreDriver

    • URL: jdbc:borland:dslocal:C:\JBDG\db\ChalkTalk.jds

    • Username: leave blank

    • Password: leave blank

  3. Right-click on each table and create a CMP 2.0 Entity Bean for each table. For example, right-click on the table room and create a CMP 2.0 Bean.

  4. Define relationships.

  5. Compile and save your project.

Deploying Your Application

JBuilder insulates you from the details of the implementation that are WebLogic specific. For example, the deployment descriptor has some WebLogic-specific information contained within many of its components (see Listing 27.1).

Listing 27.1 WebLogic Deployment Descriptor for a Sample Project (weblogic-ejb-jar.xml Located within the Deployment JAR)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.
//DTD WebLogic 7.0.0 EJB//EN' 
'http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
  <weblogic-enterprise-bean>
    <ejb-name>Cart</ejb-name>
    <reference-descriptor>
      <ejb-local-reference-description>
        <ejb-ref-name>ejb/Orderitem</ejb-ref-name>
        <jndi-name>Orderitem</jndi-name>
      </ejb-local-reference-description>
      <ejb-local-reference-description>
        <ejb-ref-name>ejb/ShoppingCart</ejb-ref-name>
        <jndi-name>ShoppingCart</jndi-name>
      </ejb-local-reference-description>
      <ejb-local-reference-description>
        <ejb-ref-name>ejb/ServerDataModule</ejb-ref-name>
        <jndi-name>ServerDataModule</jndi-name>
      </ejb-local-reference-description>
      <ejb-local-reference-description>
        <ejb-ref-name>ejb/User</ejb-ref-name>
        <jndi-name>User</jndi-name>
      </ejb-local-reference-description>
    </reference-descriptor>
    <jndi-name>Cart</jndi-name>
...
  </weblogic-enterprise-bean>
  <weblogic-enterprise-bean>
    <ejb-name>Sequence</ejb-name>
    <entity-descriptor>
      <persistence>
        <persistence-use>
          <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
          <type-version>6.0</type-version>
          <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml
</type-storage>
        </persistence-use>
      </persistence>
    </entity-descriptor>
    <local-jndi-name>Sequence</local-jndi-name>
  </weblogic-enterprise-bean>
</weblogic-ejb-jar>

This file contains all the WebLogic-specific configurations required for the deployment of your application.

Remote Debugging

JBuilder contains the facilities to remotely debug an application running within another JVM process. To remotely debug this application deployed on the application server, specifically WebLogic Server, you must start your server in debug mode. The following process is required to create the hooks necessary for remote debugging within WebLogic:

  1. Copy startWebLogic.cmd to startRemoteWeblogic.cmd. This file is located in your user project directory plus your WebLogic domain name—for example, c:\bea\user_projects\dev.

  2. Make the following change to your newly copied startRemoteWeblogic.cmd file:

  3. @rem Call WebLogic Server
    call "c:\bea\weblogic700\server\bin\startRemoteWLS.cmd"
  4. Copy from c:\bea\weblogic700\server\bin the file startWLS.cmd to startRemoteWLS.cmd.

  5. Make the following changes to startRemoteWLS.cmd:

  6. Modification 1—Change the classpath.

    set CLASSPATH=%JAVA_HOME%\lib\tools.jar;
    c:\borland\jbuilder7\lib\jaxrpc.jar;
    c:\borland\jbuilder7\lib\jds.jar;
    c:\borland\jbuilder7\lib\jdsremote.jar;
    c:\borland\jbuilder7\lib\jdsserver.jar;
    %WL_HOME%\server\lib\weblogic_sp.jar;
    %WL_HOME%\server\lib\weblogic.jar;%CLASSPATH%

    Modification 2—Change command switches for starting WebLogic Server.

    @rem Start Server
    @echo off
    if "%ADMIN_URL%" == "" goto runAdmin
    @echo on
    "%JAVA_HOME%\bin\java" -classic %MEM_ARGS% -Xdebug –Xnoagent 
    Djava.compiler=NONE 
    Xrunjdwp:transport=dt_socket,server=y,address=5555,suspend=n 
    %JAVA_OPTIONS% 
    classpath "%CLASSPATH%" -Dweblogic.Name=%SERVER_NAME% 
    Dbea.home="C:\bea" -Dweblogic.management.username=%WLS_USER% 
    Dweblogic.management.password=%WLS_PW% 
    Dweblogic.management.server=%ADMIN_URL% 
    Dweblogic.ProductionModeEnabled=%STARTMODE%
    Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" 
    Daxis.enableListQuery=true
    weblogic.Server
    goto finish
    
    :runAdmin
    @echo on
    "%JAVA_HOME%\bin\java" -classic %MEM_ARGS% -Xdebug -Xnoagent 
    Djava.compiler=NONE 
    Xrunjdwp:transport=dt_socket,server=y,address=5555,suspend=n 
    %JAVA_OPTIONS% 
    classpath "%CLASSPATH%" -Dweblogic.Name=%SERVER_NAME% 
    Dbea.home="C:\bea" -Dweblogic.management.username=%WLS_USER% 
    Dweblogic.management.password=%WLS_PW% 
    Dweblogic.ProductionModeEnabled=%STARTMODE% 
    Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" 
    Daxis.enableListQuery=true
    weblogic.Server
    
    :finish
  7. Start the WebLogic Application Server by executing c:\bea\user_projects\ dev\startRemoteWebLogic.

  8. Create a new run configuration. Select Run, Configuration.

  9. Click the New button to create a new configuration.

  10. Click the Debug tab to edit the runtime properties (see Figure 27.7).

  11. Figure 27.1Figure 27.7 Debug runtime configuration for remotely debugging a WebLogic deployment.

  12. Assign a configuration name to the newly created configuration. Check the Enable Remote Debugging check box.

  13. Click the Attach within the Remote Settings panel.

  14. Enter the address as 5555 and change the Build Target to <NONE>.

  15. Assign breakpoints to the remote code.

  16. Select Run, Debug Project. Select the Remote Debug configuration created earlier. This starts your application in debug mode.

  17. Debug your application.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020