如何解决“java.lang.NoClassDefFoundError:org / apache / velocity / context / Context”

问题描述 投票:2回答:2

我是apache cxf的新学习者。在我实现的第一个程序中,我遇到了以下异常(这是我的控制台显示的内容): 线程“main”中的异常java.lang.NoClassDefFoundError:org / apache / velocity / context / Context我运行的java代码源是 包com.ttdev;

import org.apache.cxf.tools.wsdlto.WSDLToJava;

公共类CodeGenerator {

/**
 * @param args
 */
public static void main(String[] args) {
    System.out.println("debug");
    WSDLToJava.main(new String[] {
            "-server",
            "-d", "src/main/java",
            "src/main/resources/Service.wsdl" });
            System.out.println("Done!");
}

那么我怎么能解决这个问题。

web-services exception cxf
2个回答
2
投票

您需要在类路径上使用Apache Velocity。


0
投票

检查你的Pom-> DependencyHierarchy - >过滤器“velocity”在找到它的包中,可能它没有正确加载。

在我的情况下,它是C:\ Users \ MyUser.m2 \ repository \ org \ apache \ velocity

删除它并从控制台运行“mvn clean package -DskipTests”,它将下载所有必需的包。

© www.soinside.com 2019 - 2024. All rights reserved.