2013-05-09 25 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" />它應該拿起它找不到的核心類。

相關問題