ControllerClasspathPackageProvider causes duplicate package error
-----------------------------------------------------------------
Key: WW-2506
URL: https://issues.apache.org/struts/browse/WW-2506
Project: Struts 2
Issue Type: Bug
Components: Plugin - REST
Affects Versions: 2.1.0
Reporter: Jeromy Evans
If a REST Controller (aka action) implements Action or is annotated with
@Action, the CodeBehind PackageProvider and the REST PackageProvider both
attempt to create the parent package. This results in a duplicate package
error while building the configuration:
...
Caused by: The package name 'mypackage.actions.parent' at location null is
already been used by another package at location null
The reason is that CodeBehind's ClasspathPackageProvider detects the action and
configures the parent package, and the ControllerClasspathPackageProvider
(re)detects the Controller and configures the parent package.
As it exists, this will be a common error as uses may tend to extend
ActionSupport to access ValidationAwareSupport and TextProviderSupport within a
Controller.
Possible resolutions:
- REST plugin does not configure Controllers that are also Actions; or
- REST plugin provides unique names for the parent packages it creates
(currently it uses the java package name)
I prefer the latter but aren't sure of the implications. The change would also
impact the CodeBehind.
I believe this only affects 2.1.1+ due to the strict configuration. It can be
replicated by changing the rest-showcase Controller to extend ActionSupport
rather than ValidationAwareSupport.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.