2013-05-09 66 views
1

我得到以下异常:春servlet配置文件会抛出异常

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> 

任何人都可以解释我必须做什么来解决这个问题吗?

+0

如果您发现我的答案指向正确的方向,请考虑积极向上。 – 2013-05-14 09:40:05

回答

1

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

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

1

我认为你需要有组件扫描看看api和核心的公共包。

更改<context:component-scan base-package="com.hexgen.api.facade" /><context:component-scan base-package="com.hexgen" />它应该拿起它找不到的核心类。