Skip to Content
avatar image
Former Member

JCO properties file Linux..Urgent !!!!

how do i load linux properties..file...

if anyone have download the sapjco connector for linux

inside the folder> demo > Tutorial2Connect & OrderedProperties it gives you how to connect to properties file...

i done in in windows ok...

but when i run in linux..with the following coding...

this is the error message

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:799)

logon:java.io.FileNotFoundException: /home/osbdev/logon.properties (No such file or directory)

mRepository com.sap.mw.jco.JCO$Repository@77387738

createPool

java.io.FileNotFoundException: /home/osbdev/logon.properties (No such file or directory)

if i remark out the gpath for windows..it works for windows...

but it doesnt work for linux..pls advice....

private String connectionPool = "SoccerPool";
	private JCO.Repository mRepository = null;
//for linux	
public String gpath="/home/osbdev/working/tomcat/webapps/logon.properties";
	
//public String gpath="C:\tomcat\webapps\\logon.properties"; >>for windows


public JCOConnection(){
		JCO.Pool pool = JCO.getClientPoolManager().getPool(connectionPool);
		if (pool == null) {
			System.out.println("createPool");
			OrderedProperties logonProperties;
			try {
logonProperties = OrderedProperties.load(gpath); JCO.addClientPool(connectionPool,5,logonProperties);
	
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				System.err.println("logon:" +e);
			}catch(Throwable ex){
				ex.printStackTrace();
				
			}
		       
		
		}
		mRepository = new JCO.Repository("ElectcomsRepository", connectionPool);
		System.out.println("mRepository " + mRepository);
	}





//Ordered Properties class
public class OrderedProperties extends java.util.Properties {
  ArrayList orderedKeys = new ArrayList();
  public OrderedProperties() {
    super();
  }
  public OrderedProperties(java.util.Properties defaults) {
    super(defaults);
  }
  public synchronized Iterator getKeysIterator() {
    return orderedKeys.iterator();
  }
 
  
  public static OrderedProperties load(String name)
                                  throws IOException {
    OrderedProperties props = null;
    //java.io.InputStream is =OrderedProperties.class.getResourceAsStream("/WEB-INF/" +name); 
    
    java.io.InputStream is=new FileInputStream(name);	
	//System.out.println();
    if ( is != null ) {
      props = new OrderedProperties();
      props.load(is);
      return props;
    } else {
      if ( ! name.startsWith("/") ) {
        return load("/" + name);
      } else {
        throw new IOException("Properties could not be loaded.");
      }
    }
  }
  


/*  
public void load(InputStream inputS){
	OrderedProperties props=null;
	props.load(inputS);
}  

*/
  public synchronized Object put(Object key, Object value) {
    Object obj = super.put(key, value);
    orderedKeys.add(key);
    return obj;
  }
  public synchronized Object remove(Object key) {
    Object obj = super.remove(key);
    orderedKeys.remove(key);
    return obj;
  }
}

Message was edited by:

yzme yzme

Message was edited by:

yzme yzme

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 27, 2007 at 11:30 AM

    yzme,

    Did you test your code on real Linux OS (like RH) or with cygwin?

    The later has a lot of problems with file paths, if you are using Windows JVM you must use windows style paths with cygwin.

    VS

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      <i>naming of the file...login.properties but get the file logon.properties.. </i>

      😊)

      The most complex type of errors, seriously.

      VS