cancel
Showing results for 
Search instead for 
Did you mean: 

JCo Connection using file.properties doesn't work when deployed

Former Member
0 Kudos

Hello Experts,

I'm trying to connect to a SAP backend system using the JCo connection.

I've tyed with the standard connection, crating dinamically the connection and it works fine:

mConnection = JCO.createClient("001", // SAP client

"sap.user", // userid

"********", // password

"IT", // language

"ashost.domain.dom", // application server host name

"06"); // system number

mConnection.connect();

Then I tryed to store the login data in a file 'login.properties' put in the same package of my connection classes.

The code is:

String[] logonStr = new String[5];

Properties properties = new Properties();

try {

InputStream is = getClass().getResourceAsStream("login.properties");

properties.load(is);

} catch (Exception e) {

e.printStackTrace();

}

logonStr[0] = PropertyManager.getProperty(applicationProperties,"jco.client.client");

logonStr[1] = PropertyManager.getProperty(applicationProperties,"jco.client.user");

logonStr[2] = PropertyManager.getProperty(applicationProperties,"jco.client.passwd");

logonStr[3] = PropertyManager.getProperty(applicationProperties,"jco.client.ashost");

logonStr[4] = PropertyManager.getProperty(applicationProperties,"jco.client.sysnr");

mConnection = JCO.createClient(logonStr[0], // SAP client

logonStr[1], // userid

logonStr[2], // password

"IT", // language

logonStr[3], // application server host name

logonStr[4]); // system number

If I test locally this code it works fine and the login datas are extracted from the 'login.properties' file.

But when I deploy my PAR file in the Portal seems that the 'login.properties' file isn't found by my application...

Which could be the cause??

Could it be a permission problem??

Any Ideas?

Thanks in Advance,

Best Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you please check using 'ashost.domain.dom", // application server host name instead of application server host name in 'login.properties' file?

Thank you,

Shyam

Former Member
0 Kudos

Hi Shyam,

Thanks for your answer!

I could use the string "ashost.domain.dom" instead to extract it from the 'login.properties' but I need also the others login info as username and password.

My problem is that the 'login.properties' file is not found by my application when the PAR file is deployed in the portal...

I need to know if I need to move the 'login.properties' file in another package or something else...

Any ideas??

Have I to declare the .properties file in some configuration file (for example portalapp.xml or somthing similar..) ??

Best Regards...

Former Member
0 Kudos

Yes, Check the permissions for your deployement and also make sure both the jdk versions are matching.

Former Member
0 Kudos

Hello Rajesh,

thanks for your answer.

I checked the permessions and everything seems to be normal, it should work but it doesn't!

The jdk used is v 1,4 in local and remote system.

Best Regards..