You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ganu MailList <ga...@gmail.com> on 2010/10/19 03:54:45 UTC

How to write the web.xml file in WAR package

I need transmit one java project to the WAR package then put it under the
tomcat.  But I donot know how to write web.xml of this project rightly.   I
had written onem  but error.  Tomcat cannot start this servlet.  Can anyone
teach me how to modify it?

Following is web.xml file.  org.apache.axis2.axis2userguide is the package
name. HelloWorldServiceSkeleton is the class name.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<filter>
    <filter-name>DebugFilter-In</filter-name>
    <description>Print XMl request, XML response and current
timestamps</description>
    <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
    <init-param>
       <param-name>input</param-name>
       <param-value>true</param-value>
    </init-param>
</filter>
<servlet>
    <servlet-name>HelloWorldService</servlet-name>
    <display-name>This is Hello World Service.</display-name>

<servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>HelloWorldService</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
  </servlet-mapping>
</web-app>

Re: How to write the web.xml file in WAR package

Posted by ganu MailList <ga...@gmail.com>.
2010/10/19 Wesley Acheson <we...@gmail.com>

>  On Tue, Oct 19, 2010 at 3:54 AM, ganu MailList <ga...@gmail.com>
> wrote:
> > I need transmit one java project to the WAR package then put it under the
> > tomcat.  But I donot know how to write web.xml of this project rightly.
> I
> > had written onem  but error.  Tomcat cannot start this servlet.  Can
> anyone
> > teach me how to modify it?
> >
> > Following is web.xml file.  org.apache.axis2.axis2userguide is the
> package
> > name. HelloWorldServiceSkeleton is the class name.
> > <?xml version="1.0" encoding="UTF-8"?>
> > <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> > http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
> > http://java.sun.com/xml/ns/javaee
> > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
> > <filter>
> >    <filter-name>DebugFilter-In</filter-name>
> >    <description>Print XMl request, XML response and current
> > timestamps</description>
> >    <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
> >    <init-param>
> >       <param-name>input</param-name>
> >       <param-value>true</param-value>
> >    </init-param>
> > </filter>
> > <servlet>
> >    <servlet-name>HelloWorldService</servlet-name>
> >    <display-name>This is Hello World Service.</display-name>
> >
> >
> <servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
> >    <load-on-startup>1</load-on-startup>
> >  </servlet>
> >  <servlet-mapping>
> >    <servlet-name>HelloWorldService</servlet-name>
> >    <url-pattern>/HelloWorld</url-pattern>
> >  </servlet-mapping>
> > </web-app>
> >
>
> What error message are you getting if any. I'm having difficulty
> understanding what you want and what the problem is.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
 Hi  Acheson,

I can use the command "ant jar.server" to build a jar package.  But I cannot
build it as WAR package,  because my web.xml is error.   After put the WAR
on the tomcat server,  I cannot use the URL to visit this WAR package.  I
can see this WAR package in tomcat manager.  I google server times,  but
cannot find how to write one right web.xml.

Re: How to write the web.xml file in WAR package

Posted by Pid <pi...@pidster.com>.
On 20/10/2010 02:33, ganu MailList wrote:
> 2010/10/19 Pid <pid@pidster.com <ma...@pidster.com>>
> 
>     On 19/10/2010 08:51, Wesley Acheson wrote:
>     > On Tue, Oct 19, 2010 at 3:54 AM, ganu MailList
>     <ganu4maillist@gmail.com <ma...@gmail.com>> wrote:
>     >> I need transmit one java project to the WAR package then put it
>     under the
>     >> tomcat.  But I donot know how to write web.xml of this project
>     rightly.   I
>     >> had written onem  but error.  Tomcat cannot start this servlet.
>      Can anyone
>     >> teach me how to modify it?
>     >>
>     >> Following is web.xml file.  org.apache.axis2.axis2userguide is
>     the package
>     >> name. HelloWorldServiceSkeleton is the class name.
>     >> <?xml version="1.0" encoding="UTF-8"?>
>     >> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns="
>     >> http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
>     >> http://java.sun.com/xml/ns/javaee
>     >> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
>     >> <filter>
>     >>    <filter-name>DebugFilter-In</filter-name>
>     >>    <description>Print XMl request, XML response and current
>     >> timestamps</description>
>     >>  
>      <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
>     >>    <init-param>
>     >>       <param-name>input</param-name>
>     >>       <param-value>true</param-value>
>     >>    </init-param>
>     >> </filter>
>     >> <servlet>
>     >>    <servlet-name>HelloWorldService</servlet-name>
>     >>    <display-name>This is Hello World Service.</display-name>
>     >>
>     >>
>     <servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
>     >>    <load-on-startup>1</load-on-startup>
>     >>  </servlet>
>     >>  <servlet-mapping>
>     >>    <servlet-name>HelloWorldService</servlet-name>
>     >>    <url-pattern>/HelloWorld</url-pattern>
>     >>  </servlet-mapping>
>     >> </web-app>
>     >>
>     >
>     > What error message are you getting if any. I'm having difficulty
>     > understanding what you want and what the problem is.
> 
>     Telling us the exact versions of Tomcat, Java, the OS and providing some
>     idea of what the error logs contain would likely be useful too.
> 
> 
>     p
> 
>  
> Hello pid,
> My system is following:
> Windows XP sp3
> Tomcat 6.0.29
> jdk  jdk-6u21-windows-i586
> Attached file HelloWorld.war is the WAR package,  I think that the
> system is not problem, because I can visit other WAR package.  The
> problem is that the web.xml error but I donot know how to modify it.

The list strips attachment, or mangles them.

You'll actually have to provide some meaningful error data from logs or
elsewhere, to describe what the problem really is.  I can't guess.

The web.xml doesn't have a lot in it, the only thing I can see that's
missing is a filter mapping.


How are you starting Tomcat, and what do the logs in the tomcat/logs
directory have in them?



p





Re: How to write the web.xml file in WAR package

Posted by ganu MailList <ga...@gmail.com>.
2010/10/19 Pid <pi...@pidster.com>

>  On 19/10/2010 08:51, Wesley Acheson wrote:
> > On Tue, Oct 19, 2010 at 3:54 AM, ganu MailList <ga...@gmail.com>
> wrote:
> >> I need transmit one java project to the WAR package then put it under
> the
> >> tomcat.  But I donot know how to write web.xml of this project rightly.
>   I
> >> had written onem  but error.  Tomcat cannot start this servlet.  Can
> anyone
> >> teach me how to modify it?
> >>
> >> Following is web.xml file.  org.apache.axis2.axis2userguide is the
> package
> >> name. HelloWorldServiceSkeleton is the class name.
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> >> http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
> >> http://java.sun.com/xml/ns/javaee
> >> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
> >> <filter>
> >>    <filter-name>DebugFilter-In</filter-name>
> >>    <description>Print XMl request, XML response and current
> >> timestamps</description>
> >>
>  <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
> >>    <init-param>
> >>       <param-name>input</param-name>
> >>       <param-value>true</param-value>
> >>    </init-param>
> >> </filter>
> >> <servlet>
> >>    <servlet-name>HelloWorldService</servlet-name>
> >>    <display-name>This is Hello World Service.</display-name>
> >>
> >>
> <servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
> >>    <load-on-startup>1</load-on-startup>
> >>  </servlet>
> >>  <servlet-mapping>
> >>    <servlet-name>HelloWorldService</servlet-name>
> >>    <url-pattern>/HelloWorld</url-pattern>
> >>  </servlet-mapping>
> >> </web-app>
> >>
> >
> > What error message are you getting if any. I'm having difficulty
> > understanding what you want and what the problem is.
>
> Telling us the exact versions of Tomcat, Java, the OS and providing some
> idea of what the error logs contain would likely be useful too.
>
>
> p
>

Hello pid,
My system is following:
Windows XP sp3
Tomcat 6.0.29
jdk  jdk-6u21-windows-i586
Attached file HelloWorld.war is the WAR package,  I think that the system is
not problem, because I can visit other WAR package.  The problem is that the
web.xml error but I donot know how to modify it.

Re: How to write the web.xml file in WAR package

Posted by Pid <pi...@pidster.com>.
On 19/10/2010 08:51, Wesley Acheson wrote:
> On Tue, Oct 19, 2010 at 3:54 AM, ganu MailList <ga...@gmail.com> wrote:
>> I need transmit one java project to the WAR package then put it under the
>> tomcat.  But I donot know how to write web.xml of this project rightly.   I
>> had written onem  but error.  Tomcat cannot start this servlet.  Can anyone
>> teach me how to modify it?
>>
>> Following is web.xml file.  org.apache.axis2.axis2userguide is the package
>> name. HelloWorldServiceSkeleton is the class name.
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
>> http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
>> http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
>> <filter>
>>    <filter-name>DebugFilter-In</filter-name>
>>    <description>Print XMl request, XML response and current
>> timestamps</description>
>>    <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
>>    <init-param>
>>       <param-name>input</param-name>
>>       <param-value>true</param-value>
>>    </init-param>
>> </filter>
>> <servlet>
>>    <servlet-name>HelloWorldService</servlet-name>
>>    <display-name>This is Hello World Service.</display-name>
>>
>> <servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
>>    <load-on-startup>1</load-on-startup>
>>  </servlet>
>>  <servlet-mapping>
>>    <servlet-name>HelloWorldService</servlet-name>
>>    <url-pattern>/HelloWorld</url-pattern>
>>  </servlet-mapping>
>> </web-app>
>>
> 
> What error message are you getting if any. I'm having difficulty
> understanding what you want and what the problem is.

Telling us the exact versions of Tomcat, Java, the OS and providing some
idea of what the error logs contain would likely be useful too.


p

Re: How to write the web.xml file in WAR package

Posted by Wesley Acheson <we...@gmail.com>.
On Tue, Oct 19, 2010 at 3:54 AM, ganu MailList <ga...@gmail.com> wrote:
> I need transmit one java project to the WAR package then put it under the
> tomcat.  But I donot know how to write web.xml of this project rightly.   I
> had written onem  but error.  Tomcat cannot start this servlet.  Can anyone
> teach me how to modify it?
>
> Following is web.xml file.  org.apache.axis2.axis2userguide is the package
> name. HelloWorldServiceSkeleton is the class name.
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
> <filter>
>    <filter-name>DebugFilter-In</filter-name>
>    <description>Print XMl request, XML response and current
> timestamps</description>
>    <filter-class>com.vzb.varwebservices.filter.DebugFilter</filter-class>
>    <init-param>
>       <param-name>input</param-name>
>       <param-value>true</param-value>
>    </init-param>
> </filter>
> <servlet>
>    <servlet-name>HelloWorldService</servlet-name>
>    <display-name>This is Hello World Service.</display-name>
>
> <servlet-class>org.apache.axis2.axis2userguide.HelloWorldServiceSkeleton</servlet-class>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>  <servlet-mapping>
>    <servlet-name>HelloWorldService</servlet-name>
>    <url-pattern>/HelloWorld</url-pattern>
>  </servlet-mapping>
> </web-app>
>

What error message are you getting if any. I'm having difficulty
understanding what you want and what the problem is.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org