aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes externalize message from ejb to a xml or text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "externalize message from ejb to a xml or text file " Watch "externalize message from ejb to a xml or text file " New topic
Author

externalize message from ejb to a xml or text file

yc lim
Greenhorn

Joined: Jul 26, 2004
Posts: 14
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

Joined: Sep 07, 2004
Posts: 11
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

Joined: Jul 26, 2004
Posts: 14
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

Joined: Jul 26, 2004
Posts: 14
erm i found the solution for this.. should use the Ear Classloader instead of the System ClassLoader instead..

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: externalize message from ejb to a xml or text file