cvc-elt.1: Cannot find the declaration of element 'web-app' - java

When I created new dynamic web project in Eclipse, automatically created web.xml showed the following error:
cvc-elt.1: Cannot find the declaration of element 'web-app'
and a red background on this line:
<web-app id="WebApp_ID" version="2.4" 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">
I want to know why this error occur and how to get rid of this error.
I used Eclipse version 3.1, Apache Tomcat 5.0 and JDK 1.4 in my project. I'm pretty new to Eclipse.

You need to add the DOCTYPE element to the start of the XML:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

I'm seeing this on Eclipse 4.1, Apache Tomcat 7.x, and JDK 1.6. It apparently has something to do with caching the XSD files. Some people provide an alternate syntax of web.xml that uses DTDs instead of schemas. But I've had success with one solution which suggested merely turning off caching. The better option, also at that last link, is to download and install the XSDs manually.
Update: I decided to try to download one of the XSDs myself and try to install it in the Eclipse XML catalog manually. It became obvious that the Java XSD server was having problems---which is apparently what Eclipse saw when it tried to download and cache the XSD. Perhaps when Oracle/Sun gets its act together and the server starts working again, then Eclipse will stop giving this error. In the meantime, I'll have to turn off caching and see how far I get.
Update: Once the Sun server comes back up for a little while, download the XSD file and store it in some semi-permanent place locally. Then go into the Eclipse preferences, search for the XML Catalog, and give it a reference to the XSD file. I've verified this prevents Eclipse from trying to download and cache the file. This is the best solution if you can't trust the Sun servers---and apparently you can't.

Error: cvc-elt.1.a: Cannot find the declaration of element 'web-app'
Issue:
This error is related to the web.xml file of Eclipse IDE Dynamic Web Project
The main root cause of this error is different Java Enterprises Edition (JEE) support.
From August 13, 2019 Java EE Servlet API is maintained by Jakarta EE Servlet API
As these package names are changed from:
javax.servlet.*; ---> to ---> jakarta.servlet.*;
javax.servlet.http.*; ---> to ---> jakarta.servlet.http.*;
Your IDE might still populating the old doc type declaration for xml files to be compatible with javax package
Solution:
If you're using new version of Tomcat or other Java Server Application, check whether they're working with new jakarta package or old javax package.
Tomcat 10 is already migrated to Jakarta EE so if you're using Tomcat 10 you can use the jakarta doctype declaration mentioned below.
Correct Declaration for Old Version javax package
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
Correct Declaration for New Version jakarta package
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="5.0">
Things I am working with:
Eclipse IDE for Enterprise Java and Web Developers
Version: 2021-12 (4.22.0)
Build id: 20211202-1639*
Apache Tomcat
Version 10.0.7

I also came across this problem and didn't found something reasonable. For quick solution. Delete your workspace entirely and take clone of project again. You won't see the problem again. It helped me.

For me its working now
Replace with this -
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

I received this error when I unknowingly lost the internet connection meaning the xsd was not available. Reconnecting solved it

Deleting the workspace and creating a new workspace has helped me to resolve this error. I was getting this error for the ZK web application

This issue is related to Eclipse auto-generated web.xml file.
In new versions of Java EE, you must change Java EE to Jakarta EE.
As a sample change your <web-app> opening tag as this [5/7/2022]:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">

Related

org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start

I am struggling for the past 6-7 hrs trying to figure out what went wrong with my Apache Tomcat Server. In all of my projects, the jdk version got switched to 1.6 from 1.8.
To solve the version conflict, I verified whether compiled version and JVM of Tomcat version are same by taking help from here.
For multiple contexts with the same path error, I know i need to remove duplicate Context tags in server.xml. So, first I check in Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse) and find none there. So, I delve deep into the directory(Eclipse WorkSpace) metadata\.plugins\org.eclipse.wst.server.core\tmp3\conf and removed the duplicate Context tags over there, with help taken from here.
Now when i create a new Dynamic Web Project, everything works fine and I am able to see the web page. But if I try to access any of the HTML, XHTML files of those old project in which the jdk got changed, this org.apache.catalina.LifecycleException continues to pop up and the server fails to start, and consequently these duplicate Context tags continues to build up again and again every time i start the server.
None of my old Web application projects seems to work now.
java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext
[/EdBurns_ChrisSchalk]].....
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost]]
....
Caused by: java.lang.RuntimeException: Unexpected element value kind in
annotation: 0
How to prevent these context tags being build up again and again in server.xml.
Secondly, how to get back those old web projects to working state again?
I had a similar error and fixed it by following steps:
1. Under Servers project (which gets created itself when you add Apache Tomcat Server in Eclipse), open server.xml
2. Comment out the line
<Context docBase=... />
This will prevent multiple context tags to be created upon each request
1) Stop the server
2) Clean Tomcat's work directory
If you are not using annotation based Servlet then please remove annotation #WebServlet("/YourServletName") from the starting of the servlet. This annotation confuses the mapping with web.xml, after removing this annotation Tomcat server will work properly.
This seems to be an issue with local Maven repository. (i.e. .m2 folder) may be due to some corrupt .jar file
For me, the following actions helped to overcome this issue.
On my local file system, I've deleted the directory .m2 (Maven local repository)
In Eclipse, updated the project (select Maven > Update Project)
Ran the app again on Tomcat server.
Went through the various resources on the net but none of them helped then i deleted the existing server and added the same server again and now it is working fine and the steps are
Window>>ShowView>>Servers>>RightClick>>Delete
and then add the server again as you have added previously.
If you are using the following stack:
Server Version: Apache Tomcat/9.0.21
Servlet Version: 4.0 JSP Version: 2.3
Then try adding <absolute-ordering /> to your web.xml file. So your file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>spring-mvc-crud-demo</display-name>
<absolute-ordering />
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
......
In my case, the servlet-api.jar file in jre/lib/ext in the jdk directory conflicts with the servlet-api.jar file in tomcat, removing the servlet-api.jar in jre/lib/ext in the jdk directory can solve the problem.
Just make sure build with correct web.xml configuration.I have update web.xml with tomcat configuration and it worked for me.
Sample :-
<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>simulator</display-name>
<description>simulator app</description>
<!-- File upload -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- excel simulation -->
<display-name>simulator</display-name>
<description>simulator app</description>
<!-- File upload -->
<welcome-file-list>
<welcome-file>InsertPage.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>FileUploadServlet</servlet-name>
<servlet-class>clari5.excel.FileUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FileUploadServlet</servlet-name>
<url-pattern>/excelSimulator/FileUploadServlet</url-pattern>
</servlet-mapping>
</web-app>
One of the problems that can cause this is when you forget to put the / character in the WebServlet annotation #WebServlet("/example") #WebServlet("example")
I hope it works, it worked for me.
Below solution worked for me:
Navigate to Project->Clean..
Clean all the projects referenced by Tomcat server
Refresh the project you're trying to run on Tomcat
Try to run the server afterwards
I think it is jar file version problem. I had the same issue and I fixed it by changing the commons-codec-1.6.jar file from the build path. Earlier I was using latest version 1.10. Gradually I decreased the versions and 1.6 version fixed my issue.
Go to the task manager, kill the java processes and turn the server back on.
should work fine.

Tomcat 7 / TomEE 1.6 #Webfilter annotation. Not being loaded from Jar

Is there something special I have to do to enable Jar scanning for #WebFilter in Tomcat7 or TomEE 1.6? I have an empty 3.0 spec web.xml, a beans.xml in web-inf, and my #WebFilter is in a CDI compliant JAR (not that the servlet spec would really care I guess).
The filter works if I enable it manually in the web.xml. If I copy/paste the class into the WAR project, Tomcat/Tomee picks up the #WebFilter annotated class.
Thanks!
I was scratching my head too over my #WebFilter class not being picked up, and ended up reading something (can't remember where) that referenced the metadata-complete attribute in the web.xml root tag needing to be false, or just not added to the tag at all (default is false).
When I removed that attribute from my web.xml root tag so that it looked like this:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
it picked up my #WebFilter class immediately, with no references in the web.xml file. Not sure if this helps, but hopefully it will help someone.
isn't the jar filtered? Maybe an ignored prefix

Maven+Spring Project failing to load dependent xsd files

