简体   繁体   English

无法修复“名称空间[/ build / result]没有映射任何操作”。 将操作添加到Bamboo名称空间的正确方法是什么?

[英]Can't fix “There is no Action mapped for namespace [/build/result] ”. What is the correct way of adding action to bamboo namespace?

I am developing a bamboo plugin using the Atlassian-SDK. 我正在使用Atlassian-SDK开发Bamboo插件。 This plugin would add a new tab to the Bamboo Jobs page that would display an HTML report (present in artifact) in the same tab . 此插件将向Bamboo Jobs页面添加一个新标签 ,该标签将在同一标签中显示HTML报告(以工件形式显示)。

My Atlassian-plugin.xml looks like 我的Atlassian-plugin.xml看起来像

<xwork key="viewRobotReport" name="View Robot Report">
    <package name="RobotPlugin" extends="buildResultView">
    <action name="viewRobotReport" class="robot.RobotReport">
    <result name="success" type="freemarker">viewRobotReport.ftl</result>
    </action>
    </package>
</xwork>

<web-item key="RobotJob-${planKey}-${buildNumber}" name="RobotReport" section="results.subMenu/results" weight="80">
    <label key="Robot Report"/>
    <link linkId="RobotBuild-${planKey}-${buildNumber}">/build/result/viewRobotReport.action?buildKey=${planKey}&amp;buildNumber=${buildNumber}
    </link>
    <condition class="robot.RobotReportViewCondition"/>
</web-item>

I am extending my class RobotReport from ViewBuildResults so that I can fetch the artifact details. 我正在从ViewBuildResults扩展我的类RobotReport,以便可以获取工件详细信息。

After I click on the tab I get an error 单击选项卡后,出现错误

 Apologies, this page could not be properly decorated (data is missing) 

The URL for the page is 172.xx.x.x0:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1 该页面的URL是172.xx.x.x0:6990 / bamboo / build / result / viewRobotReport.action?buildKey = TPRO1-TPLAN1-JOB1&buildNumber = 1

From the logs I can see the below errors 从日志中,我可以看到以下错误

[INFO] [talledLocalContainer] 2018-05-02 13:41:48,724 INFO [http-nio-6990-exec-12] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1&_=1525264904397 177957kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,725 ERROR [http-nio-6990-exec-12] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,788 INFO [http-nio-6990-exec-9] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1 76808kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,789 ERROR [http-nio-6990-exec-9] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,819 ERROR [http-nio-6990-exec-9] [runtime] Error executing FreeMarker template
[INFO] [talledLocalContainer] FreeMarker template error:
[INFO] [talledLocalContainer] The following has evaluated to null or missing:
[INFO] [talledLocalContainer] ==> navigationContext  [in template "decorators/resultDecorator.ftl" at line 17, column 18]
[INFO] [talledLocalContainer] 

I understand that BambooStruts cannot find action in the namespace /build/result in /bamboo . 我了解到BambooStruts无法在/ bamboo的名称空间/ build / result中找到动作。

My freemarker template contains only this bit. 我的freemarker模板仅包含此位。

<html>
    <head>
        <meta name="decorator" content="result"/>
    </head>
    <body>
    </body>
</html>

What is the correct way of adding action (viewRobotReport) in bamboo's /build/result namespace? 在Bamboo的/ build / result命名空间中添加动作(viewRobotReport)的正确方法是什么?

Bamboo Developer Forums doesn't have a guideline for implementing this. Bamboo开发者论坛没有实施此准则。 Somewhere it mentions "setter injection" but not sure what that is. 它在某处提到“ setter注入”,但不确定是什么。

Any tiny hint would be highly appreciated. 任何微小的提示将不胜感激。 Thanks in advance. 提前致谢。

I found what the problem was when I was looking at all the logs of atlas-run . 当我查看atlas-run的所有日志时,我发现了问题所在。 I could the the below in the logs.. 我可以在日志中的以下内容。

[INFO] [talledLocalContainer] 2018-05-03 13:30:07,737 ERROR [localhost-startStop-1] [BambooPluginUtils] A problem has occurred when instantiating action class [robot.RobotReport], skipping action [viewRobotReport]
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'robot.RobotReport': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.atlassian.bamboo.storage.StorageLocationService com.atlassian.bamboo.build.ViewBuildResults.storageLocationService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.bamboo.storage.StorageLocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

I fixed it in the code by doing the below.. 我通过执行以下操作将其固定在代码中。

import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;

@Scanned
public class RobotReport extends ViewBuildResults {

    public RobotReport(@ComponentImport StorageLocationService storageLocationService){

Useful link 有用的链接

https://community.developer.atlassian.com/t/spring-autowiring-issues-when-extending-viewbuildresults/14766/2 https://community.developer.atlassian.com/t/spring-autowiring-issues-when-extending-viewbuildresults/14766/2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM