简体   繁体   中英

why my application (.jar) getting error java.lang.NoClassDefFoundError

i have a jar project and when i run my application : java -jar UploadEDS/20120207/EDSTools-jar.jar

it's getting error

Exception in thread "main" java.lang.NoClassDefFoundError: com/nsia/dto/Transactions
    at doku.edstools.main.Processor.main(Processor.java:22)
Caused by: java.lang.ClassNotFoundException: com.nsia.dto.Transactions
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

and this is my main class program from line 19 to 23

public class Processor {

    public static void main(String[] args) throws InterruptedException {
        ProcessorBean processorBean = new ProcessorBean();
        Helper helper = new Helper();

and the ProcessorBean.java is for read file. and using inputStream.readObject(); and access the DTO (Transaction.class that mapping to Transactions table) of my project.

private Transactions readTransactions(String filename) {

    ObjectInputStream inputStream = null;
    Transactions trans = null;
    try {
        //Construct the ObjectInputStream object
        inputStream = new ObjectInputStream(new FileInputStream(filename));
        trans = (Transactions) inputStream.readObject();
    } catch (Throwable ex) {
        ex.printStackTrace();
    } finally {
        //Close the ObjectInputStream
        try {
            if (inputStream != null) {
                inputStream.close();
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    return trans;
} 

my application (.jar) remote the EJB on my jboss.

thanks in advance before

确保包含库com.nsia.dto.Transactions。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM