Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-26275

Autowire error when a plugin webwork action class has same name as JIRA webwork action class

    XMLWordPrintable

Details

    Description

      When a plugin developer creates a webwork action with the same name as a JIRA webwork the autowiring fails.

      Here is a "DeleteWorklog" webwork that we have defined in our plugin:

          <webwork1 key="DeleteWorklogWebWork" name="Tempo Delete Worklog Action">
              <actions>
                  <action name="com.tempoplugin.worklog.action.DeleteWorklog" alias="TempoDeleteWorklog">
                     ...
                  </action>
              </actions>
          </webwork1>
      

      This works fine in our plugin and our alias works fine but when the user tries to use the standard "DeleteWorklog" action on the "Work Log" tab she gets this error:

      [INFO] [talledLocalContainer] 2011-11-16 10:20:12,003 http-2990-13 ERROR bjarnit 620x2957x1 blsvr7 10.41.105.159 /secure/DeleteWorklog!default.jspa [jira.config.webwork.JiraActionFactory] Error autowiring Action 'com.atlassian.jira.web.action.issue.DeleteWorklog'.
      [INFO] [talledLocalContainer] org.springframework.beans.factory.UnsatisfiedDependencyException: 
      Error creating bean with name 'com.atlassian.jira.web.action.issue.DeleteWorklog': 
      Unsatisfied dependency expressed through constructor argument with index 1 of type [com.atlassian.jira.bc.issue.comment.CommentService]: : 
      No unique bean of type [com.atlassian.jira.bc.issue.comment.CommentService] is defined: 
      Unsatisfied dependency of type [interface com.atlassian.jira.bc.issue.comment.CommentService]: expected at least 1 matching bean; 
      nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: 
      No unique bean of type [com.atlassian.jira.bc.issue.comment.CommentService] is defined: 
      Unsatisfied dependency of type [interface com.atlassian.jira.bc.issue.comment.CommentService]: expected at least 1 matching bean
      [INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:591)
      [INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193)
      [INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
      [INFO] [talledLocalContainer] 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
      

      Also note that we have seen similar behavior with resources. When two plugins installed at the same instance both define i18n.properties as the resource one resource seems to be overwritten by the other meaning that one plugin is not localized!

      The workaround that we are practicing is to simply prefix all webworks classes (like "TempoDeleteWorklog.java") but you can't expect every plugin vendor to do that!

      Best regards,

      -Bjarni, Tempo team

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              b61663ca5450 Bjarni Thorbjornsson
              Votes:
              30 Vote for this issue
              Watchers:
              32 Start watching this issue

              Dates

                Created:
                Updated: