public class PlugIn_AppDown implements PlugInInterface {
private int otaversion;
private int pid;
private int menuid;
private int availspace;
private String msisdn;
private String req;
private String aid;
private int batch;
private int brand;
private int functionid;
private String imsi;
private boolean isCounterA;
private boolean isBip;
private String counter;
private String cityId;
private String cardVendorId;
@Override
public Object doing() throws Exception {
String sdfdsdf=null;
return null;
}
@Override
public String getExtendsPoint() {
// TODO Auto-generated method stub
return "1";
}
@Override
public String getOprKey() {
// TODO Auto-generated method stub
return "应用下载";
}
@Override
public String getPlugInName() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setParam(Object o) {
// TODO Auto-generated method stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
我定义个一个类,并implements了一个接口
我把这个类封装成了.jar包
在程序里面把这个类loadClass ()为一个类,提示找不到这个类的接口。
然后我把这个接口也打到.jar包中,但我newInstance() 后,这个类实例 instanceof 那个接口居然返回为false。
在没有在.jar包中加载接口时候抛如下错误:
java.lang.NoClassDefFoundError: com/PlugInInterface
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
java.net.URLClassLoader.access$000(URLClassLoader.java:56)
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:251)
com.chinarainbow.otas.kernal.queue.OTAHandlers.PlugIn_TaskHandler.getNewClass(PlugIn_TaskHandler.java:266)
com.chinarainbow.otas.kernal.queue.OTAHandlers.PlugIn_TaskHandler.<init>(PlugIn_TaskHandler.java:151)
com.chinarainbow.otas.kernal.queue.OTAHandlers.PlugIn_TaskHandler.getInstance(PlugIn_TaskHandler.java:166)
com.chinarainbow.otas.kernal.queue.Servlet.ReceiveSMSAgentDataServlet.doGet(ReceiveSMSAgentDataServlet.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.chinarainbow.otas.init.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
------解决方案--------------------------------------------------------
顶一下,请高手赐教!
------解决方案--------------------------------------------------------
补充一下:接口已经打包放到了apache-tomcat-6.0.14\lib下了,PlugInInterface.jar