java.lang.NoSuchMethodException: Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile

Atlassian JIRA | Damian Nowak | 5 years ago
  1. 0

    atlassian-plugin.xml {noformat} <xwork name="Custom Attach" key="custom-attach"> <description>Provides custom attach file action that works with Crowd's SSO.</description> <package name="custom-attach" extends="default" namespace="/screensnipe-custom-attach"> <default-interceptor-ref name="validatingStack"/> <action name="attach-file" class="com.screensnipe.confluence.atlassian.CustomAttachFile"> <result name="input" type="json"/> <result name="json" type="json"/> <result name="error" type="json"/> <result name="notpermitted" type="json"/> </action> </package> </xwork> {noformat} The exception: {noformat} java.lang.NoSuchMethodException: Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:115) at com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:78) at com.atlassian.confluence.xwork.ConfluenceXsrfTokenInterceptor.intercept(ConfluenceXsrfTokenInterceptor.java:25) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.security.interceptors.CaptchaInterceptor.intercept(CaptchaInterceptor.java:46) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.util.LoggingContextInterceptor.intercept(LoggingContextInterceptor.java:49) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.core.CancellingInterceptor.intercept(CancellingInterceptor.java:23) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) {noformat} Actually, there should be "caused by" but you didn't chain the exception. ActionConfig, line 114-115: catch (Exception e) { throw new NoSuchMethodException("Unable to load action: " + e.getMessage()); (lost cause) {noformat} [INFO] [talledLocalContainer] java.lang.InstantiationException: com.screensnipe.confluence.atlassian.CustomAttachFile [INFO] [talledLocalContainer] at java.lang.Class.newInstance0(Class.java:340) [INFO] [talledLocalContainer] at java.lang.Class.newInstance(Class.java:308) [INFO] [talledLocalContainer] at com.opensymphony.xwork.ObjectFactory.buildBean(ObjectFactory.java:97) [INFO] [talledLocalContainer] at com.opensymphony.xwork.ObjectFactory.buildAction(ObjectFactory.java:77) [INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.ConfluencePluginObjectFactory.buildAction(ConfluencePluginObjectFactory.java:60) [INFO] [talledLocalContainer] at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:112) {noformat} See CONF-20055 - it's *just the same* problem with another interceptor. XSRF Interceptor needs to instantiate action just to check the annotations. It does it by calling Class.newInstance(). In our company, we use constructor-based injection. For details, see CONF-20055.

    Atlassian JIRA | 5 years ago | Damian Nowak
    java.lang.NoSuchMethodException: Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile
  2. 0

    atlassian-plugin.xml {noformat} <xwork name="Custom Attach" key="custom-attach"> <description>Provides custom attach file action that works with Crowd's SSO.</description> <package name="custom-attach" extends="default" namespace="/screensnipe-custom-attach"> <default-interceptor-ref name="validatingStack"/> <action name="attach-file" class="com.screensnipe.confluence.atlassian.CustomAttachFile"> <result name="input" type="json"/> <result name="json" type="json"/> <result name="error" type="json"/> <result name="notpermitted" type="json"/> </action> </package> </xwork> {noformat} The exception: {noformat} java.lang.NoSuchMethodException: Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:115) at com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:78) at com.atlassian.confluence.xwork.ConfluenceXsrfTokenInterceptor.intercept(ConfluenceXsrfTokenInterceptor.java:25) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.security.interceptors.CaptchaInterceptor.intercept(CaptchaInterceptor.java:46) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.util.LoggingContextInterceptor.intercept(LoggingContextInterceptor.java:49) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.atlassian.confluence.core.CancellingInterceptor.intercept(CancellingInterceptor.java:23) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) {noformat} Actually, there should be "caused by" but you didn't chain the exception. ActionConfig, line 114-115: catch (Exception e) { throw new NoSuchMethodException("Unable to load action: " + e.getMessage()); (lost cause) {noformat} [INFO] [talledLocalContainer] java.lang.InstantiationException: com.screensnipe.confluence.atlassian.CustomAttachFile [INFO] [talledLocalContainer] at java.lang.Class.newInstance0(Class.java:340) [INFO] [talledLocalContainer] at java.lang.Class.newInstance(Class.java:308) [INFO] [talledLocalContainer] at com.opensymphony.xwork.ObjectFactory.buildBean(ObjectFactory.java:97) [INFO] [talledLocalContainer] at com.opensymphony.xwork.ObjectFactory.buildAction(ObjectFactory.java:77) [INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.ConfluencePluginObjectFactory.buildAction(ConfluencePluginObjectFactory.java:60) [INFO] [talledLocalContainer] at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:112) {noformat} See CONF-20055 - it's *just the same* problem with another interceptor. XSRF Interceptor needs to instantiate action just to check the annotations. It does it by calling Class.newInstance(). In our company, we use constructor-based injection. For details, see CONF-20055.

    Atlassian JIRA | 5 years ago | Damian Nowak
    java.lang.NoSuchMethodException: Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile
  3. 0

    Steps to reproduce: 1. Upload [^test-admin-action-plugin-1.0-SNAPSHOT.jar] into Confluence 3.3-beta2. 2. Ensure web sudo is enabled. 3. Go to the test page, e.g. http://localhost:8080/confluence/admin/test/test.action 4. You get the following exception: {noformat} java.lang.NoSuchMethodException: Unable to load action: com.atlassian.confluence.plugin.test.TestAction at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:115) at com.atlassian.confluence.security.websudo.WebSudoInterceptor.intercept(WebSudoInterceptor.java:49) {noformat} 5. Disable web sudo. 6. Go to the test page, e.g. http://localhost:8080/confluence/admin/test/test.action 7. The action works if web sudo is disabled. I'm rating this as critical because it's a regression which will affect many Adaptavist plugins (the bug was discovered by Dan Hardiker). We've been recommending them to use constructor injection for a few years now, so this is a serious problem for them. ----- h5. Technical notes If you debug this, you see an InstantiationException like this: {noformat} java.lang.InstantiationException: com.atlassian.confluence.plugin.test.TestAction at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) at com.opensymphony.xwork.ObjectFactory.buildBean(ObjectFactory.java:97) at com.opensymphony.xwork.ObjectFactory.buildAction(ObjectFactory.java:77) at com.atlassian.confluence.plugin.ConfluencePluginObjectFactory.buildAction(ConfluencePluginObjectFactory.java:60) {noformat} Some code in the WebSudoInterceptor actually results in a new (non-PluginAware) ActionConfig being instantiated by XWork, where the plugin classloader is not used to find the plugin class or autowire it properly. {code:java} if (!getWebSudoManager().matches(requestURI, actionInvocation.getAction().getClass(), actionInvocation.getProxy().getConfig().getMethod())) return actionInvocation.invoke(); {code} Here is the implementation of getMethod() from ActionConfig which is called above: {code:java} try { ActionConfig actionConfig = new ActionConfig(null, getClassName(), null, null, null); Action action = ObjectFactory.getObjectFactory().buildAction(actionConfig); clazz = action.getClass(); } catch (Exception e) { // TODO: Only doing this because buildAction() throws Exception throw new NoSuchMethodException("Unable to load action: " + e.getMessage()); } {code} Notice that a new ActionConfig is created here and passed to ConfluencePluginObjectFactory.buildAction(). When this method is called with a non-PluginAware ActionConfig, XWork ends up calling Class.newInstance() which only works for actions which don't use constructor injection. *We need to change the WebSudoInterceptor to use a way of finding the Method that doesn't construct a new ActionConfig object.* At this late stage in the release, I think a good start would be copying the mechanism from ActionConfig into the WebSudoInterceptor and use getMethodName() without loading the class this way.

    Atlassian JIRA | 6 years ago | Matt Ryall
    java.lang.NoSuchMethodException: Unable to load action: com.atlassian.confluence.plugin.test.TestAction
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Steps to reproduce: 1. Upload [^test-admin-action-plugin-1.0-SNAPSHOT.jar] into Confluence 3.3-beta2. 2. Ensure web sudo is enabled. 3. Go to the test page, e.g. http://localhost:8080/confluence/admin/test/test.action 4. You get the following exception: {noformat} java.lang.NoSuchMethodException: Unable to load action: com.atlassian.confluence.plugin.test.TestAction at com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:115) at com.atlassian.confluence.security.websudo.WebSudoInterceptor.intercept(WebSudoInterceptor.java:49) {noformat} 5. Disable web sudo. 6. Go to the test page, e.g. http://localhost:8080/confluence/admin/test/test.action 7. The action works if web sudo is disabled. I'm rating this as critical because it's a regression which will affect many Adaptavist plugins (the bug was discovered by Dan Hardiker). We've been recommending them to use constructor injection for a few years now, so this is a serious problem for them. ----- h5. Technical notes If you debug this, you see an InstantiationException like this: {noformat} java.lang.InstantiationException: com.atlassian.confluence.plugin.test.TestAction at java.lang.Class.newInstance0(Class.java:340) at java.lang.Class.newInstance(Class.java:308) at com.opensymphony.xwork.ObjectFactory.buildBean(ObjectFactory.java:97) at com.opensymphony.xwork.ObjectFactory.buildAction(ObjectFactory.java:77) at com.atlassian.confluence.plugin.ConfluencePluginObjectFactory.buildAction(ConfluencePluginObjectFactory.java:60) {noformat} Some code in the WebSudoInterceptor actually results in a new (non-PluginAware) ActionConfig being instantiated by XWork, where the plugin classloader is not used to find the plugin class or autowire it properly. {code:java} if (!getWebSudoManager().matches(requestURI, actionInvocation.getAction().getClass(), actionInvocation.getProxy().getConfig().getMethod())) return actionInvocation.invoke(); {code} Here is the implementation of getMethod() from ActionConfig which is called above: {code:java} try { ActionConfig actionConfig = new ActionConfig(null, getClassName(), null, null, null); Action action = ObjectFactory.getObjectFactory().buildAction(actionConfig); clazz = action.getClass(); } catch (Exception e) { // TODO: Only doing this because buildAction() throws Exception throw new NoSuchMethodException("Unable to load action: " + e.getMessage()); } {code} Notice that a new ActionConfig is created here and passed to ConfluencePluginObjectFactory.buildAction(). When this method is called with a non-PluginAware ActionConfig, XWork ends up calling Class.newInstance() which only works for actions which don't use constructor injection. *We need to change the WebSudoInterceptor to use a way of finding the Method that doesn't construct a new ActionConfig object.* At this late stage in the release, I think a good start would be copying the mechanism from ActionConfig into the WebSudoInterceptor and use getMethodName() without loading the class this way.

    Atlassian JIRA | 6 years ago | Matt Ryall
    java.lang.NoSuchMethodException: Unable to load action: com.atlassian.confluence.plugin.test.TestAction
  6. 0

    An mwl-item created by HL7 ORM message is not displayed in MWL-console (webinterface). Error is thrown when query for mwl-entry in mwl-console: {noformat} ERROR -> (http-10.231.162.191-8080-6) [org.dcm4chex.archive.web.maverick.mwl.MWLScuDelegate] Exception occured in findMWLEntries: null javax.management.ReflectionException at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:228) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.dcm4chex.archive.web.maverick.mwl.MWLScuDelegate.findMWLEntries(MWLScuDelegate.java:111) at org.dcm4chex.archive.web.maverick.mwl.model.MWLModel.filterWorkList(MWLModel.java:265) at org.dcm4chex.archive.web.maverick.mwl.model.MWLModel.getModel(MWLModel.java:125) at org.dcm4chex.archive.web.maverick.mwl.MWLConsoleCtrl.makeFormBean(MWLConsoleCtrl.java:79) at org.dcm4chex.archive.web.maverick.Dcm4cheeFormController.go(Dcm4cheeFormController.java:122) at org.infohazard.maverick.ctl.Throwaway2.go(Throwaway2.java:47) at org.infohazard.maverick.flow.ThrowawayControllerAdapter.go(ThrowawayControllerAdapter.java:54) at org.infohazard.maverick.flow.CommandBase.go(CommandBase.java:66) at org.infohazard.maverick.Dispatcher.service(Dispatcher.java:345) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.NoSuchMethodException: Unable to find operation findMWLEntries(org.dcm4che.data.Dataset,java.util.List) ... 32 more {noformat}

    JIRA | 6 years ago | Simon Schlosser
    javax.management.ReflectionException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoSuchMethodException

      Unable to load action: com.screensnipe.confluence.atlassian.CustomAttachFile

      at com.opensymphony.xwork.config.entities.ActionConfig.getMethod()
    2. com.opensymphony.xwork
      ActionConfig.getMethod
      1. com.opensymphony.xwork.config.entities.ActionConfig.getMethod(ActionConfig.java:115)
      1 frame
    3. com.atlassian.xwork
      XsrfTokenInterceptor.intercept
      1. com.atlassian.xwork.interceptors.XsrfTokenInterceptor.intercept(XsrfTokenInterceptor.java:78)
      1 frame
    4. com.atlassian.confluence
      ConfluenceXsrfTokenInterceptor.intercept
      1. com.atlassian.confluence.xwork.ConfluenceXsrfTokenInterceptor.intercept(ConfluenceXsrfTokenInterceptor.java:25)
      1 frame
    5. XWork Tiger Extensions
      DefaultActionInvocation.invoke
      1. com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      1 frame
    6. com.atlassian.confluence
      CaptchaInterceptor.intercept
      1. com.atlassian.confluence.security.interceptors.CaptchaInterceptor.intercept(CaptchaInterceptor.java:46)
      1 frame
    7. XWork Tiger Extensions
      DefaultActionInvocation.invoke
      1. com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      1 frame
    8. com.opensymphony.xwork
      AroundInterceptor.intercept
      1. com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
      1 frame
    9. XWork Tiger Extensions
      DefaultActionInvocation.invoke
      1. com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      1 frame
    10. com.atlassian.confluence
      LoggingContextInterceptor.intercept
      1. com.atlassian.confluence.util.LoggingContextInterceptor.intercept(LoggingContextInterceptor.java:49)
      1 frame
    11. XWork Tiger Extensions
      DefaultActionInvocation.invoke
      1. com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      1 frame
    12. com.atlassian.confluence
      CancellingInterceptor.intercept
      1. com.atlassian.confluence.core.CancellingInterceptor.intercept(CancellingInterceptor.java:23)
      1 frame
    13. XWork Tiger Extensions
      DefaultActionInvocation.invoke
      1. com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165)
      1 frame