You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jeromy Evans (JIRA)" <ji...@apache.org> on 2008/02/24 05:53:07 UTC

[jira] Created: (WW-2506) ControllerClasspathPackageProvider causes duplicate package error

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.


[jira] Resolved: (WW-2506) ControllerClasspathPackageProvider causes duplicate package error

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2506.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

Ok, what I did was add a new configuration option to the codebehind plugin, "struts.configuration.classpath.disableActionScanning", which allows you to disable its classpath scanning.  I also added the setting, "struts.configuration.rest.disableControllerScanning", to the REST Plugin.  The REST plugin now disables the scanning by the codebehind plugin, but of course, you can re-enable it by changing the codebehind setting above.  The docs are updated as well.

> 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
>            Assignee: Don Brown
>
> 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.


[jira] Updated: (WW-2506) ControllerClasspathPackageProvider causes duplicate package error

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2506:
--------------------------

    Fix Version/s: 2.1.2

> 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
>            Assignee: Don Brown
>             Fix For: 2.1.2
>
>
> 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.


[jira] Commented: (WW-2506) ControllerClasspathPackageProvider causes duplicate package error

Posted by "Scott Nedderman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43526#action_43526 ] 

Scott Nedderman commented on WW-2506:
-------------------------------------

A possible fix to this problem is to copy the ActionSupport class to DefaultSupport, rename the classname and remove the Action interface with it's associated methods.

Next, have ActionSupport extend DefaultSupport and implement Action and its methods.

This, at least, solved my problem where I'm using the restful plugin and needed TextProvider and ValidationAware as well.



> 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.


[jira] Commented: (WW-2506) ControllerClasspathPackageProvider causes duplicate package error

Posted by "Sarat Pediredla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43412#action_43412 ] 

Sarat Pediredla commented on WW-2506:
-------------------------------------

We actually have an app that is being built using 2.1.1-SNAPSHOT and I reckon the second path would be good from our perspective too. 

Could it not happen (excuse my meagre Struts 2 knowledge) that the ControllerClasspathPackageProvider check if the parent package has already been configured by Codebehind and skip it or else configure it?

> 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.