线程“main”中的异常java.lang.NoClassDefFoundError:org / pdfbox / util / PDFTextStripper

时间:2014-03-20 16:42:08

标签: java eclipse pdf pdf-generation pdfbox

我正在尝试解决此问题。

解决问题的步骤:

1):我已经下载了frontbox-1.2.1.jar和pdfbox-1.2.1.jar并转到了eclipse-> build path->库并添加了jar文件。

这是错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/pdfbox/util/PDFTextStripper
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at gate.creole.CreoleAnnotationHandler.processParameters(CreoleAnnotationHandler.java:365)
    at gate.creole.CreoleAnnotationHandler.processAnnotationsForResource(CreoleAnnotationHandler.java:225)
    at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotationHandler.java:169)
    at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotationHandler.java:173)
    at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotationHandler.java:173)
    at gate.creole.CreoleAnnotationHandler.processAnnotations(CreoleAnnotationHandler.java:157)
    at gate.creole.CreoleRegisterImpl.parseDirectory(CreoleRegisterImpl.java:318)
    at gate.creole.CreoleRegisterImpl.registerBuiltins(CreoleRegisterImpl.java:358)
    at gate.Gate.initCreoleRegister(Gate.java:477)
    at gate.Gate.init(Gate.java:221)
    at YelpServlet.YelpGate.<init>(YelpGate.java:47)
    at YelpServlet.YelpGate.getInstance(YelpGate.java:75)
    at YelpServlet.YelpGate.main(YelpGate.java:328)
Caused by: java.lang.ClassNotFoundException: org.pdfbox.util.PDFTextStripper
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 16 more

Java代码

public class YelpGate {

    // remember create log4j.properties file under project dir!!!
    String homeDir = "C:/Program Files/GATE_Developer_7.1/";
    String ruleDir = "C:/Users/Rupesh/workspace/YelpMongo/Yelp/yelp.xgapp";

    // used for corpus control
    private static gate.CorpusController ctrl;

    // singleton
    private static YelpGate instance = null;

    /*
     * constructor of YelpGate, load Gate Plugins when initializaion
     */
    private YelpGate()
    {
        System.out.println("start initialization...");
        try {
            if (Gate.getGateHome() == null)
            {
                Gate.setGateHome(new File(homeDir));
            }

            Gate.init();
            Gate.getCreoleRegister().registerDirectories(
                    new File(homeDir + "plugins", "ANNIE").toURI().toURL());

            //For Only if you are using this plugin
            Gate.getCreoleRegister().registerDirectories(
                    new File(homeDir + "plugins", "Tools").toURI().toURL());

            ctrl = ((gate.CorpusController)
                    loadObjectFromFile(new java.io.File(ruleDir)));

        } catch (Exception e){
            System.out.println(e.getMessage());
        }
    } // end of: private YelpGate()

    /*
     * get the instance of YelpGate, create one when it was first called
     */ 
    public static YelpGate getInstance()
    {
        if (instance == null)
        {
            synchronized (YelpGate.class) 
            {
                if (instance == null) 
                {
                    instance = new YelpGate();
                }
            }
        }
        return instance;
    } // end of: public static YelpGate getInstance()

请帮我识别并解决问题。

0 个答案:

没有答案