我在一个ajax项目中引用了xml,在写到
Document xmlDoc = (Document)new XPPReader().read(new ByteArrayInputStream(xml.getBytes()));
的时候,出现
- Multiple annotations found at this line:
- - The type org.gjt.xpp.XmlPullParserException cannot be resolved. It is indirectly referenced from
- required .class files
- - The method read(InputStream) from the type XPPReader refers to the missing type XmlPullParserException
- - The type org.gjt.xpp.XmlPullParserException cannot be resolved. It is indirectly referenced from
- required .class files
- - The method read(InputStream) from the type XPPReader refers to the missing type XmlPullParserException
<%@page import="org.gjt.xpp.*"%>
然后这错误也就不见了
jsp写完了,开开心心启动程序,一运行,结果又开始出现错误,还是一样的错误,想必刚刚是指标不治本。
查看异常说明,看到这样一句
Unable to compile class for JSP
怎么会不能编译呢,于是又百度,这次是说把工程下的servlet-api.jar和jsp.api.jar删除掉
我找了一下,我的工程只有servlet-api.jar,没有jsp.api.jar,我把servlet-api.jar删掉了,但是一删掉,工程中引用了这个包的类全都报错
显然这个方法行不通,于是我又把这个包添加回来。
上次写到一半,现在忘记具体细节了,只记得是要把servlet-api.jar放到工程的lib下,不能放在工程外面。应该是程序运行的时候,在lib下查找对应的类吧。