Fitnesse java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException

Posted

技术标签:

【中文标题】Fitnesse java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException【英文标题】: 【发布时间】:2015-05-18 16:10:35 【问题描述】:

我正在尝试在具有大量导入的多包项目中测试 java 方法。它工作正常,直到它到达 javax 导入。 Tnen 它抱怨它找不到此导入的类定义。当我编译该项目正在使用的 jar 时,即使它是 maven 依赖项的一部分,是否也需要显式导入 jar?

这是我的代码包的声明部分

package com.fietrade.swtf.swreconcilation.beans;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.xml.sax.SAXException;

import com.fietrade.swtf.persistance.factories.DBMgrFactory;
import com.fietrade.swtf.persistance.factories.ReconciliationDBMgr;
import com.fietrade.swtf.persistance.swapswire.Reconciliation;


public class ReconciliationEditor 

这是错误:

__EXCEPTION__:java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException
    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_40]
    at java.lang.Class.forName(Class.java:190) [rt.jar:1.7.0_40]
    at fitnesse.slim.SlimExecutionContext.getClass(SlimExecutionContext.java:139) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimExecutionContext.searchPathsForClass(SlimExecutionContext.java:129) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimExecutionContext.createInstanceOfConstructor(SlimExecutionContext.java:100) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimExecutionContext.create(SlimExecutionContext.java:42) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.StatementExecutor.create(StatementExecutor.java:75) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.instructions.MakeInstruction.executeInternal(MakeInstruction.java:26) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:50) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:44) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.ListExecutor.execute(ListExecutor.java:84) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:106) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimServer.processTheInstructions(SlimServer.java:93) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:68) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:54) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimServer.serve(SlimServer.java:40) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimService.handle(SlimService.java:164) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimService.acceptOne(SlimService.java:172) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimService.accept(SlimService.java:134) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimService.startWithFactory(SlimService.java:65) [fitnesse-standalone-20140903.jar]
    at fitnesse.slim.SlimService.main(SlimService.java:51) [fitnesse-standalone-20140903.jar]
Caused by: java.lang.ClassNotFoundException: javax.faces.validator.ValidatorException

谁能解释这个错误是什么以及如何解决它? 谢谢

【问题讨论】:

【参考方案1】:

基本上它说它无法找到您的项目工作的依赖项..

包括jsf-api

<dependency>
    <groupId>javax.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.1</version>
</dependency>

将此添加到您的项目中,错误将得到解决。

【讨论】:

以上是关于Fitnesse java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException的主要内容,如果未能解决你的问题,请参考以下文章

fitnesse框架介绍

fitnesse安装部署

Fitnesse Maven 类路径错误

Fitnesse Slim的使用

使用 SLIM 使用 Python 编写 Fitnesse 测试

如何将 Fitnesse 页面添加到版本控制?