gpt4 book ai didi

java - Spring servlet配置文件抛出异常

转载 作者:行者123 更新时间:2023-11-30 04:23:19 26 4
gpt4 key购买 nike

我得到以下异常:

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>

谁能解释一下我必须做什么才能解决这个问题?

最佳答案

您需要确保 com/hexgen/core/IHexGenDictionaryBased 类(或其 .class 文件)的位置需要位于您的构建路径(或类路径)上。例如,如果它位于其他 hexgen-core.jar 中,请确保将其添加到您的构建路径(使用 Eclipse)或类路径(使用 -cp 参数)。

如果文件位于其他项目目录中,则将其 /src 添加为 Spring 项目的源目录,然后所有 core 类将自动位于您的类路径中.

关于java - Spring servlet配置文件抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16460635/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com