Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

properties file fails to load

 
Scott R.
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run my swing app which connects to an oracle database. It gets the database values (sid, port, etc) from a .properties file. I instantiate a new properties object and then try to load the .properties file from the jar as follows.

Properties p = new Properties();
try {
p.load(getClass().getResourceAsStream("properties/database.properties"));
} catch (IOException ex3) {
System.out.println("IO Error");
}

p.load(InputStream) is recieving a null value and thus not able to collect the database values I need.

I have used jar -tf to make sure the properties file is in the jar and it reads back:

MyPackage/properties/database.properties

I have also tried using the classloader from previous posts but to no avail.

Any Ideas?
 
Scott R.
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to sign your jars to allow access to network resources (JDBC connection)
 
Sudeep Agrawal
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?


Yup you can connect to the Oracle database using JDBC, or via Datasource.
 
Sudeep Agrawal
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?


Yup you can connect to the Oracle database using JDBC, or via Datasource.
 
Balachandran Paranjothimani
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?
 
ved gunjan
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balachandran,
--------------------------------------------------------------------------
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?
--------------------------------------------------------------------------

I'm stuckup with reading the input arguments in the main method of the JNLP file....
can u tell me more about how to read these values...if u can paste your class then it would be great..

looking forward for reply.

Thanks
Ved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic