[ 
https://issues.apache.org/jira/browse/OLINGO-312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14031799#comment-14031799
 ] 

Chandan V.A commented on OLINGO-312:
------------------------------------

Hi,
The Interface JPAEdmExtension is extended with the method 
getJPAEdmMappingModelStream. Implement this method to return a Stream of 
Mapping model. This should solve your issue.

Please reopen the ticket in case this solution does not solve your use case.

Thanks
Kind Regards
Chandan

> Reading resource via Classloader
> --------------------------------
>
>                 Key: OLINGO-312
>                 URL: https://issues.apache.org/jira/browse/OLINGO-312
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 1.2.0
>            Reporter: Giacomo Pati
>            Assignee: Chandan V.A
>             Fix For: V2 1.3.0
>
>
> While many servlet-containers tested by me work fine with construct below, 
> WebSphere 8 doesn't like it and returns null for the resources path requested 
> (it's actually outside of Classloader managed filesystem area, which I would 
> consider being bad practice):
> {code}
> InputStream is = 
> JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream("../../" 
> + mappingModelName);
> {code}
> As the class in question (JPAEdmMappingModelService) doesn't have access to 
> the servlet context to properly read a file from the web space area I'd 
> suggest (also for backwards compatibility reasons) to add this to the code as 
> shown in the following patch:
> {code}
> @@ -195,6 +195,9 @@ public class JPAEdmMappingModelService implements 
> JPAEdmMappingModelAccess {
>    protected InputStream loadMappingModelInputStream() {
>      InputStream is = 
> JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream("../../" 
> + mappingModelName);
> +      if(is == null) {
> +          is = 
> JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream(mappingModelName);
> +      }
>      return is;
> {code}
> which would alternatively allow to put the mapping file into the 
> WEB-INF/classes folder.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to