Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在WebSphereApplicationServer中通过spring加载资源_Java_Spring_Websphere - Fatal编程技术网

Java 在WebSphereApplicationServer中通过spring加载资源

Java 在WebSphereApplicationServer中通过spring加载资源,java,spring,websphere,Java,Spring,Websphere,我有一个在WebSphereApplicationServer8(WAS)上运行的web应用程序。在web.xml中,我有: <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:by/example/**/*-ctx.xml</param-value> </context-par

我有一个在WebSphereApplicationServer8(WAS)上运行的web应用程序。在web.xml中,我有:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:by/example/**/*-ctx.xml</param-value>
</context-param>
url不正确会引发异常-但如果我添加preffix“wsjar:”,如下所示:

 applicationContext.getResource("wsjar:classpath*:by/example/**/I-*.sql").getUrl()
它工作得很好。但我需要创建一个通用系统来加载不同应用服务器和servlet容器上的资源。在tomcat中,不需要前缀


如何在WAS上加载我的应用程序中的资源,方法与通过ContextLoaderListener加载ContextLoader相同无需预修复“wsjar:”?

尝试类似的方法

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

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

当我使用完整的包名时,我对IBM WAS没有任何问题。像这样:

            classpath:com/tdp/abc/facilitador/boost/config/reglaBoostWS-support.xml         
我没有尝试使用asteriks来指向多个文件。可能列出所有个人文件对您都有用。

问题在于“Resource Resource=appContext.getResource(“classpath*:by/example/**/I-*.sql”);”在WAS上不起作用
            classpath:com/tdp/abc/facilitador/boost/config/reglaBoostWS-support.xml