954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please execute this program

I am attaching a war file that prints hello using servlet

This is code for web.xm

<?xml version="1.0" ?>
- - helloservlet1- hello/hello

but its throiwng some exception

Attachments hello.zip (1.29KB)
staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

WHAT exception?
And where?

And no, we're not going to download and execute some code you attach here or anywhere else.
Such tricks are far too often used by people trying to spread virusses.
Plus it's not our task to figure out what problems you're having, that's your job.
When you do figure it out, tell us in detail and we might be able to help you find an answer.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

Hi Jweting

Thanks for your wonderful reply , i do agree that ppl may spread virus like this.

The code i have written is absolutely correct , i think web.xml you have already seen.

I have got some clue why this problem is occurring , let me narrow down that .If what i am thinking comes true then i will report a bug in Apache itself.

Thanks

And plpease please dont be so rude

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

You should atleast have pasted the 'stack trace' for us to help you out. The code as such looks OK. Paste the stack trace and the way you are trying to execute the WAR file.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

if your code were "absolutely correct" you'd not be getting any errors.
Therefore one can only conclude that that code is NOT in fact correct.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

hi.............I pasted War file in Web-apps and called it from browser

this is error stack

Yes i added web.Xml File with follwoing code

<?xml version="1.0" encoding="UTF-8"?>
helloservlet1hello/hello

and it is throwing

Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid null in servlet mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:302)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:644)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:254)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:850)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:316)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:859)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:653)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1067)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:371)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:827)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1659)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1668)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1648)
at java.lang.Thread.run(Unknown Source)
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig applicationConfig
SEVERE: Occurred at line 10 column 19
Aug 8, 2007 12:31:07 PM org.apache.catalina.startup.ContextConfig start

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

You still haven't told us your Tomcat version..

But still, try out this xml file format:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
<web-app>
    <display-name>Hello, World Application</display-name>
    <description>
    This is a simple web application with a source code organization
    based on the recommendations of the Application Developer's Guide.
    </description>

    <servlet>
        <servlet-name>hello</servlet-name>
        <servlet-class>servlet1</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>hello</servlet-name>
        <url-pattern>/goHello</url-pattern>
    </servlet-mapping>

</web-app>


And run it using: http://localhost:8080/your_root_dir_name/goHello

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

Tomcat 5.5.4

staneja
Junior Poster in Training
64 posts since Dec 2006
Reputation Points: 10
Solved Threads: 2
 

Have you tried simply removing the "-" characters from those three lines? Some XML Parsers (possibly Tomcat's included) are a little picky.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 
Have you tried simply removing the "-" characters from those three lines? Some XML Parsers (possibly Tomcat's included) are a little picky.


Methinks he directly copy pasted from the XML opened in IE and hence those dashes.

Staneja, did the XML file provided by me not work? I have seen a lot of bug reports lying around here and there regarding the same problem. The same XML file works fine for me.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You