{"record":{"id":"f1af8e95825c064a","repo":"Netflix/Hystrix","slug":"couldn-t-invoke-threadmanager-currentrequestthread","errorCode":null,"errorMessage":"Couldn't invoke ThreadManager.currentRequestThreadFactory","messagePattern":"Couldn't invoke ThreadManager\\.currentRequestThreadFactory","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hystrix-core/src/main/java/com/netflix/hystrix/util/PlatformSpecific.java","lineNumber":82,"sourceCode":"        } catch (InvocationTargetException e) {\n            // If ApiProxy throws an exception, we're not in a proper AppEngine environment.\n            return Platform.STANDARD;\n        } catch (IllegalAccessException e) {\n            // If the method isn't accessible, we're not on a supported version of AppEngine;\n            return Platform.STANDARD;\n        } catch (NoSuchMethodException e) {\n            // If the method doesn't exist, we're not on a supported version of AppEngine;\n            return Platform.STANDARD;\n        }\n    }\n\n    public static ThreadFactory getAppEngineThreadFactory() {\n        try {\n            return (ThreadFactory) Class.forName(\"com.google.appengine.api.ThreadManager\")\n                    .getMethod(\"currentRequestThreadFactory\")\n                    .invoke(null);\n        } catch (IllegalAccessException e) {\n            throw new RuntimeException(\"Couldn't invoke ThreadManager.currentRequestThreadFactory\", e);\n        } catch (ClassNotFoundException e) {\n            throw new RuntimeException(\"Couldn't invoke ThreadManager.currentRequestThreadFactory\", e);\n        } catch (NoSuchMethodException e) {\n            throw new RuntimeException(\"Couldn't invoke ThreadManager.currentRequestThreadFactory\", e);\n        } catch (InvocationTargetException e) {\n            throw new RuntimeException(e.getCause());\n        }\n    }\n}\n","sourceCodeStart":64,"sourceCodeEnd":92,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-core/src/main/java/com/netflix/hystrix/util/PlatformSpecific.java#L64-L92","documentation":"PlatformSpecific.getAppEngineThreadFactory reflectively loads com.google.appengine.api.ThreadManager and invokes currentRequestThreadFactory() to build threads on Google App Engine. An IllegalAccessException from the reflection call - the method or class is not accessible under the current security/classloader rules - is rethrown as this RuntimeException.","triggerScenarios":"Running with isAppEngine() detection returning true (AppEngine classes present) while the security manager or classloader blocks reflective access to ThreadManager.currentRequestThreadFactory(); partially loaded AppEngine API jars on a non-AppEngine runtime.","commonSituations":"AppEngine API jar on the classpath of a regular servlet container, confusing platform detection; restrictive SecurityManager policies denying reflective access; running Hystrix unit tests with an AppEngine SDK stub.","solutions":["If not actually on AppEngine, remove or scope the com.google.appengine dependency so PlatformSpecific.isAppEngine() returns false.","On AppEngine, ensure the runtime's ThreadManager API is accessible (do not override the security policy that blocks it).","Avoid calling getAppEngineThreadFactory() directly; let Hystrix pick the platform automatically."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    ThreadFactory f = PlatformSpecific.getAppEngineThreadFactory();\n} catch (RuntimeException e) {\n    ThreadFactory f = Executors.defaultThreadFactory(); // fall back off AppEngine\n}","preventionTips":["Only use the AppEngine thread factory when PlatformSpecific.isAppEngine() is true.","Keep AppEngine API jars off non-AppEngine classpaths."],"tags":["hystrix","appengine","reflection","environment"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}