I've been struggling with this issue for several days now. I am trying to initialize a standard Spring project with the usual spring namespaces: beans, aop, context, util... my current, very initial, beans.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xml
http://www.springframework.org/schema/context http://www.springframework.org/schema/beans/spring-context.xml
http://www.springframework.org/schema/aop http://www.springframework.org/schema/beans/spring-aop.xml
http://www.springframework.org/schema/util http://www.springframework.org/schema/beans/spring-util.xml"
</beans>
When I attempt to compile and run the project in Glassfish, I hit an IllegalStateException while invoking org.glassfish.weld.WeldDeployer. Further down it states that the XML of dependent documents must be well formed and shows the first line of one of the dependent files (e.g. spring-beans.xml) which is clearly HTML. After some further digging, I found that indeed in my mavencachedirs where these .xsd files are cached, every single one had identical HTML content referencing a 404 Not Found. I am working offline with internal maven repositories, but this should not be a problem given that my dependent Spring jar files all have the appropriate spring.schemas and spring.handlers files. It simply seems like my project is failing to recognize them.
I'm a bit new to Spring, but I feel like I've done my due diligence in researching this issue. Any suggestions that may point me in the right direction would be greatly appreciated.
UPDATE - Following some of the tips posted in Spring schemaLocation fails when there is no internet connection, I consolidated my spring.handlers and spring.schemas files into two files in src/main/resources/META-INF. Running getResource returns the consolidated version of each file in this directory. That said, this still did not resolve the problem.
UPDATE 2 - I've reproduced this issue at home. I created a new Spring project on Netbeans 7.3.1 using the following archetype:
Group ID: co.ntier
Version: 1.0.2
Artifact ID: spring-mvc-archetype
Repository: http://repo.maven.apache.org/maven2/
Once the project was created, I added a beans.xml file to the classpath and stripped it down to it's most basic form:
<?xml version="1.0" encoding="windows-1252"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
/>
I built the project and deployed to Glassfish 4.0 through NetBeans while still connected to the internet. This worked as expected with no errors. However, when I disconnected the computer from the internet and deployed again (AND cleared the cached xsd files from ...Netbeans\Cache\7.3.1\mavencachedirs), I got the following error several times:
WARNING: WELD-001210 Warning when validating file:/C:/Users/Elliott/Desktop/Development/SpringTest/target/SpringTest/WEB-INF/beans.xml#5 against xsd. schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
I understand that Spring is supposed to be reading from the spring.schemas and spring.handlers files to locate these resources, but it clearly isn't! I challenge anybody to attempt to reproduce this issue and demonstrate that this is actually working as it should be. Right now I'm not convinced.
PROGRESS!!
OK. I'm 90% sure I've figured out the problem. When I created the beans.xml file, Netbeans creates a nb-configuration.xml file with the following in it:
<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">
<config-files>
<config-file>beans.xml</config-file>
</config-files>
<config-file-groups/>
</spring-data>
If I create a servlet in the web.xml file:
<servlet>
<servlet-name>SpringDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
and rename beans.xml file to SpringDispatcher-servlet.xml, the project compiles and loads the xsd files correctly, whether online or offline.
Since this worked when using the SpringDispatcher-servlet.xml, but not with beans.xml configured by Netbeans, I think it's safe to assume that when Netbeans is configured to load a spring config file through nb-configuration, it fails to reference the required spring.schemas and spring.handlers files in the classpath.
Maybe I'm completely wrong and just super noob-y when it comes to Spring (I am), but it doesn't seem like this behavior is correct. Regardless, at least I have a way to move forward now.

Unable to load EJB module

I am taking a course in Enterprise Application Development. I am new to JSF. I am trying to deploy my app using Glassfish 3.1 using JSF and Netbeans IDE.
The error I get is listed below.
Error occurred during deployment: Exception while preparing the app : Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for F:\Seagate\docs backup\NetBeansProjects\ent-app-dev\Slamka_Project1\build\web.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected. Please see server.log for more details.
Below are the references to EJB I have made.
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ejb.EJB;
#EJB
Any help would be appreciated.
EDIT: This is a Java Web Application.
EDIT
WAR FILE STRUCTURE TREE
META-INF/MANIFEST.MF
WEB-INF/classes
WEB-INF/lib/primefaces-2.1.1.jar
WEB-INF/web.xml
index.shtml
My file does not have an EJB tag in teh xhtml document. it has what is listed below.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsf/core">
Changing the web.xml web-app attribute version to 2.5 or higher resolved this issue.
Updated web-app element of web.xml will be,
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
So you have web application, it's not ejb-jar, it's web module that sould be packeged to *.war archive.
Structure should be
*.war/META-INF/persistence.xml
*.war/META-INF/MANIFEST.MF
*.war/WEB-INF/sun-web.xml
*.war/WEB-INF/web.xml
*.war/WEB-INF/classes/ - compiled classes in packages
*.war/WEB-INF/lib/ - libs
*.war/index.jsp - home page
example of sun-web.xml
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app>
<context-root>/app</context-root>
</sun-web-app>
if you are using Maven, you can use maven-war-plugin
Turns out the issue was a typo in a SQL statement (1 and l [lower case L]) and I needed to do a "Clean and build" on the project. Thank you for those who put effort into helping me solve my issue.

How to manually deploy a web service on Tomcat 6?

I'm learning how to develop SOAP web services with Java.
So far now I've been following this excellent tutorial
http://web.archive.org/web/20120626005333/http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
It all goes well, I have my web service working from the command line with it's embedded server and then, with the help of NetBeans I deployed it on Tomcat.
I'd like to know the steps to manually deploy it on Tomcat, in order to learn how it's done and because I don't like depending on an IDE.
I mean, I'd like to know how everything could be done from the command line and a text editor.
I've also found this link that explains how to manually deploy a servlet to Tomcat,
http://linux-sxs.org/internet_serving/c292.html
but I couldn't find any article telling how to deploy a web service.
Thanks a lot.
How to MANUALLY build and deploy a jax-ws web service to tomcat
I was trying to figure out how to MANUALLY build and deploy a web service for learning pourposes.
I began with this excellent article
http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
(new URL: http://www.oracle.com/technetwork/articles/javase/jax-ws-2-141894.html)
The idea was to do the whole thing using only a notepad and the command line.
The only way I could achieve was by deploying a web service with netbeans, and then having a look at the war generated file at \dist\.war (it's just a zip file, you can open it with 7zip)
I leave this in case anybody is interested and for documentation purposes...
If anybody knows an easier way please let me know!!!
tested on:
C:\tomcat6\bin>version
Server version: Apache Tomcat/6.0.26
Server built: March 9 2010 1805
Server number: 6.0.26.0
OS Name: Windows XP
OS Version: 5.1
Architecture: x86
JVM Version: 1.6.0_18-b07
JVM Vendor: Sun Microsystems Inc.
saludos
sas
1. create the following dir c:\java\src\ws
2. create thew following file c:\java\src\ws\Adder.java
// c:\java\src\ws\Adder.java
package ws;
import javax.jws.WebService;
#WebService
public class Adder {
public double add( double value1, double value2 ) {
return value1 + value2;
}
}
3. standing at c:\java\src\ execute
c:\java\src> javac ws\Adder.java
file c:\java\src\ws\Adder.class will be generated
4. create the following directory structure with the following files
c:\tomcat6\webapps\adder_ws
META-INF
context.xml
WEB-INF
classes
ws
Adder.class
lib
activation.jar
webservices-api.jar
webservices-extra.jar
webservices-extra-api.jar
webservices-rt.jar
webservices-tools.jar
sun-jaxws.xml
web.xml
5. copy compiled file
copy c:\java\src\ws\Adder.class c:\tomcat6\webapps\adder_ws\WEB-INF\classes\ws\Adder.class
6. c:\tomcat6\webapps\adder_ws\META-INF\context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/adder_ws"/>
7. c:\tomcat6\webapps\adder_ws\WEB-INF\web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Adder</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Adder</servlet-name>
<url-pattern>/add</url-pattern>
</servlet-mapping>
<!-- not needed
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
-->
</web-app>
8. Config WEB-INF\sun-jaxws.xml
file : c:\tomcat6\webapps\adder_ws\WEB-INF\sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="ws.Adder" name="Adder" url-pattern="/add"/>
</endpoints>
9. Copy libraries
files at c:\tomcat6\webapps\adder_ws\WEB-INF\lib
copy netbeans files from
[netbeans dir]\enterprise\modules\ext\metro\*.*
and
[netbeans dir]\ide\modules\ext\jaxb\activation.jar
10. restart apache
Shutdown : c:\tomcat6\bin\shutdown.bat
Startup : c:\tomcat6\bin\startup.bat
11. Test
Open a web browser and go to http://localhost:8080/adder_ws/add?wsdl
you can also use a tool like soapui (http://www.soapui.org/) to test the web service
that's it, I guess now I'll have a look at the way eclipses does it...
here's another useful article
it kind of answer my very own question
http://java.dzone.com/articles/jax-ws-deployment-five-minute
Following articles has step by step guide to manually build and deploy JAX-WS web services. It uses Ant as build tool.
Building JAX-WS Web service
I would expect the deployable to be the same for a web service and a servlet. Namely, a .war file. So you should be able to deploy it in the same fashion.
I see that nobody has mentioned JAX-WS Tutorials from Mkyong.com.
In the "JAX-WS Security in Tomcat" section on the "JAX-WS Tutorial" page, there is a short, to the point and with pictures tutorial, just what the OP wanted:
Deploy JAX-WS web services on Tomcat

Categories

Resources