我正在尝试使用端口8080上的cargo maven插件将战争文件部署到tomcat(我检查过是免费的),我得到catalina.LifeCycleException: Failed to start component [Connector[AJP/1.3-auto-1]]
它还说输入的端口号无效,但是在server.xml文件中,该端口指定为:<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
我是否缺少其他配置?
货物配置:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.14</version>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<type>installed</type>
<zipUrlInstaller>
<url>http://repo.release.cerner.corp/external/repo/org/apache/tomcat/apache-tomcat/${apache.tomcat.version}/apache-tomcat-${apache.tomcat.version}.tar.gz</url>
</zipUrlInstaller>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
</dependencies>
<timeout>300000</timeout>
</container>
<configuration>
<configfiles>
<configfile>
<file>${project.basedir}/src/test/resources/context/context.xml</file>
<todir>conf</todir>
</configfile>
</configfiles>
<properties>
<cargo.servlet.port>${apache.tomcat.servletPort}</cargo.servlet.port>
<cargo.rmi.port>${apache.tomcat.rmiPort}</cargo.rmi.port>
<cargo.tomcat.ajp.port>${apache.tomcat.ajpPort}</cargo.tomcat.ajp.port>
<cargo.logging>low</cargo.logging>
<!--uncomment to enable debugging on the server-->
<!--<cargo.jvmargs> "-Xdebug" "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7998"-->
<!--</cargo.jvmargs>-->
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>sample-war</artifactId>
<type>war</type>
<properties>
<context>sample-war</context>
</properties>
</deployable>
</deployables>
</configuration>
<executions>
<execution>
<id>start-container</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>stop-container</id>
<goals>
<goal>stop</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
答案 0 :(得分:1)
更改cargo configuration中的端口号:
@DataProvider(name = "getDataFromExcel")
public static Object[][] GetData() throws IOException, BiffException{
File f = new File("/Users/aakibqureshi/Downloads/BrowsersUrl.xls");
Workbook wb = Workbook.getWorkbook(f);
Sheet sheet = wb.getSheet(0);
int rows = sheet.getRows();
int cols = sheet.getRow(0).length;
String[][] data = new String[rows][cols];
for(int i=0;i<rows;i++){
data[i][1] = wb.getSheet(0).getCell(1,i).getContents();
//System.out.println(data[i][1]);
}
return data;
}
@Test(dataProvider = "getDataFromExcel")
public static void SimpleTest(String url) throws IOException {
driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElementById("org.chromium.chrome:id/terms_accept").click();
driver.findElementById("org.chromium.chrome:id/next_button").click();
driver.findElementById("org.chromium.chrome:id/negative_button").click();
driver.findElementById("org.chromium.chrome:id/search_box_text").click();
driver.findElementById("org.chromium.chrome:id/url_bar").click();
System.out.println(url);
}
或在命令行上覆盖它
<configuration> <properties> <cargo.servlet.port>8080</cargo.servlet.port> </properties> </configuration>
答案 1 :(得分:1)
在HTTP连接器旁边,您在server.xml
中配置了AJP连接器元素,并指定了端口-1
:
<Connector
port="-1"
protocol="AJP/1.3"
...
/>
如果不需要AJP,请通过将其包装在<!-- -->
注释元素中来注释掉该连接器。否则,您需要更正端口设置才能使用AJP。
或者,您可能需要使用cargo属性指定AJP: