PhantomJS无法在Jenkins上运行的Jetty上加载URL

时间:2014-06-27 11:54:13

标签: jenkins jetty phantomjs

我想在本地服务器上使用带有PhantomJS的Siesta测试框架,没有问题。我在http://www.bryntum.com/forum/viewtopic.php?f=20&t=3068工作,在我的机器上,没有什么可抱怨的,所以我想把它和詹金斯结合起来。

但是使用Jenkins会出现错误403.

我的所作所为:

  • 将我项目的文件复制到Jetty的webapps文件夹中(包括 框架)

  • 启动jetty服务器(到目前为止没有问题)

  • 使用我的框架上的PhantomJs 本地主机:端口/项目/ index.html中

我的问题开始了: 无法加载URL:localhost:port / project / index.html(状态403)

我搜索了一些结果,但没有找到解决这个问题的任何内容。

欢迎每一个提示

由于

看看我做了什么:

我的Jenkins Shell脚本

JETTY="jetty-distribution-9.2.0.v20140526"
JETTYWEB="$JETTY/webapps"
DIR="$WORKSPACE/$JETTYWEB/myProject/src/test"
PHANTOM="$DIR/Siesta_Framework/bin"

rm -r "$JETTYWEB/myProject/"
mkdir "$JETTYWEB/myProject/"
cp -pr "src/" "$JETTYWEB/myProject/" 
chmod u+x -R $JETTYWEB/
cd $WORKSPACE/$JETTY

# Start des Servers
java -DSTOP.PORT=11183 -jar start.jar -DSTOP.KEY=tadam & 
sleep 5


#jenkins "$DIR/browse-autmation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0
cd $PHANTOM

#curl http://localhost:11182/myProject/src/test/browse-automation.html

./phantomjs "http://127.0.0.1:11182/myProject/src/test/browse-automation.html"

#"http://.../ci/job/test-phatomJS/ws/src/test/browse-automation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0"



#curl http://127.0.0.1:11182/myProject/src/test/Siesta_Framework/bin/phantomjs


sleep 15
# Stop des Servers -DSTOP.KEY=tadam 
cd $WORKSPACE/$JETTY
java -DSTOP.PORT=11183 -DSTOP.KEY=tadam -jar start.jar --stop 

结果是:

[EnvInject] - Loading node environment variables.
Building remotely on ja_lin01 in workspace /var/opt/coinop/data/workspace/test-phatomJS
Fetching changes from the remote Git repository
Fetching upstream changes from gitlab@moso-ci-srv.novalocal:b.rohn/myProject.git
Checking out Revision a056b4ac6a7b47a4e77f3f80c5b7cbc51167cefc (origin/master)
[test-phatomJS] $ /bin/bash -xe /tmp/hudson8419984949815797813.sh
+ JETTY=jetty-distribution-9.2.0.v20140526
+ JETTYWEB=jetty-distribution-9.2.0.v20140526/webapps
+ DIR=/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test
+ PHANTOM=/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
+ rm -r jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ mkdir jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ cp -pr src/ jetty-distribution-9.2.0.v20140526/webapps/myProject/
+ chmod u+x -R jetty-distribution-9.2.0.v20140526/webapps/
+ cd /var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526
+ sleep 5
+ java -DSTOP.PORT=11183 -jar start.jar -DSTOP.KEY=tadam
WARNING: System properties and/or JVM args set.  Consider using --dry-run or --exec
2014-07-01 15:37:10.895:INFO::main: Logging initialized @1014ms
2014-07-01 15:37:12.451:INFO:oejs.Server:main: jetty-9.2.0.v20140526
2014-07-01 15:37:12.480:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/data/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/] at interval 1
2014-07-01 15:37:13.232:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@57cd102a{/myProject,file:/data/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/,AVAILABLE}{/myProject}
2014-07-01 15:37:13.255:INFO:oejs.ServerConnector:main: Started ServerConnector@6d622548{HTTP/1.1}{0.0.0.0:11182}
2014-07-01 15:37:13.255:INFO:oejs.Server:main: Started @3388ms
+ cd /var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
+ ./phantomjs http://127.0.0.1:11182/myProject/src/test/browse-automation.html
/var/opt/coinop/data/workspace/test-phatomJS/jetty-distribution-9.2.0.v20140526/webapps/myProject/src/test/Siesta_Framework/bin
Launching PhantomJS 1.6.0 at http://127.0.0.1:11182/myProject/src/test/browse-automation.html
Failed to load URL: http://127.0.0.1:11182/myProject/src/test/browse-automation.html?phantom=true&enableCodeCoverage=false&hasPreviousReport=false&page=0(status: 403)
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Build step 'Execute shell' marked build as failure
2014-07-01 15:37:24.931:INFO:oejs.ServerConnector:Thread-0: Stopped ServerConnector@6d622548{HTTP/1.1}{0.0.0.0:11182}
Finished: FAILURE

1 个答案:

答案 0 :(得分:1)

经过长时间的搜索,我注意到,phantomjs调用没有它需要的所有信息。它需要目录本身。所以我的决心是:在linux服务器上安装phantomjs并使用这个phantomjs,包括框架的目录和幻像脚本:现在它可以工作了。 我的实际呼叫是:

./phantomjs "$DIR/phantomjs-launcher.js" $DIR http://127.0.0.1:11182/myProject/browse-automation.html

情况:我在linux机器上的phtomjs目录中cd并给它我的framework / bin的“DIR”