最初に私は提案された同様の質問を見ました - これは明らかに一般的な問題です - まだ答えは見つかりませんでした。最新のJAXWS-RIをダウンロードし、すべての.jarファイルを手動でコピーしました。その後、一緒に私は適切なディレクトリ構造内の4つのファイルを置いweb.xmlのJax-ws warは展開しますが、tomcatに404を与えます
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems,Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>HelloWorldTomcatService</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>HelloWorldTomcatService</servlet-name>
<url-pattern>/HelloWorldTomcatService</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
と日-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint name="HelloWorldTomcatService" implementation="com.myservice.ws.Hello" url-pattern="/HelloWorldTomcatService"/>
</endpoints>
やカップルのJavaファイル
package com.myservice.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface WebServiceInterface {
@WebMethod
String printMessage();
}
package com.myservice.ws;
import javax.jws.WebService;
@WebService(endpointInterface = "com.myservice.ws.WebServiceInterface")
public class Hello implements WebServiceInterface{
@Override
public String printMessage() {
return "message";
}
}
を石畳eclipseでwarファイルをビルドし、Tomcatのwebappsフォルダにコピーします。戦争は爆発し、マネージャのコンソールに表示されますが、起動せず、ブラウザでそれにアクセスしようとする試みもすべて失敗します。
更新:
ここでは、カタリナログから除いています。
24-Jun-2016 11:22:42.164 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/HelloWorldTomcatService]
24-Jun-2016 11:22:42.171 INFO [localhost-startStop-6] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\webapps\HelloWorldTomcatService.war
24-Jun-2016 11:22:42.261 SEVERE [localhost-startStop-6] org.apache.catalina.startup.ContextConfig.configureStart Marking this application unavailable due to previous error(s)
24-Jun-2016 11:22:42.262 SEVERE [localhost-startStop-6] org.apache.catalina.core.StandardContext.startInternal One or more components marked the context as not correctly configured
24-Jun-2016 11:22:42.262 SEVERE [localhost-startStop-6] org.apache.catalina.core.StandardContext.startInternal Context [/HelloWorldTomcatService] startup failed due to previous errors
24-Jun-2016 11:22:42.265 INFO [localhost-startStop-6] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\webapps\HelloWorldTomcatService.war has finished in 94 ms
24-Jun-2016 12:53:45.577 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/HelloWorldTomcatService]
24-Jun-2016 12:53:45.596 INFO [localhost-startStop-7] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\webapps\HelloWorldTomcatService.war
24-Jun-2016 12:53:45.665 SEVERE [localhost-startStop-7] org.apache.catalina.startup.ContextConfig.configureStart Marking this application unavailable due to previous error(s)
はさらに、ログ:
22-Jun-2016 17:32:47.921 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\webapps\HelloWorldTomcatService.war
22-Jun-2016 17:32:48.036 SEVERE [localhost-startStop-1] org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml Parse error in application web.xml file at file:/C:/Program%20Files%20(x86)/Apache%20Software%20Foundation/Tomcat%208.5/webapps/HelloWorldTomcatService/WEB-INF/web.xml
java.io.FileNotFoundException: Could not resolve XML resource [null] with public ID [-//Sun Microsystems,Inc.//DTD Web Application 2.3//EN], system ID [http://java.sun.com/j2ee/dtds/web-app_2_3.dtd] and base URI [file:/C:/Program%20Files%20(x86)/Apache%20Software%20Foundation/Tomcat%208.5/webapps/HelloWorldTomcatService/WEB-INF/web.xml] to a known, local entity.
at org.apache.tomcat.util.descriptor.LocalResolver.resolveEntity(LocalResolver.java:155)
at com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper.resolveEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1461)
at org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml(WebXmlParser.java:120)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1110)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:298)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5076)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
22-Jun-2016 17:32:48.051 WARNING [localhost-startStop-1] org.apache.tomcat.util.scan.StandardJarScanner.scan Failed to scan [file:/C:/Program%20Files%20(x86)/Apache%20Software%20Foundation/Tomcat%208.5/lib/hk2-core.jar] from classloader hierarchy
java.io.FileNotFoundException: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\lib\hk2-core.jar (The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60)
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:43)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:326)
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:276)
at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1887)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1122)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:298)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5076)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
http://stackoverflow.com/questions/32059153/cannot-run-jax-ws-java-web-service-on-apache-tomcatに似ていますが、同じではありません。ファイルは正しい場所にあります。 – user1958756
サービスにアクセスするために使用しているURLは何ですか? – kolossus
@kolossus http:// localhost:8080/HelloWorldTomcatService、http:// localhost:8080/HelloWorldTomcatService/HellowWorldTomcatServiceなどがあります。それが助けられているかどうかを確認するためにURLパターンを変更してみました。ホームページとマネージャーの仕事、btw。 – user1958756