{"record":{"id":"d43cc56420ce2714","repo":"flowable/flowable-engine","slug":"from-bundle","errorCode":null,"errorMessage":" from bundle ","messagePattern":" from bundle ","errorType":"exception","errorClass":"ClassNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-osgi/src/main/java/org/flowable/osgi/blueprint/BundleDelegatingClassLoader.java","lineNumber":126,"sourceCode":"        if (urls == null) {\n            urls = Collections.enumeration(new ArrayList<>());\n        }\n\n        return urls;\n    }\n\n    @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n    @Override\n    protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {\n        Class clazz;\n        try {\n            clazz = findClass(name);\n        } catch (ClassNotFoundException cnfe) {\n            if (classLoader != null) {\n                try {\n                    clazz = classLoader.loadClass(name);\n                } catch (ClassNotFoundException e) {\n                    throw new ClassNotFoundException(name + \" from bundle \" + bundle.getBundleId() + \" (\" + bundle.getSymbolicName() + \")\", cnfe);\n                }\n            } else {\n                throw new ClassNotFoundException(name + \" from bundle \" + bundle.getBundleId() + \" (\" + bundle.getSymbolicName() + \")\", cnfe);\n            }\n        }\n        if (resolve) {\n            resolveClass(clazz);\n        }\n        return clazz;\n    }\n\n    public Bundle getBundle() {\n        return bundle;\n    }\n}\n","sourceCodeStart":108,"sourceCodeEnd":142,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-osgi/src/main/java/org/flowable/osgi/blueprint/BundleDelegatingClassLoader.java#L108-L142","documentation":"BundleDelegatingClassLoader.loadClass first tries the bundle's own classloader (findClass); if that fails it delegates to the wrapped parent classLoader. When both fail, it rethrows ClassNotFoundException('<name> from bundle <id> (<symbolicName>)') with the original as cause, pinpointing which OSGi bundle could not provide the class.","triggerScenarios":"Loading a class through BundleDelegatingClassLoader where neither the bundle nor its delegate classloader can resolve the class name — e.g. during script compilation or process behavior instantiation inside an OSGi container.","commonSituations":"Missing Import-Package/Require-Bundle for the needed class; dependency jar not deployed in the OSGi container; class exists in the container but the bundle does not import it; version mismatch where the class was moved to a different package.","solutions":["Add the required package to the bundle's Import-Package (or add the containing bundle via Require-Bundle)","Deploy the jar/bundle containing the missing class into the OSGi container","Check the symbolic name and bundle id in the message to identify which bundle needs fixing","Verify package versions in the manifest match the exported version of the providing bundle"],"exampleFix":"// before (MANIFEST.MF)\nImport-Package: com.google.common.base\n// after\nImport-Package: com.google.common.collect;version=\"[25.0,26)\"","handlingStrategy":"try-catch","validationCode":"// verify the class is resolvable before use\nClass<?> c;\ntry { c = bundle.loadClass(className); }\ncatch (ClassNotFoundException e) { throw new IllegalStateException(\"Missing import for \" + className + \" in bundle \" + bundle.getSymbolicName(), e); }","typeGuard":null,"tryCatchPattern":"try {\n    Class<?> clazz = delegatingLoader.loadClass(name);\n} catch (ClassNotFoundException e) {\n    // message format: \"<name> from bundle <id> (<symbolicName>)\"\n    logger.error(\"Class {} not found; add its package to Import-Package of bundle {}\", name, e.getMessage(), e);\n    throw e;\n}","preventionTips":["Use bnd/maven-bundle-plugin to compute Import-Package automatically and fail the build on unresolved imports","Keep the OSGi container's dependency bundles in sync with the application's compile classpath","Watch for package moves across dependency version upgrades"],"tags":["osgi","classloading","classpath"],"backgroundTag":"class-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}