java 在 Tomcat 上部署 JAX-WS Web 服务

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1739420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 17:47:44  来源:igfitidea点击:

Deploying JAX-WS web service on Tomcat

javaweb-servicestomcatjax-ws

提问by nos

After noticing Java 6 includes javax.xml.ws, I'm able to create a standalone web service. How would I go about hosting that in Tomcat 6?

在注意到 Java 6 包含javax.xml.ws 之后,我能够创建一个独立的 Web 服务。我将如何在 Tomcat 6 中托管它?

采纳答案by Tony

Download metro from hereand execute this jar as

这里下载 Metro并执行这个 jar 作为

java -jar metro-2_0-ea.jar

The metro directory contains two ant files, metro-on-glassfish.xml and metro-on-tomcat.xml. These two files are used to install the Metro binaries into the respective web containers.

Metro 目录包含两个 ant 文件,metro-on-glassfish.xml 和 Metro-on-tomcat.xml。这两个文件用于将 Metro 二进制文件安装到各自的 Web 容器中。

The installation process for Tomcat:

Tomcat的安装过程:

  1. shutdown.bat (Tomcat shutdown)

  2. Execute below line on command prompt

  1. shutdown.bat (Tomcat 关机)

  2. 在命令提示符下执行以下行

ant -Dtomcat.home= -f /metro-on-tomcat.xml install

ant -Dtomcat.home= -f /metro-on-tomcat.xml 安装

startup.bat (Tomcat start)

startup.bat(Tomcat 启动)

the installation process copies the two Metro jar files into Tomcat's shared/lib directory. No Tomcat configuration files are modified.

安装过程将两个 Metro jar 文件复制到 Tomcat 的 shared/lib 目录中。没有修改Tomcat 配置文件。

回答by Courtney Faulkner

You will need to download the JAX-WS RI (Reference Implementation) jax-ws.dev.java.net. The https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/samples.htmlpage lists some tips at the bottom of the page on setting up Tomcat for JAX-WS RI.

您将需要下载 JAX-WS RI(参考实现)jax-ws.dev.java.net。该https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/samples.html页面列出对JAX-WS RI设置Tomcat一些提示页面的底部。

Specifically for Tomcat 6, you will need to:

特别是对于 Tomcat 6,您需要:

Edit $CATALINA_HOME/conf/catalina.properties and set shared.loader={RI Installation Directory}/lib/*.jar. If you are running multiple instances of Tomcat, then edit CATALINA_BASE/conf/catalina.properties for that particular instance. The same technique can be used with Tomcat 5.x if you don't like to copy all the jars to $CATALINA_HOME/shared/lib

编辑 $CATALINA_HOME/conf/catalina.properties 并设置 shared.loader={RI 安装目录}/lib/*.jar。如果您正在运行 Tomcat 的多个实例,则编辑该特定实例的 CATALINA_BASE/conf/catalina.properties。如果您不想将所有 jars 复制到 $CATALINA_HOME/shared/lib,同样的技术可以用于 Tomcat 5.x

回答by Bozho

Or you can use Apache CXFwhich is a full-featured JAX-WS implementation. No extra configurations - only one Servlet.

或者您可以使用Apache CXF,它是一个功能齐全的 JAX-WS 实现。没有额外的配置——只有一个 Servlet。