I have fixed this..
We should use File, filereders..Can not use  class loaders, since the file
which i try to read not in the classpath.

Thanks.


On 9 January 2014 18:15, Vijayaratha Vijayasingam <[email protected]> wrote:

> We try to load a file , which is available in the product distribution
> 'resources' folder.
>
> Eg: repository/resources/api_templates/api_templates_api.xml;
>
> Thanks..
>
>
> On 9 January 2014 18:06, Paul Fremantle <[email protected]> wrote:
>
>> What file are you loading?
>>
>> It almost never makes sense to directly load a file! It should be able to
>> come from the Registry, remote location, etc.
>>
>> Paul
>>
>>
>> On 9 January 2014 12:08, Vijayaratha Vijayasingam <[email protected]>wrote:
>>
>>> Hi all;
>>>
>>> *What we do*
>>>
>>> We try to read a file from a local file system. Our code is like;
>>>
>>>  *InputStream in =
>>> Thread.currentThread().getContextClassLoader().getResourceAsStream(FilePath);*
>>>
>>> Here 'FilePath' is an absolute path of the file
>>>
>>> *Issue*
>>>
>>> Above code works fine in linux and in windows when we run the server in
>>> normal mode.
>>> But this is NOT working, when we run the server as a windows service.We
>>> get input stream as 'null'.
>>>
>>> Anyone encountered such issue before? I could not find any information
>>> regarding this other than  java classloaders . Here we use
>>> "ContextClassLoader", which is the right classloader to be used..
>>>
>>> Any clue on this?
>>>
>>> Thanks.
>>>
>>>
>>> --
>>> -Ratha
>>> mobile: (+94)755906608
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Paul Fremantle
>> CTO and Co-Founder, WSO2
>> OASIS WS-RX TC Co-chair, Apache Member
>>
>> UK: +44 207 096 0336
>> US: +1 646 595 7614
>>
>> blog: http://pzf.fremantle.org
>> twitter.com/pzfreo
>> [email protected]
>>
>> wso2.com Lean Enterprise Middleware
>>
>> Disclaimer: This communication may contain privileged or other
>> confidential information and is intended exclusively for the addressee/s.
>> If you are not the intended recipient/s, or believe that you may have
>> received this communication in error, please reply to the sender indicating
>> that fact and delete the copy you received and in addition, you should not
>> print, copy, retransmit, disseminate, or otherwise use the information
>> contained in this communication. Internet communications cannot be
>> guaranteed to be timely, secure, error or virus-free. The sender does not
>> accept liability for any errors or omissions.
>>
>
>
>
> --
> -Ratha
> mobile: (+94)755906608
>



-- 
-Ratha
mobile: (+94)755906608
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to