2013-08-05 101 views
0

我正在嘗試使用jetty gradle插件運行jetty服務器進行功能測試。但是,我得到java.lang.IllegalArgumentException: Object is not of type class org.mortbay.jetty.webapp.WebAppContextIllegalArgumentException當嘗試啓動使用gradle插件的jetty服務器

我按照here所示的示例進行操作,看不到我所做的改變。構建文件的相關部分看起來是這樣的:

apply plugin: 'jetty' 
dependencies { 
    providedRuntime 'com.h2database:h2:1.3.167' 
    providedRuntime 'commons-dbcp:commons-dbcp:1.4' 
} 

jettyRunWar { 
    httpPort = 8083 
    stopPort = 8085 
    stopKey = "stopKey" 
    jettyConfig = file("$projectDir/jetty-config/jetty.xml") 
} 

jettyStop { 
    stopPort = 8085 
    stopKey = "stopKey" 
} 

而且我的jetty.xml的樣子:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> 
<Configure class="org.mortbay.jetty.webapp.WebAppContext"> 
<Set name="contextPath">/gateway</Set> 
<New class="org.mortbay.jetty.plus.naming.Resource"> 
    <Arg> 
    </Arg> 
    <Arg>jdbc/gateway</Arg> 
    <Arg> 
     <New class="org.apache.commons.dbcp.BasicDataSource"> 
      <Set name="url">jdbc:h2:tcp://localhost/build/db; USER=sa</Set> 
     </New> 
    </Arg> 
</New> 
</Configure> 

堆棧跟蹤可以發現here

任何建議將不勝感激。

回答

0

我最好的猜測是它是Jetty插件中的一個錯誤。一般來說,Jetty插件是相當有限和過時的,我建議嘗試使用arquillian-gradle-plugin。這是Gradle的容器支持的標題。

+0

我已經添加了一個鏈接到堆棧跟蹤。預先感謝您提供的任何幫助。 –

+0

對不起,真的很晚回覆。剛纔看到你編輯了答案。這是我們採取的路線,所以謝謝。 –

相關問題