Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to read property file normally. #94

Closed
juneng603 opened this issue Jul 31, 2012 · 11 comments
Closed

not able to read property file normally. #94

juneng603 opened this issue Jul 31, 2012 · 11 comments

Comments

@juneng603
Copy link

The class HBasePropertyReader has read().

in this method, it try to load "kundera-hbase.properties" for hbase.

but, it is not able to load it properly.

# propertyName = "kundera-hbase.properties which is located in "src/main/resources/"
ClassLoader.getSystemResourceAsStream(propertyName)

it returns always "null" value.

if I modified it to

# propertyName = "kundera-hbase.properties which is located in "src/main/resources/"
#ClassLoader.getSystemResourceAsStream(propertyName)
HBasePropertyReader.class.getResourceAsStream(propertyName)

it returns a stream object what I want to have.

@mevivs
Copy link
Collaborator

mevivs commented Jul 31, 2012

Sounds like a bug.

Can you please try it with

InputStream inStream = propertyName != null ? Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyName) : null;

@juneng603
Copy link
Author

a way you mentioned is working nicely. ;)

anyway, in the wiki, there are pages to set up configurations for hbase.

is it working?

@mevivs
Copy link
Collaborator

mevivs commented Jul 31, 2012

Okay.This will be fixed in latest trunk branch. Yes, those are definitly working. There is one HBasePropertyReaderTest added to demonstrate the same.

Plese close this issue, if it is working fine for you.

-Vivek

@juneng603
Copy link
Author

wow, yes, it is working very perfectly.

in my debug, the lastest library 2.0.7 also returns normal property name which is named as "kundera-hbase.properties".

but, it got a "null" value from ClassLoader.

Can I ask you what the differences between the test-case and my project?

I mean that why the case I have return a "null" value.

@mevivs
Copy link
Collaborator

mevivs commented Jul 31, 2012

ClassLoader.getSystemResourceAsStream is trying to load system resources but your properties file is not system resources.

Other alternative, which i have suggested is a better way to load user as well as system resources.

-Vivek

@juneng603
Copy link
Author

Is there any way to put my configuration files into a system resources area?

thanks for your speedy and kind answer

@mevivs
Copy link
Collaborator

mevivs commented Jul 31, 2012

Not sure. But this should give you a brief about this :

http://stackoverflow.com/questions/2815404/load-properties-file-in-jar

@mevivs
Copy link
Collaborator

mevivs commented Aug 2, 2012

Shall i close this now, if working fine for you?

-Vivek

@juneng603
Copy link
Author

thanks for your nice supports.

additionally,
currently, I couldn't load my property because of this problem on release 2.0.7.

Is there any workaround way to fix for my one?

@mevivs
Copy link
Collaborator

mevivs commented Aug 9, 2012

There is a branch(2.0.7.1) created for bug fixes done on 2.0.7. You need to download and build kundera-hbase from this branch to get this working.
Alternatively, if you have download 2.0.7 source code then you can manually merge commit made for 1eb7676 (not a preferable way, though)

-Vivek

@juneng603
Copy link
Author

thanks for your responses again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants