URL Resources in WSAD 5.0's WAS 4.0 Test Environment

This note addresses the installation of a J2EE URL resource in the WAS 4.0 test environment of WebSphere Studio Application Developer 5.0. This task is easy using the admin console of WSAD AE or the admin web interface of WAS AEs. A facility for adding a URL resource directly into a WSAD server configuration has yet to materialize as of WSAD 5.0.1. The following steps demonstrate how to achieve this using the WAS AEs admin web interface. This can also be performed by direct modification of the server-cfg.xml.

Contents

Your server-cfg.xml File

Regardless of which method you chose, you need to know the location of the server-cfg.xml file used by your WebSphere Test Environment's (WTE's) server configuration. For some, this may be the hardest part of this task.

First you need to determine which WSAD project holds your WTE server configuration information. You provide this project name when you create a server configuration. But I don't know of a way to determine this from the server configuration itself. If you can't remember which folder you use for storing WTE configurations, switch to the server prospective and browse the folders in the Navigator view. Server projects will be denoted by a special server folder icon. This should considerably narrow downt the number of potential projects in which to find your configuration.

Your server project will have a folder named after your server configuration with the .wsc extension. This folder should contain the configuration's server-cfg.xml file. Right-click on this file and select Properties. The Location field should contain the fully qualified path name to server-cfg.xml file. Record this information for later.

Admin Web Interface

If you're not up for direct modification of your server configuration's server-cfg.xml file, you can opt for using the admin web application do this for you.

  1. Open the server configuration editor for your configuration to the Configuration tab. Check the Enable administration console checkbox and save the change.

  2. Start the server.

  3. Point a browser to the admin application using the following URL:
      http://localhost:9090/admin
    9090 is the default admin port. If yours is different, it will be listed in the configuration editor under the Ports tab.

  4. Click the Open link to choose a configuration file.

  5. The "configuration file now in use" will mostly likely be the one under runtimes/aes_v4/config/server-cfg.xml. This is not the one we want. In the Open configuration file field, select the option to Enter full path to file on server and enter the full pathname of the server-cfg.xml for your server configuration. This should have been determined beforehand. Click OK.

  6. Expand the following nodes in the navigation panel on the left side.

    Resources --> URL Providers --> Default URL Provider --> URLs

    Click on the URLs link to display the currently configured URLs. If this is your first one, there shouldn't be any listed.

  7. Click New.

  8. In the Name field, enter a name. This is simply an administrative name, not a JNDI name.

  9. In the JNDI Name field, enter the JNDI name. This will be a global JNDI name. When referred to, the
    java:comp/env
    should not be prepended to the name. This is a global name accessible to all web applications and EJBs.

  10. In the Spec field, enter the URL string. If you wanted to refer to a file on your file system that resided at
       c:\temp\my.properties
    you would enter
       file:///c:/temp/my.properties

  11. Click the Save menu item in the browser window.

  12. Click the OK button on the Save Configuration page.

  13. Click the Exit menu item in the browser window.

The URL is now configured for your WTE. You can restart the WTE without the admin application running if you like. In any case, your server code should be able to acquire a reference to the URL resource using the globel JNDI name you specified above.

Changing server-cfg.xml Manually

The admin web application can be time consuming. A quicker way is to manually edit the server-cfg.xml file. Generally it is not as safe as using the admin web application.

  1. The first step is to locate the relevant server-cfg.xml file. Open this file in a text editor.

  2. Look for the resourceProviders tag containing the xmi:type attribute of resources:URLProvider. The name attribute should be Default URL Provider.

  3. Place the following XML stanza inside the resourceProviders mentioned above.
        <factories xmi:type="resources:URL" xmi:id="URL_1" 
               name="wteurl"
               jndiName="url/wteurl" 
               jtaEnabled="false" 
               spec="file:///c:/temp/init.props">
          <description xsi:nil="true"/>
          <category xsi:nil="true"/>
          <propertySet xmi:id="J2EEResourcePropertySet_2"/>
        </factories>
       
    In the example above, the bold values are ones you supply.

  4. Save the file and restart your test environment server.


Paul Glezen <pglezen@us.ibm.com>
June, 2003