• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

loading property files across modules(WSAD)

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to WSAD
I have enterprise application project
which has modules like ejbModule,webModule,clientModule.
Say my enterprise application project directory name is MainProj.
I kept all my property files in MainProj\properties directory
I am trying load property file in ejb module
like getClass().getResourceAsStream("/properties/myprop.properties")
when execute above statement it is looking property file in
ejbModule/properties directory(that means it is looking property file from the module context not from the application context,since my application project directory is MainProj I expect to look from MainProj/properties folder)
do you have any idea how to solve the problem?
how to load property file accross the modules
(I tried resourcebundle approach too..)
Thank in Advance
vishnu
 
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use a folder that I call Config and place all my property files in there .I then include that Config folder in my server CLASSPATH.
Hope that works for you.
Cheers
jeff mutonho
 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of the AEs are you using with your WSAD? If you are in version 4, then you could potentially solve the issue by upgrading to 4.0.3.
If you let me know more about the versions, I could give a specific reply. I have struggled a bit with this as well and the answers are so specific to each situation.... therefore the request for more details.
 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jeff && Nagendra
Thanks for your reply
I am using WSAD 5(using Websphere Test Environmnet 5.0 Server inside WSAD 5.0)
Jeff said it works if i modify my server classpath
but if you are working in WSAD 5.0 you have only test environment not server itself( Websphere Application server is not installed on my machine
All the work i am doing in WSAD 5.0 using Websphere Test Enviromnet.)
then how to solve this problem?
if at all i need modify server class path inside WSAD 5.0 how to do that
Any ideas?
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello again...
i am not too sure with wsad 5.0 (i am working on wsad 4.03).. but here goes an attempt anyway..
in the test environment you must be having the test server
instance and its properties must be visible to you..
you must be having an equivalent of the 'paths' tab.In this 'Add Folder'
to your MainProj.
This should let your test env see the files.. let me know how it goes.
[ October 23, 2003: Message edited by: Nagendra Prasad ]
 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Nagendra
I opened Test server instance and I got paths tab
In the paths tab I have entry called classpath
I clicked add folder button and I added my MainProj folder to class path.
still the same problem.
Any ideas greatly appreciated.
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your application using that test server?You can create another server and use that to load you ear?
Did you create the Config folder from within the same workspace where your project is?If not , do that and then when you configure you server classpath , click on add folder and the rest is a piece of cake...
Theoretically that should work
Maybe you can turn the versbose on , on your server and copy and pstate the out to us , then we can see if it sees the folder with the properties file.

jeff mutonho
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I second jeff's suggestion... seems to way to go.. esp. when we are not having more details..
however.. try the following change to ur code as well...
getClass.getClassLoader().getResourceAsStream"/properties/myprop.properties")
instead of
getClass().getResourceAsStream("/properties/myprop.properties")
this will force the use of the same classloader... and could provide some info as to whether this is a class loader selection problem.
all the best!
 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeff && Nagendra
Thank you very much!!
I deleted my old test server and created new test server
and deployed my EAR file over it
(it should work with my old test server ,but some how it does not)
It worked
I am able to load my property files
thank you very much
but one more thing ...
when ever i am creating a new file its getting created in
"C:\ProgramFiles\IBM\WebsphereStudio"
I am using File f = new File("a.txt");
How to change path?I need file to be created in my application context
Thanks

Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic