The method that you have described (ClassLoader.getResourceAsStream) does not
seem to work.
That's my war folder structure: (generated by maven2)
xfire-sample-project.war
| - WEB-INF
| | - lib (all jar files)
| | - myconfig.xml (my-configuration file-> which i need to open from
@WebMethod))
| | - web.xml
| | - classes
| | - META-INF
| | | - xfire
| | | - services.xml
| |
| | -pl
| | - xfire
| | - service
| | - myService.class
| - META-INF
| | - MANIFEST.MF
| | - ...
|
WEB-INF/NamingServiceConfiguration.xml
I have treid many times with different paths but I cannot open the
myconfig.xml file...
This invocation is located in myService.class
- ClassLoader.getResourceAsStream("WEB-INF/myconfig.xml")
- ClassLoader.getResourceAsStream("/WEB-INF/myconfig.xml")
- ClassLoader.getResourceAsStream("myconfig.xml")
I also put the myconfig file to the folder where myService.class is located
and tried:
- ClassLoader.getResourceAsStream("myconfig.xml")
-
ClassLoader.getResourceAsStream("WEB-INF/classes/pl/xfire/service/myconfig.xml")
-
ClassLoader.getResourceAsStream("/WEB-INF/classes/pl/xfire/service/myconfig.xml")
- ClassLoader.getResourceAsStream("pl/xfire/service/myconfig.xml")
- ClassLoader.getResourceAsStream("/pl/xfire/service/myconfig.xml")
What am I doing wrong? Where is the mistake? Could someone specify how I
should open the myconfig.xml file?
Many thanks in advance.
Tom
szefo wrote:
>
> How should I define such resource. Should the definition be in the
> servlet's web.xml? I have seen that there are many syntaxes? Hos the
> definition should look like?
> Thanks!
>
>
> Tomek Sztelak wrote:
>>
>> You can obtain inputstream which contains file data with
>> ClassLoader.getResourceAsStream
>>
>> On 5/7/07, szefo <[EMAIL PROTECTED]> wrote:
>>>
>>> I have a another question. I don't need to modify this file but only
>>> read.
>>> Imagine a siutation when a service is deployed in a war file with a
>>> confioguration.xml file - where the configuration settings are stored.
>>> How
>>> can I obtain a relative path to this file?
>>> Many thanks in advance ;)
>>>
>>>
>>>
>>> Tomek Sztelak wrote:
>>> >
>>> > First hint : don't do it :). Modifying file inside deployed webapp is
>>> > tricky business, what if your webapp isn't unpacked ?
>>> > If you have file you need to modify then place is somewhere outside
>>> > app, maybe in db or so.
>>> >
>>> > On 4/25/07, Wacław Borowiec <[EMAIL PROTECTED]> wrote:
>>> >> Hello
>>> >>
>>> >> How to obtain a relative path of a service? What is an actual
>>> problem: I
>>> >> try
>>> >> to dynamicaly modify a trust store for a web service securisty, so I
>>> have
>>> >> to
>>> >> create an OutputStream with an absolute path (using JBoss, relative
>>> path
>>> >> doesn't work) when saving the trust store file. But in WSS4J
>>> properties
>>> >> file, I pass a relative path to the trust store. So how to to save a
>>> file
>>> >> inside the deployed XFire application?
>>> >>
>>> >> thank for any help
>>> >> Wacław Borowiec
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > -----
>>> > When one of our products stops working, we'll blame another vendor
>>> > within 24 hours.
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/service-local-path-tf3646760.html#a10359230
>>> Sent from the XFire - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>>
>> --
>> -----
>> When one of our products stops working, we'll blame another vendor
>> within 24 hours.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/service-local-path-tf3646760.html#a10372285
Sent from the XFire - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email