首先,我研究了建议的类似问题——因为这显然是一个相当普遍的问题——但还没有找到答案。我哪里出错了?下载了最新的JAXWS-RI,手动复制了所有的. jar文件。然后拼凑了一个web.xml
<?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>
还有sun-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)
以防有人好奇:我遇到的问题是web的标题。xml与我正在使用的Tomcat版本不兼容——或者不推荐使用,我不知道。
现在起作用的头是:
<?xml version="1.0" encoding="UTF-8"?>
<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">
...
还有一条警告称,hk2 core。罐子不见了。如果我先解决了xml问题,我不确定这是否会成为一个问题,但这是一个很好的解决方案,所以是Kolossus的道具。
我已经使用JAXWS开发了一个Web服务,并且能够在Tomcat7上从eclipse运行它,没有任何问题。 但我的问题是如何在Apache war文件中部署它。每当我在服务器上运行时,它都会出现异常严重:WSSERVLET11:无法解析运行时描述符:java。lang.NoClassDefFoundError:org/glassfish/ha/store/api/BackingStoreExcep
在Ubuntu 16.04上,我使用以下命令停止tomcat7服务器: 然后我创建了一个war文件,如下所示: 我将war文件复制到webapps目录: 我使用命令:sudo service tomcat7 start调出tomcat 这样,下面的url显示服务器正在工作: 据我所知,下面的URL应该转到. war文件localhost:8080/test 它不起作用。(404错误)我做错了什么?
我正在开发简单的JAX-WS WebService。我正在使用ANT构建脚本创建WAR文件。该文件在部署到Tomcat7服务器时,抛出以下异常,并出现如下部署错误。 JAXB 2.1 API是从bootstrap classloader加载的,但是这个RI(从jar:file:/d:/dreamsoln/server/apache-tomcat-7.0.29/webapps/webserviced
我正在寻找一种方法,可以在我选择的时候将战争工件部署到IntelliJ启动的Tomcat中。我有一个项目,它的配置启动了Tomcat8服务器并部署了一些工件。LaterI现在希望将更多来自不同项目的工件部署到同一个IntelliJ启动的Tomcat中。 步骤:启动包含Tomcat的项目 步骤:从另一个IntelliJ-project(从IDE内)部署war 步骤:从IntelliJ部署另一个war
我遇到了一个与Gradle 4.8.1建立战争的问题。这是构建。格拉德尔: 我还尝试删除“maven”插件、archivesBaseName和uploadArchive任务,同时取消对war任务的注释,得到了相同的结果。使用uploadArchive时,war可以很好地部署到nexus服务器,我没有发现任何错误。在将war部署到tomcat(在这两种情况下)时,tomcat 7和8不会抛出错误,我
我有一个grails 2.2应用程序,当我从svn进行干净的结帐并执行grails run-app时运行良好。(我已经吹走了我的. grails/2.2.0和. grails/ivy-cache目录并重新下载了依赖项) 但是,当我创建war(grails war)并将其部署在tomcat7中时,它会因以下错误而死亡: 2013-03-08 04:12:17096[pool-2-thread-1]堆