URL Resources in WSAD 5.0's WAS 5.0 Test Environment

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

Contents

Your resources.xml File

If you want to manually edit your resources.xml, you have to find the right one. 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 following directory hierarchy:

Note that we have chosen the resources.xml at the node scope (localhost) rather than the one at server scope.

Admin Web Interface

If you're not up for direct modification of your server configuration's resources.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. Log in.

  5. In the righthand navigation panel, expand the Resources node and select URL Providers.

  6. Ensure that Node is selected for the scope. Then click on the Default URL Provider.

  7. At the bottom of the page, under Addition Properties, click URLs.

  8. Click the New button.

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

  10. 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.

  11. 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

  12. Click the OK button.

  13. Save the configuration.

  14. Click the Logout 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 resources.xml Manually

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

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

  2. Look for the resources.url:URLProvider tag with the name attribute of "Default URL Provider." If there are no URLs defined, the tag should occupy a single line. It should look something like
       <resources.url:URLProvider xmi:id="URLProvider_1" name="Default URL Provider" streamHandlerClassName="unused" protocol="unused"/>

  3. Replace the line above with the following three lines. Note that first line differs only the the "/" near the end of the line.
      <resources.url:URLProvider xmi:id="URLProvider_1" name="Default URL Provider" streamHandlerClassName="unused" protocol="unused">
        <factories xmi:type="resources.url:URL" xmi:id="URL_1" name="InitConfig" jndiName="url/initConfig" description="A sample initialization property file." spec="file:///c:/temp/init.props"/>
      </resources.url:URLProvider>
    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>
August, 2003