Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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 我在重新启动tomcat时出现了这个错误;“上下文初始化失败”;_Java_Spring - Fatal编程技术网

Java 我在重新启动tomcat时出现了这个错误;“上下文初始化失败”;

Java 我在重新启动tomcat时出现了这个错误;“上下文初始化失败”;,java,spring,Java,Spring,当我重新启动tomcat“上下文初始化失败”时,我遇到了这个错误 这里是appContext-services.xml,它存在于/schema/ab-products/common/resources/appContext-services.xml中 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http:/

当我重新启动tomcat“上下文初始化失败”时,我遇到了这个错误

这里是appContext-services.xml,它存在于/schema/ab-products/common/resources/appContext-services.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

<!-- ========================= Start of SERVICE DEFINITIONS ========================= -->

<!--
    Per-activity configuration bean.
-->
<bean id="AbCommonResources-configuration"
    class="com.archibus.service.cost.Configuration">
    <property name="defaultDateStart" value="1980-01-01" />
    <property name="defaultDateEnd" value="2099-12-31" />
</bean>

<!-- 
    Remote version of CostService. This service is not used when the client calls WFRs. 
    TODO: fix proxyInterfaces="com.archibus.utility.Immutable": define and use ICostService interface.
-->
<bean id="CostService-remote"
    class="org.springframework.aop.framework.ProxyFactoryBean"
    p:proxyInterfaces="com.archibus.utility.Immutable"
    p:target-ref="CostService">
    <property name="interceptorNames">
        <list>
            <value>securityInterceptor</value>
            <value>exceptionHandlingInterceptor</value>
        </list>
    </property>
</bean>

<!-- 
    Local version of CostService, used by WFRs. 
-->
<bean id="CostService"
    class="com.archibus.service.cost.CostService"
    scope="prototype"
    p:configuration-ref="AbCommonResources-configuration">
</bean>

<!--
    Cost beans.
-->
<bean id="actualCost"
    class="com.archibus.app.common.finance.domain.ActualCost"
    scope="prototype">
</bean>
<bean id="scheduledCost"
    class="com.archibus.app.common.finance.domain.ScheduledCost"
    scope="prototype">
</bean>
<bean id="recurringCost"
    class="com.archibus.app.common.finance.domain.RecurringCost"
    p:configuration-ref="AbCommonResources-configuration"
    scope="prototype">
</bean>

安全拦截器
例外处理拦截器

下面是applications.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<import resource="..\..\..\..\schema\ab-products\common\resources\appContext-services.xml" />


天哪,这是你的问题:

 java.io.FileNotFoundException: Could not open ServletContext resource [/schema/ab-products/common/resources/appContext-services.xml] 
Spring在类路径中找不到该应用程序上下文XML


检查位置以及在web.xml中声明的方式。一个或两个错误。

问题可能是您的xml文件位置不正确


FileNotFoundException表示无法在该路径中找到文件。

堆栈错误非常明显。 加载上下文时,上下文初始化失败
/WEB-INF/config/context/applications/applications.xml

如果导入以下文件,
/schema/ab products/common/resources/appContext services.xml

将文件移动到
/WEB-INF/config/context/applications/
并更新
applications.xml中的导入语句。问题似乎是:

nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/schema/ab-products/common/resources/appContext-services.xml] at 

appContext services.xml是否存在于指定位置且可读(即具有正确的权限)?

感谢您的回复,我解决了此问题。它即将成为java版本。我将java版本1.4改为1.6,所以现在没有问题了。

能否显示appContext services.xml。我想这可能是“似乎”的问题所在?Tomcat不同意你的观点。我只需要让servlet上下文加载程序侦听器加载那些应用程序上下文XML。
nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/schema/ab-products/common/resources/appContext-services.xml] at