• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Servlet Deployment Problem.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
i have servlet which read a small xml file and prints its values.but while deploying this on weblogic 8.1 it gives me the following exception.pls help me.
Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 1 Module: sarathy Error: [HTTP:101179][HTTP] Error occurred while parsing descriptor in Web application "C:\Documents and Settings\210455\Desktop\Sarathy\sarathy.war" [Path="C:\Documents and Settings\210455\Desktop\Sarathy", URI="sarathy.war" org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
[Deployer:149033]preparing application sarathy on myserver
[Deployer:149033]failed application sarathy on myserver
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application sarathy on myserver.: Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 1 Module: sarathy Error: [HTTP:101179][HTTP] Error occurred while parsing descriptor in Web application "C:\Documents and Settings\210455\Desktop\Sarathy\sarathy.war" [Path="C:\Documents and Settings\210455\Desktop\Sarathy", URI="sarathy.war" org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) .
XML File :
<?xml version="1.0" standalone="yes" ?>
<ADDRESSBOOK>
<PERSON>
<LASTNAME>Idris</LASTNAME>
<FIRSTNAME>Nazmul</FIRSTNAME>
<COMPANY>The BEan Factory, LLC.</COMPANY>
<EMAIL>xml@beanfactory.com</EMAIL>
</PERSON>
<PERSON>
<LASTNAME>Miyamato</LASTNAME>
<FIRSTNAME>Musahi</FIRSTNAME>
<COMPANY>Bushido, Inc.</COMPANY>
<EMAIL>katana@bushido.com</EMAIL>
</PERSON>
</ADDRESSBOOK>
Java Program :
import java.io.*;
import org.w3c.dom.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xerces.parsers.DOMParser;
public class ParseXMlUsingDom extends HttpServlet
{
public static final String ELEMENT_TAG="PERSON";
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
res.setContentType("text/html");
try
{
DOMParser ps = new DOMParser();
ps.parse("SAMPLE.XML");
Document doc = ps.getDocument();
NodeList rows =doc.getDocumentElement().
getElementsByTagName (ELEMENT_TAG);
int size=rows.getLength();
for(int i=0;i<size;i++)
{
Element row = (Element)rows.item(i);
out.println(getValue(row,"LASTNAME"));
out.println(getValue(row,"FIRSTNAME"));
out.println(getValue(row,"EMAIL"));
out.println(getValue(row,"COMPANY"));
out.println("\n");
}
}
catch(Exception e)
{
System.out.println("error:"+ e);
}
}
private String getValue(Element e,String tagName)
{
try
{
NodeList elements=e.getElementsByTagName(tagName);
Node node=elements.item(0);
NodeList nodes=node.getChildNodes();
return((Node)nodes.item(0)).getNodeValue();
}
catch(Exception e1)
{
System.out.println(e1);
}
return null;
}
}
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to check the validity of the Deployment Descriptor for the web application using weblogic builder before deploying the web application into the weblogic server.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems a bug of weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271)
try this:
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Reader reader = new FileReader("SAMPLE.XML");
InputSource source = new InputSource(reader);
Document doc = db.parse(source);

I encounter this problem:
org.xml.sax.SAXParseException: Invalid encoding name "GBK"
and the above solves the problem.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by R.A.Partha sarathy:
hi all

i have servlet which read a small xml file and prints its values.but while deploying this on weblogic 8.1 it gives me the following exception.pls help me.

Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 1 Module: sarathy Error: [HTTP:101179][HTTP] Error occurred while parsing descriptor in Web application "C:\Documents and Settings\210455\Desktop\Sarathy\sarathy.war" [Path="C:\Documents and Settings\210455\Desktop\Sarathy", URI="sarathy.war" org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

[Deployer:149033]preparing application sarathy on myserver
[Deployer:149033]failed application sarathy on myserver
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application sarathy on myserver.: Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 1 Module: sarathy Error: [HTTP:101179][HTTP] Error occurred while parsing descriptor in Web application "C:\Documents and Settings\210455\Desktop\Sarathy\sarathy.war" [Path="C:\Documents and Settings\210455\Desktop\Sarathy", URI="sarathy.war" org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271) at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201) at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:678) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) --------------- nested within: ------------------ Received SAXParseException from Sun Parser at line 1, column 1: org.xml.sax.SAXParseException: Content is not allowed in prolog. at weblogic.servlet.internal.dd.DescriptorLoader.parse(DescriptorLoader.java:683) at weblogic.servlet.internal.dd.DescriptorLoader.initializeWebXml(DescriptorLoader.java:694) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:269) at weblogic.servlet.internal.dd.DescriptorLoader.<init>(DescriptorLoader.java:220) at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:524) at weblogic.j2ee.J2EEApplicationContainer.loadDescriptors(J2EEApplicationContainer.java:1359) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1184) at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031) at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2634) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2584) at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2506) at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:833) at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:542) at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500) at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) .

XML File :
<?xml version="1.0" standalone="yes" ?>
<ADDRESSBOOK>
<PERSON>
<LASTNAME>Idris</LASTNAME>
<FIRSTNAME>Nazmul</FIRSTNAME>
<COMPANY>The BEan Factory, LLC.</COMPANY>
<EMAIL>xml@beanfactory.com</EMAIL>
</PERSON>
<PERSON>
<LASTNAME>Miyamato</LASTNAME>
<FIRSTNAME>Musahi</FIRSTNAME>
<COMPANY>Bushido, Inc.</COMPANY>
<EMAIL>katana@bushido.com</EMAIL>
</PERSON>
</ADDRESSBOOK>

Java Program :
import java.io.*;
import org.w3c.dom.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.xerces.parsers.DOMParser;

public class ParseXMlUsingDom extends HttpServlet
{
public static final String ELEMENT_TAG="PERSON";

public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
res.setContentType("text/html");

try
{
DOMParser ps = new DOMParser();
ps.parse("SAMPLE.XML");
Document doc = ps.getDocument();
NodeList rows =doc.getDocumentElement().
getElementsByTagName (ELEMENT_TAG);
int size=rows.getLength();
for(int i=0;i<size;i++)
{
Element row = (Element)rows.item(i);
out.println(getValue(row,"LASTNAME"));
out.println(getValue(row,"FIRSTNAME"));
out.println(getValue(row,"EMAIL"));
out.println(getValue(row,"COMPANY"));
out.println("\n");
}
}
catch(Exception e)
{
System.out.println("error:"+ e);
}
}
private String getValue(Element e,String tagName)
{
try
{
NodeList elements=e.getElementsByTagName(tagName);
Node node=elements.item(0);
NodeList nodes=node.getChildNodes();
return((Node)nodes.item(0)).getNodeValue();
}
catch(Exception e1)
{
System.out.println(e1);
}
return null;
}
}

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic