Skip to main content

Because of the change in the working directory of the WebSphere Application Server Test Environment, property files cannot be found


Technote (troubleshooting)


Problem(Abstract)

In IBM Rational Application Developer (RAD) v8.0.4, the working directory of the IBM WebSphere Application Server Test Environment is different from what it used to be in RAD version v7.5 and the property files can no longer be found as a result.

Symptom

Your application deployed on the WebSphere Application Server Test Environment loads property files with a syntax like:

String propertiesFile = propertyFileRelativePath;

java.util.Properties p  = new java.util.Properties();          

p.load( new java.io.FileInputStream(propertiesFile) );        

String property = p.getProperty("propertyName");  

After the migration from Rational Application Developer v7.5 to v8.0.4, the properties files are no longer found.

The following steps recreate the problem scenario:

  1. Execute a servlet containing the code: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {File dir1=new File("."); System.out.println("Current Directory: " + dir1.getAbsolutePath()); System.out.println("User directory: "+ System.getProperty("user.dir"));}

    The result is the following output: [3/28/12 11:49:55:735 CEST]0000001e SystemOut O Current Directory: C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\bin\. [3/28/1211:49:55:736 CEST] 0000001e SystemOut O User directory: C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\bin

  2. Deselect the option Start server with a generated script

  3. Restart the server

  4. Execute the servlet. It now returns the same output as in RAD v7.5: [3/28/12 11:59:17:930 CEST] 0000003a SystemOut O Current Directory: C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\.
    [3/2 8/12 11:59:17:930 CEST] 0000003a SystemOut O User directory:
    C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1


Cause

This problem is the direct result of the introduction of the new property located in the Server editor, namely Optimize server start for development > Start Server with a generated script

Resolving the problem

SOLUTION

  1. Open a perspective that shows the Servers view, such as the JEE perspective

  2. Double click on the WebSphere Application Server entry in which you are interested

  3. Find the section called Optimize server start for development

  4. Deselect the Start server with a generated script option

Related information

Start server with a generated script
Make Test Environment working directory the same

Cross reference information
Segment Product Component Platform Version Edition
Software Development Rational Software Architect for WebSphere Software Server Tooling Windows 8.0.4

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

Rational Application Developer for WebSphere Software

Server Tooling


Software version:
8.0.4


Operating system(s):
Windows


Reference #:
1589188


Modified date:
2013-02-05

Translate my page

Content navigation