Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用RESTClient集成Grails和Jira_Grails_Jira - Fatal编程技术网

使用RESTClient集成Grails和Jira

使用RESTClient集成Grails和Jira,grails,jira,Grails,Jira,我使用GroovyHTTPBuilder和RestClient从JIRA访问web服务。 在开发模式下,它工作正常,但当我在Tomcat服务器上部署war时,它会抛出异常 “org.apache.commons.collections.map.ListOrderedMap:method()V 未找到。Stacktrace如下所示: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException:

我使用GroovyHTTPBuilder和RestClient从JIRA访问web服务。 在开发模式下,它工作正常,但当我在Tomcat服务器上部署war时,它会抛出异常

“org.apache.commons.collections.map.ListOrderedMap:method()V 未找到。Stacktrace如下所示: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: 正在执行控制器[com.tristar.JiraController]的操作[列表] 导致异常:执行操作时发生运行时错误 位于java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 在java.lang.Thread.run(Thread.java:662)处,由以下原因引起:org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: 执行操作时发生运行时错误 …另外3个原因是:java.lang.reflect.InvocationTargetException …另外3个原因是:java.lang.NoSuchMethodError:org.apache.commons.collections.map.ListOrderedMap:method()V 找不到 位于net.sf.json.JSONObject(JSONObject.java:1603) 在groovyx.net.http.EncoderRegistry.encodeJSON(EncoderRegistry.java:301) 位于groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1200) 位于groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setPropertiesFromMap(HTTPBuilder.java:1111) 位于groovyx.net.http.HTTPBuilder$RequestConfigDelegate。(HTTPBuilder.java:946) 位于groovyx.net.http.RESTClient.post(RESTClient.java:140) 在com.tristar.JiraController.list上(JiraController.groovy:221)”


如何解决此问题?

我在构建配置中添加了这些依赖项

compile 'com.atlassian.jira:jira-rest-java-client-api:2.0.0-m25'
compile 'com.atlassian.jira:jira-rest-java-client-core:2.0.0-m25'
和使用

AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory()
def jiraServerUri = URI.create("ipaddress")
JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "username", "password")

对于身份验证和获取RestClient对象而言,在Grails应用程序中使用JIRA REST Client for JAVA是不必要的,尽管它可能已经解决了您的问题。我遇到了同样的问题,并且能够使用Groovy HTTP Builder创建一个JIRA REST客户机

我在BuildConfig.groovy中添加的唯一依赖项是:

dependencies {
 compile("org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC1") {
  excludes 'groovy', 'xml-apis' } }
然后构建JSON查询并发布请求:

jiraClient.post(requestContentType: JSON, body: query)
如果你想了解更多信息,这篇博文可能会有所帮助:


试着在建造前进行全面清洁<代码>grails clean&&rm-rf./target/&&grails刷新依赖项和&grails war。此外,您还可以尝试通过下一个命令
grailsdevwar
构建。我改变了我的实现方式,现在一切都很好。谢谢,请描述一下你的改变作为答案,这很好。它为rest调用提供方法,这与Bob Swift过去使用的soap API非常相似。
jiraClient.post(requestContentType: JSON, body: query)