Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

externalize message from ejb to a xml or text file

 
yc lim
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am trying to call a webservice in a ejb and found that i need to declare the url of that webservice inside my ejb classes. does anyone here know how can i externalize my url values to a xml or text file instead so i don't have to compile everytime the url change . thanks in advance
 
Adrian Marti
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link http://weblogs.java.net/pub/wlg/547 that talks about this stuff kind of.

I would use a properties file loaded through the classloader like this





All you have to do is put the properties file in a directory that is on the classpath of the appserver.

Another way would maybe have the url in a database if it is being accessed by many diff servers or something.

HTH


Adrian
 
yc lim
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the info!

i tried it .. but have some problem with that

i create a Configuration.properties file and tried put it into the APP-INF/classes folder and APP-INF/lib
But i still hit a NullPointerException when i

Properties userProps = new Properties();
java.net.URL url = ClassLoader.getSystemResource("Configuration.properties");
userProps.load(url.openStream());

how should i write my Configuration.properties ? is it the same as the struts, ApplicationResource.properties? Am using weblogic 8.1 btw.
did i miss any steps ? sorry, im a noob in programming

[ September 17, 2004: Message edited by: yc lim ]
[ September 17, 2004: Message edited by: yc lim ]
 
yc lim
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
erm i found the solution for this.. should use the Ear Classloader instead of the System ClassLoader instead..

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic