2011-01-12 2 views
0

웹 응용 프로그램 (실제로는 gwt 응용 프로그램)이 있고 셀레늄 테스트 용으로 Jetty 서버에 배포하려는 경우 maven, jetty-plugin, gwt-maven-plugin을 사용했습니다. 셀레늄 - 받는다는 - 플러그인, 내가 마지막으로 실행 부두 및 셀레늄의 단절을 가지고 있지만, 셀레늄 테스트 때문에 유명한 404 eror의 실패 :부두에 웹 응용 프로그램을 배포하는 방법

com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://127.0.0.1:8080/index.html Response_Code = 404 Error_Message = Not Found 

메신저 확실하지 않은 내 부두 구성에 새의 메신저 종류의 이후 올 경우 내가 MVN 클린 설치 달렸다

<plugin> 
    <groupId>org.mortbay.jetty</groupId> 
    <artifactId>maven-jetty-plugin</artifactId> 

    <configuration> 
    <contextPath>/sample-console</contextPath> 
    <webAppSourceDirectory>${basedir}/target/${project.artifactId}-${project.version}</webAppSourceDirectory> 
    <webXml>${basedir}/target/${project.artifactId}-${project.version}/WEB-INF/web.xml</webXml> 
    </configuration> 
      <executions> 
      <execution> 
       <id>start-jetty</id> 
       <phase>pre-integration-test</phase> 
       <goals> 
        <goal>run</goal> 
       </goals> 
       <configuration> 
        <daemon>true</daemon> 
       </configuration> 
      </execution> 
      <execution> 
       <id>stop-jetty</id> 
       <phase>post-integraion-test</phase> 
       <goals> 
        <goal>stop</goal> 
       </goals> 
      </execution> 
      </executions> 
</plugin> 

, 난 C의 출력을 볼 수 있습니다 여기 (받는다는 - 부두 - 플러그인)을하다 ommand 창

[INFO] Configuring Jetty for project: DYI sample Console 
[INFO] Webapp source directory = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT 
[INFO] Reload Mechanic: automatic 
[INFO] Classes = /Users/dyi/Documents/workspace/sample/console/target/classes 
log4j:WARN No appenders could be found for logger (org.mortbay.log). 
log4j:WARN Please initialize the log4j system properly. 
[INFO] Context path = /sample-console 
[INFO] Tmp directory = determined at runtime 
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml 
[INFO] Web overrides = none 
[INFO] web.xml file = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT/WEB-INF/web.xml 
[INFO] Webapp directory = /Users/dyi/Documents/workspace/sample/console/target/sample-console-0.1-SNAPSHOT 
[INFO] Starting jetty 6.1.22 ... 
[INFO] Started Jetty Server 
[INFO] [selenium:start-server {execution: start}] 

내 폴더 구조는 다음과 같습니다

--sample/ 
    -- console/ 
     -- src/ 
     -- target/ 
      -- classes/ 
      -- sample-console-0.1-SNAPSHOT/ 
        -- css/ 
        -- images/ 
        -- img/ 
        -- index.html 
        -- js/ 
        -- META-INF/ 
        -- security/ 
        -- test.html 
        -- WEB-INF/ 
         -- classes/ 
         -- lib/ 
         -- web.xml 

나는 내가 index.html 페이지를 볼 수 있습니다 이해하지 않는 일이 바로 거기에 폴더 '메가 샘플에 console-0.1-SNAPSHOT ', 왜 찾을 수 없습니까? 'contextPath'를 잘못 설정했기 때문입니까? 나는 그것을 '/'로 설정하려고 시도했다. 그런 다음 503 서비스를 사용할 수 없다는 오류가 발생했다. 누구든지 도울 수 있니? 많은 감사합니다 !!

답변

0

GWT 앱에서 작동하지 않는 webapp 디렉토리에서 앱을 실행하려고하는 것 같습니다. 다음과 같이 실행 전쟁하는 대신 실행의 당신의 부두 받는다는 플러그인의 목표를 설정하십시오 :

<modelVersion>4.0.0</modelVersion> 
<groupId>org.proj.web</groupId> 
<artifactId>gwtapp</artifactId> 
<packaging>war</packaging> 
<version>1.0-SNAPSHOT</version> 
<name>gwtapp</name> 

<properties> 
    ... 
</properties> 
<dependencies> 
    ... 
</dependencies> 
<build> 
    <plugins> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.5</version> 
      <configuration> 
       <excludes> 
        <exclude>**/integration/**</exclude> 
       </excludes> 
      </configuration> 
      <executions> 
       <execution> 
        <id>integration-tests</id> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>test</goal> 
        </goals> 
        <configuration> 
         <skip>false</skip> 
         <excludes> 
          <exclude>none</exclude> 
         </excludes> 
         <includes> 
          <include>**/integration/** 
        </include> 
         </includes> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <!-- Selenium and integration testing support --> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>selenium-maven-plugin</artifactId> 
      <version>1.1</version> 
      <executions>     
       <execution> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>start-server</goal> 
        </goals> 
        <configuration> 
         <background>true</background> 
        </configuration> 
       </execution> 
       <execution> 
        <id>stop</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop-server</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>jetty-maven-plugin</artifactId> 
      <version>7.2.2.v20101205</version> 
      <configuration> 
       <webAppConfig> 
        <contextPath>/${project.name}</contextPath> 
       </webAppConfig> 
       <scanIntervalSeconds>5</scanIntervalSeconds> 
       <stopPort>9966</stopPort> 
       <stopKey>foo</stopKey> 
       <connectors> 
        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> 
         <port>9080</port> 
         <maxIdleTime>60000</maxIdleTime> 
        </connector> 
       </connectors> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-jetty</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>run-war</goal> 
        </goals> 
        <configuration> 
         <daemon>true</daemon> 
        </configuration> 
       </execution> 
       <execution> 
        <id>stop-jetty</id> 
        <phase>post-integration-test</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>gwt-maven-plugin</artifactId> 
      <version>2.1.0-1</version> 
      <configuration> 
       <logLevel>INFO</logLevel> 
       <style>PRETTY</style> 
       <runTarget>/gwtapp.html</runTarget> 
       <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp> 
       <modules> 
        <module>${project.groupId}.gwtapp</module> 
       </modules> 
       <copyWebapp>true</copyWebapp> 
      </configuration> 
      <executions> 
       <execution> 
        <id>gwtcompile</id> 
        <phase>prepare-package</phase> 
        <goals> 
         <goal>compile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> 
</build> 

이것은 컴파일 및 실행 GWT는 컴파일의 원인이됩니다, 당신이 그 구성한 가정. 바르게. 당신의 설정은 다음과 같습니다 경우

, 당신은 단지 mvn clean integration-tests를 실행할 수 있으며 스크립트는 :

  1. 을 컴파일 코드
  2. GWT를 : 컴파일 코드
  3. 전쟁 파일을 만듭니다
  4. 시작 부두 그리고 부두에 전쟁 파일을 배포하십시오.
  5. 셀렌 서버를 시작하십시오.
  6. 모든 서브 디렉토리에서 테스트를 실행하십시오. 테스트 디렉토리에 통합 패키지.
관련 문제