cancel
Showing results for 
Search instead for 
Did you mean: 

JCO properties file Linux..Urgent !!!!

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

linux redhat ........(REAL)

not CYGWIN

Message was edited by:

yzme yzme

Former Member
0 Kudos

yzme,

From your exception it's not obvious that IO exception occured. Please add

System.out.println( logonProperties );

...right after line:

logonProperties = OrderedProperties.load(gpath);

Do you see properties loaded in output?

VS

Former Member
0 Kudos

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)

this is the error message

Message was edited by:

yzme yzme

Former Member
0 Kudos

OH....finally case closed.....

naming of the file...login.properties but get the file logon.properties..

Former Member
0 Kudos

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

)

The most complex type of errors, seriously.

VS