cancel
Showing results for 
Search instead for 
Did you mean: 

deploy tool project classpath

Former Member
0 Kudos

Our application reads configuration information from two external Java properties files. One of these files must be located in the classpath. Since the application was not developed in NWDS (we use Eclipse 3.x), we use the deploy tool to deploy the EAR (containing WAR and EJB jar). We tried using the project classpath in the project options of the deploy tool to specify the local directory where to find the Java properties file. However, this did not work as our app was unable to find the file. We had to put the directory on the JVM's system classpath, which is not ideal.

How exactly do the entries specified for project classpath get inserted into the class loader heirarchy of NetWeaver AS? Or do they? I have read "Extended Java Class Loading of SAP NetWeaver" but did not see any mention of the project classpath set using the deploy tool.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The problem with putting property files in WEB-INF/classes is that if you have environment sensitive properties, you have to re-build the WAR for each environment. We have several properties that define host names and ports for various services. These change depending on the environment (i.e. dev, uat, prod).

Former Member
0 Kudos

Craig, yes, one war file per target system (dev, qa, prod, etc). You don't need to manually edit/patch those files, use ant to automatically generate all of these .war files in one step.

Former Member
0 Kudos

I disagree with that approach. Why build multiple WAR files? I want to build just one WAR file for all environments and then a local configuration file provides environment specific information. The configuration file contains sensitive information that only the system administrator should know and not the application assembler.

Former Member
0 Kudos

In that case you could provide the admin with a script to manipulate the .war/.ear file (replacing the configuration entries resp. property files with appropriate ones) before deployment. What I mean: why artificially sophisticate the solution?

Former Member
0 Kudos

Hi,

I don't understand the problem very well, but I have used Property files often and did not experience difficulties.

I ususally place the properties files in the WEB-INF/classes directory, this way they get loaded automatically.

And for retrieving properties settings in my application I use this code:


package whatever.utils;


import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;

import com.sapmarkets.isa.core.logging.IsaLocation;

public class WhateverProperties {
    
    private static Properties properties;

    static {
        loadProperties();
    }

    private static void loadProperties() {

	    final String RESOURCE = "/propertiesfilename.properties";
        try {
			properties = new Properties();
			InputStream is = WhateverProperties.class.getResourceAsStream(RESOURCE);
			properties.load(is);
        } catch(Exception ioexc) {
...
... 
        }
    }

    public static String getProperty(String prop) {
        return properties.getProperty(prop);
    }


    public static Enumeration getPropertyNames() {
        return properties.propertyNames();
    }
}

Good luck!

Roelof

Message was edited by: R. Knibbe