This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
R.A.-
Please, do not post the same questions in multiple forums.
thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic