xwork Actions in Bamboo
Asked by Titus:

Hi,

I have setup a webitem in my atlassian-plugin.xml and defined an xwork action.

But when I try to call this action which will render a velocity template, Bamboo always says, that an action for package and contextpath is not defined and that the action is not allowed. See small stacktrace and error log beneath.

It is the only action I have defined therefor the package name is unique.

\[INFO\] \[talledLocalContainer\] 2018-02-01 18:42:35,210 ERROR \[http-nio-6990-exec-7\] \[BambooStrutsUnknownHandler\] There is no Action mapped for namespace \[/plugins/secsign\] and action name \[ViewSecSignIDOptions\] associated with context path \[/bamboo\].

\[INFO\] \[talledLocalContainer\] 2018-02-01 18:42:49,355 WARN \[http-nio-6990-exec-7\] \[Dispatcher\] Could not find action or result: /bamboo/plugins/secsign/ViewSecSignIDOptions!show.action

\[INFO\] \[talledLocalContainer\] Method show for action ViewSecSignIDOptions is not allowed! - \[unknown location\]

\[INFO\] \[talledLocalContainer\] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:200)

\[INFO\] \[talledLocalContainer\] at org.apache.struts2.factory.StrutsActionProxy.prepare(StrutsActionProxy.java:63)

I'm using setter injection in the corresponding class which inherits from com.atlassian.bamboo.ww2.BambooActionSupport which extends com.opensymphony.xwork2.ActionSupport

I'm currently running Bamboo 6.0.0 build 60001. But the error is the same in 5.9.x and 5.10.x

And the definitions in my atlassian-plugin.xml look like:

\<xwork name="secsign-id-options" key="secsign-id-options"\>  
\<description key="secsign-id-options"\>SecSign ID Options\</description\>  
\<package name="secsign-id-options" extends="default" namespace="/plugins/secsign"\>  
\<default-interceptor-ref name="defaultStack" /\>  
\<action name="ViewSecSignIDOptions!show" class="com.secsign.bamboo.actions.SecSignIDPluginManagementAction" method="doShow"\>  
\<result name="success" type="velocity"\>/templates/secsignid-options-and-users-page.vm  
\</result\>  
\<result name="input" type="velocity"\>/templates/secsignid-options-and-users-page.vm  
\</result\>  
\<result name="error" type="velocity"\>/templates/secsignid-options-and-users-page.vm  
\</result\>  
\<result name="options" type="velocity"\>/templates/secsignid-options-page.vm  
\</result\>  
\<result name="users" type="velocity"\>/templates/secsignid-users-page.vm  
\</result\>  
\</action\>

\</package\>  
\</xwork\>

\<web-item key="secsign_id_menu" name="SecSign ID top navigation menu" i18n-name-key="secsign_id_menu.title" section="header.global.primary" weight="40"\>  
\<label key="secsignid.menu.label"\>SecSign ID\</label\>  
\<link linkId="secsignid_options"\>/plugins/secsign/ViewSecSignIDOptions!show.action\</link\>  
\<!--\<condition class="com.atlassian.bamboo.plugins.web.conditions.AdministerPlanPermissionCondition"/\>--\>  
\<description key="secsignid.menu.description"\>Options and user mappings for SecSign ID\</description\>  
\<tooltip key="secsignid.menu.tooltip"\>Options and user mappings for SecSign ID\</tooltip\>  
\</web-item\>

Cheers

Titus


Answers:
author: Alexey Chystoprudov
body: Try to remove "!show" from action name:

```
<action name="ViewSecSignIDOptions" 
class="com.secsign.bamboo.actions.SecSignIDPluginManagementAction" 
method="doShow">
```

and not use !show in link declaration, so leave it :

```
<link linkId="secsignid_options">/plugins/secsign/ViewSecSignIDOptions.action</link>. 
```

<br />

Correct method already declared in method attribute of action tag

comments: author: Titus
body: Hi Alexey,

this worked pretty well. Thanks a lot. I probably should not be concerned whether my approach works in Confluence but not in Bamboo while both are using XWork actions.

But anyway after ficxing this problem Bamboo could not find the templates:

```
[INFO] [talledLocalContainer] 2018-02-05 18:51:16,446 INFO [http-nio-6990-exec-2] [VelocityManager] Initializing velocity using velocity.properties from classloader
[INFO] [talledLocalContainer] 2018-02-05 18:51:16,614 ERROR [http-nio-6990-exec-2] [VelocityResult] Unable to render velocity template: '/templates/secsignid-options-and-users-page.vm'
[INFO] [talledLocalContainer] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/templates/secsignid-options-and-users-page.vm'
[INFO] [talledLocalContainer] ?? ?at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:458)
[INFO] [talledLocalContainer] ?? ?at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:341)
[INFO] [talledLocalContainer] ?? ?at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:831)
```

But I already started to shift everything from xwork actions to servlets which solved my problem as well. Except that it is not as convenient as xwork actions.

Cheers


Tags: bamboo-development

development

xwork