XML怪问题
头有点晕。
单独可以产生。
package com.apach.framework.util;
import java.io.*;
import org.jdom.output.*;
import org.jdom.*;
public class MyXMLBase {
public void insert(){
try {
Document d = new Document(new Element("root"));
Element root = d.getRootElement();
Element content = new Element("Content");
root.addContent(content);
XMLOutputter outputter = new XMLOutputter();
FileOutputStream file = new FileOutputStream("c:\\lyllldvqq.xml");
outputter.output(d, file);
//file.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new MyXMLBase().insert();//create OK.
}
}
在JSP页面直接创建也OK。
<%@page import="com.apach.framework.util.*,org.jdom.output.*,java.io.*,org.jdom.*" %>
<html>
<head>
</head>
<body>
<%
try {//创建也OK
Document d = new Document(new Element("root"));
Element root = d.getRootElement();
Element content = new Element("Content");
root.addContent(content);
XMLOutputter outputter = new XMLOutputter();
FileOutputStream file = new FileOutputStream("c:\\lydvqq.xml");
outputter.output(d, file);
//file.close();
} catch (Exception e) {
e.printStackTrace();
}
//MyXMLBase xx = new MyXMLBase(); //但是这句就会有错误。
%>
</body>
</html>
//MyXMLBase xx = new MyXMLBase(); //但是这句就会有错误。如下:
[4/13/06 14:56:29:907 CST] 59c8fd61 WebGroup I SRVE0180I: [myweb] [/myweb] [Servlet.LOG]: /ttt.jsp: init
[4/13/06 14:56:29:969 CST] 59c8fd61 WebGroup E SRVE0026E: [Servlet Error]-[(class: com/apach/framework/util/MyXMLBases, method: insert signature: ()V) Incompatible argument to method]: java.lang.VerifyError: (class: com/apach/framework/util/MyXMLBases, method: insert signature: ()V) Incompatible argument to method
at org.apache.jsp._ttt._jspService(_ttt.java:87)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:683)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:781)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1019)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)