有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何解决警告消息:“未找到配置”

我想进行测试以获取Analyzer和Directory的值,但控制台显示以下警告消息:

WARN - No configuration found. Configuring ehcache from ehcache-failsafe.xml  found in the classpath: jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/shop1/WebRoot/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xml
Analyzer:null
configurationnull

我的Spring配置:

<bean id="configuration" class="cn.cultivator.shop1.lucene.Configuration" init-method="init">
        <property name="dirPath" value="C:/apache-tomcat-6.0.43/webapps/shop1/indexDir"></property>
</bean>

配置类:

public class Configuration {

private Analyzer analyzer= null ;

private Directory directory =null;

public Analyzer getAnalyzer() {
    return analyzer;
}

public Directory getDirectory() {
    return directory;
}

private String dirPath = null;

public void setDirPath(String dirPath) {
    this.dirPath = dirPath;
}

public void init(){
    try {
        analyzer = new IKAnalyzer(true);
        directory = FSDirectory.open(new File(dirPath));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
}

测试代码是:

    @Test
public void testConfiguratin() {
    System.out.println("Analyzer:"+configuration.getAnalyzer());
    System.out.println("configuration"+configuration.getDirectory());
}

为什么该值为空,如何解析警告消息


共 (0) 个答案