{"record":{"id":"8e734126c82f3440","repo":"apache/skywalking","slug":"create-stream-builder-getsimplename-record-d","errorCode":null,"errorMessage":"Create {stream.builder().getSimpleName()} record DAO failure.","messagePattern":"Create (.+?) record DAO failure\\.","errorType":"exception","errorClass":"UnexpectedException","httpStatus":null,"severity":"critical","filePath":"oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/RecordStreamProcessor.java","lineNumber":91,"sourceCode":"        }\n        RecordPersistentWorker worker = workers.get(record.getClass());\n        if (worker != null) {\n            worker.in(record);\n        }\n    }\n\n    public void create(ModuleDefineHolder moduleDefineHolder, Stream stream, Class<? extends Record> recordClass) throws StorageException {\n        final StorageBuilderFactory storageBuilderFactory = moduleDefineHolder.find(StorageModule.NAME)\n                                                                              .provider()\n                                                                              .getService(StorageBuilderFactory.class);\n        final Class<? extends StorageBuilder> builder = storageBuilderFactory.builderOf(recordClass, stream.builder());\n\n        StorageDAO storageDAO = moduleDefineHolder.find(StorageModule.NAME).provider().getService(StorageDAO.class);\n        IRecordDAO recordDAO;\n        try {\n            recordDAO = storageDAO.newRecordDao(builder.getDeclaredConstructor().newInstance());\n        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {\n            throw new UnexpectedException(\"Create \" + stream.builder().getSimpleName() + \" record DAO failure.\", e);\n        }\n\n        ModelRegistry modelSetter = moduleDefineHolder.find(CoreModule.NAME).provider().getService(ModelRegistry.class);\n        // Record stream doesn't read data from database during the persistent process. Keep the timeRelativeID == false always.\n        Model model = modelSetter.add(\n            recordClass, stream.scopeId(),\n            new Storage(stream.name(), false, DownSampling.Second),\n            StorageManipulationOpt.schemaCreateIfAbsent());\n        ExportRecordWorker exportWorker = new ExportRecordWorker(moduleDefineHolder);\n        RecordPersistentWorker persistentWorker = new RecordPersistentWorker(moduleDefineHolder, model, recordDAO, exportWorker);\n\n        workers.put(recordClass, persistentWorker);\n    }\n}\n","sourceCodeStart":73,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/RecordStreamProcessor.java#L73-L106","documentation":"RecordStreamProcessor.create() reflectively constructs the StorageBuilder for a @Stream Record class (trace segments, alarms, logs...) and obtains an IRecordDAO from the storage plugin. Any reflective instantiation failure is wrapped in this UnexpectedException, which names the failing builder class and aborts startup.","triggerScenarios":"A custom Record class's builder lacks a public no-arg constructor or is abstract; the builder constructor throws; a third-party storage plugin jar built against a different OAP API cannot be instantiated.","commonSituations":"Adding custom record types via plugins; storage plugin version drift after a partial OAP upgrade; fat-jar shading or Java module restrictions blocking reflective access.","solutions":["Decode the cause (NoSuchMethodException/InstantiationException/InvocationTargetException) and fix the builder class accordingly — usually add `public Builder() {}`","Confirm the @Stream(builder=...) value names a public concrete StorageBuilder implementation","Rebuild everything with 'mvnw clean install' and remove old plugin jars from the deployed oap-libs directory"],"exampleFix":"// before\npublic static class RecordBuilder implements StorageBuilder {\n    public RecordBuilder(String config) {}\n}\n// after\npublic static class RecordBuilder implements StorageBuilder {\n    public RecordBuilder() {}\n}","handlingStrategy":"try-catch","validationCode":"// assert the builder is reflectively constructible before packaging\nassertNotNull(MyRecord.Builder.class.getDeclaredConstructor());\nassertFalse(Modifier.isAbstract(MyRecord.Builder.class.getModifiers()));","typeGuard":null,"tryCatchPattern":"Startup failure — do not catch in production; catch UnexpectedException in plugin integration tests and assert on the underlying reflection cause.","preventionTips":["Model custom Record builders on existing ones (e.g. SegmentRecord.Builder) including the public no-arg constructor","Add a boot-smoke integration test for every custom stream","Keep plugin compilation target and server-core dependency versions in lockstep"],"tags":["stream-processor","storage","reflection","startup","record","plugin"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}