File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet Deployment Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Deployment Problem" Watch "Servlet Deployment Problem" New topic
Author

Servlet Deployment Problem

R.A.Partha sarathy
Greenhorn

Joined: Sep 30, 2003
Posts: 9
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;
}
}
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
R.A.-
Please, do not post the same questions in multiple forums.
thanks


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
 
 
subject: Servlet Deployment Problem