Loading resources using spring to a WebSphere application server

I have a web application running on websphere 8 application server (WAS). In web.xml, I have:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:by/example/**/*-ctx.xml</param-value>
</context-param>

Then, when I deploy my application to WAS, it downloads all my ctx files to URLs with the prefix "wsjar: file ...", which is good.

But when in my working application I try to use the object of my application context to load resources such as this:

applicationContext.getResource("classpath*:by/example/**/I-*.sql").getUrl()

It throws an exception, an invalid URL, but if I add preffix "wsjar:" like this:

 applicationContext.getResource("wsjar:classpath*:by/example/**/I-*.sql").getUrl()

It works well. But I need to create a universal system for loading resources to different application servers and servlet containers. The tomcat prefix is ​​not required.

WAS , ContextLoader ContextLoaderListener ctx "wsjar:"?

+5
2

, IBM WAS. :

            classpath:com/tdp/abc/facilitador/boost/config/reglaBoostWS-support.xml         

asteriks . , .

+1

- .

        ApplicationContext appContext = 
       new ClassPathXmlApplicationContext(new String[] {"If-you-have-any.xml"});

    Resource resource = 
       appContext.getResource("classpath*:by/example/**/I-*.sql");
-1

All Articles