*
The moose likes XML and Related Technologies and the fly likes Getting ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Getting ClassCastException" Watch "Getting ClassCastException" New topic
Author

Getting ClassCastException

Devarakonda Srikanth
Greenhorn

Joined: Aug 27, 2007
Posts: 25
I am trying to replace a tag in existing jrxml file and i am successful in doing so by parsing the file through DOM. But when I am trying to write the same modified document which is in DOM object, I am getting the following exception:

java.lang.ClassCastException: org.apache.xerces.dom.DeferredElementImpl cannot be cast to com.sun.xml.tree.ElementNode
at com.Replace_Tag.replaceNode(Replace_Tag.java:100)
at com.Replace_Tag.processRequest(Replace_Tag.java:40)
at com.Replace_Tag.doGet(Replace_Tag.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

Here I am providing the code I am using:




can anybody help me in this regard??
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Getting ClassCastException
 
Similar Threads
Exception while replacing an XML tag in an XML file
FileNotFoundException
Exception while replacing the child Node
Exception while replacing an XML tag in an XML file
Problem Upload files on google docs through Liferay portal 6.0.6