Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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 SpringServlet配置文件引发异常_Java_Spring Mvc - Fatal编程技术网

Java SpringServlet配置文件引发异常

Java SpringServlet配置文件引发异常,java,spring-mvc,Java,Spring Mvc,我得到以下例外情况: Build path is incomplete. Cannot find class file for com/hexgen/core/IHexGenDictionaryBased 这是我得到上述异常的行: <context:component-scan base-package="com.hexgen.api.facade" /> 这是完整的XML文件: <?xml version="1.0" encoding="UTF-8"?> <

我得到以下例外情况:

Build path is incomplete. Cannot find class file for com/hexgen/core/IHexGenDictionaryBased
这是我得到上述异常的行:

<context:component-scan base-package="com.hexgen.api.facade" />

这是完整的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:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:sec="http://www.springframework.org/schema/security"
    xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

    <sec:global-method-security pre-post-annotations="enabled"
                                secured-annotations="enabled"
                                authentication-manager-ref="authenticationManager"
                                proxy-target-class="true">
        <sec:expression-handler ref="expressionHandler"/>
    </sec:global-method-security>

    <bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
        <property name="permissionEvaluator" ref="hexgenPermissionEvaluator" />
    </bean>

    <bean id="hexgenPermissionEvaluator" class="com.hexgen.api.facade.security.HexGenPermissionEvaluator"/>

    <context:component-scan base-package="com.hexgen.api.facade" />
    <mvc:annotation-driven />
    <context:annotation-config />
</beans>


有人能解释一下我要做什么来解决这个问题吗?

我认为您需要让组件扫描查看api和核心的通用包


更改为
,它应该选择找不到的核心类。

您需要确保无论在哪里
com/hexgen/core/ihexgendictionarybase
类(或其.class文件)都需要位于构建路径(或类路径)上。例如,如果它位于其他hexgen-core.jar中,那么请确保将它添加到构建路径(使用Eclipse)或类路径(使用
-cp
参数)


如果某个其他项目目录中的文件添加了其<代码> /SRC <代码>作为Spring项目的源目录,那么所有核心类将自动在您的类路径上。

如果您找到我的答案指向正确的方向,请考虑赞成。