2
votes

I'm a new learner of apache cxf. in the first program i implement, i encoutered the following exception( this is what my console display):
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/velocity/context/Context The java code source i run is
package com.ttdev;

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

public class 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!");
}

} so how can i resolve this problem.

2

2 Answers

2
votes

You need Apache Velocity on your classpath.

0
votes

Check your Pom->DependencyHierarchy -> Filter "velocity" In which package it is found , Probably it was not loaded properly.

In mycase it was C:\Users\MyUser.m2\repository\org\apache\velocity

Delete that and run "mvn clean package -DskipTests" from console, it will download all necessary packages.