- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 tomcat7-maven-plugin 将我的应用程序部署到 Tomcat。当我运行 topmcat7: deploy
时,我在控制台中看到:
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fmyproject
Uploaded: http://localhost:8080/manager/text/deploy?path=%2Fmyproject (1034 KB at 4807.3 KB/sec)
然后大约 1 分钟没有任何进展,我得到了
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project com.javalearning: Cannot invoke Tomcat manager: The target server failed to respond -> [Help 1]
这还不是全部!
当我做的时候
mvv: clean
并在 Intellij Idea 中重新导入 maven 项目,有时(仅有时!)我获得了构建成功,但是我的 .war
文件没有打开和运行 Tomcat ,它们看起来像破烂的。但是,如果我将构建的.war
文件手动复制粘贴到webapps
目录,一切都OK!
这还不是全部!我尝试将我的 pom.xml 设置和 web.xml 设置复制到同一台计算机上同一台 tomcat 服务器上的另一个项目,一切正常!
这是怎么回事?!请帮忙!我尝试解决了24小时,但没有结果((
完整的 srtacktrace:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.920s
[INFO] Finished at: Sat Aug 27 13:48:21 MSK 2016
[INFO] Final Memory: 16M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project com.javalearning: Cannot invoke Tomcat manager: The target server failed to respond -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project com.javalearning: Cannot invoke Tomcat manager
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 25 more
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:682)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:742)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:705)
at org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:388)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:82)
at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)
... 28 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
我的 pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyProject</groupId>
<artifactId>com.javalearning</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/myproject</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
web.xml:
<!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>
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>myproject.controller.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
最佳答案
既然你提到手工复制 war 对你有用,我假设 webapp 已经至少部署到 tomcat 一次。在那种情况下,tomcat7:deploy 将不起作用。尝试 mvn tomcat7:redeploy
添加于 2016/09/14:该死,我早该看到 - 你没有提供用户名和密码(参见下面的示例),所以我猜 tomcat 的身份验证失败了。
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<server>tomcat-8.0.24</server>
<url>http://idoru:8080/manager/text</url>
<username>bob</username>
<password>whatever</password>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
用户名/密码必须与 tomcat-users.xml 中设置的用户名/密码相匹配。
关于java - 目标服务器未能响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39179937/
我很快就会明白,我不是 Git 甚至 Gitkraken 的高手。因此,我只有一个修补程序、一个主分支和一个功能分支。我在修补程序、提交、推送和 merge 到 master 中进行更改(然后我也推送
我刚开始使用 stub 请求来测试对 iOS 的外部 API 的异步调用。我目前被以下代码困住了,我无法弄清楚什么不起作用。 我想要实现的非常简单的事情是,如果我从网站收到 200 响应,我将 Vie
设置: 一个 JPA ReviewRepository延长 CrudRepository 我的测试使用切片测试注释 @DataJpaTest 我的测试@Autowired ReviewReposito
我尝试通过logstash将csv文件vrom filebeat摄取到hdfs中。 Filebeat 成功将其转移到 logstash,因为我使用 stdout{codec=>rubydebug} 并
我看到很多教程解释了如何在 Tensorflow 的 Bazel WORKSPACE 中构建项目(例如 this one)。但我似乎无法找到一种方法来构建我自己的项目并将 tensorflow 作为依
我正在运行 Ubuntu 10.04 并且最初安装了 ruby 1.9.1(来自源代码)。我刚刚决定试用 ruby 1.9.2 和 rails 3,现在似乎是使用 rvm 处理多个 ruby
我有一个应用程序从后端接收支持的语言环境列表作为以下响应: {locales: [{code: 'enUS'}, {code: 'deDE'}, {code: 'arAR'}]} 我想使用 date-
我是一名优秀的程序员,十分优秀!