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:
- 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
- Deselect the option Start server with a generated script
- Restart the server
- 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
- Open a perspective that shows the Servers view, such as the JEE perspective
- Double click on the WebSphere Application Server entry in which you are interested
- Find the section called Optimize server start for development
- Deselect the Start server with a generated script option
Related information
Start server with a generated script
Make Test Environment working directory the same
| Segment | Product | Component | Platform | Version | Edition |
|---|---|---|---|---|---|
| Software Development | Rational Software Architect for WebSphere Software | Server Tooling | Windows | 8.0.4 |
Rate this page:
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.