我有一个jar项目,当我运行我的应用程序时:java -jar UploadEDS / 20120207 / EDSTools-jar.jar
收到错误
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)
这是我从19行到23行的主要课程
public class Processor {
public static void main(String[] args) throws InterruptedException {
ProcessorBean processorBean = new ProcessorBean();
Helper helper = new Helper();
,ProcessorBean.java用于读取文件。并使用 inputStream.readObject(); 并访问我项目的DTO(映射到Transactions表的Transaction.class)。
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;
}
我的应用程序(.jar)远程调用我的jboss上的EJB。
提前感谢
答案 0 :(得分:1)
确保包含com.nsia.dto.Transactions库。