Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Error: Module did not self-register.' with Worker Threads #224

Open
davideutsch opened this issue Sep 14, 2021 · 1 comment
Open

'Error: Module did not self-register.' with Worker Threads #224

davideutsch opened this issue Sep 14, 2021 · 1 comment

Comments

@davideutsch
Copy link

davideutsch commented Sep 14, 2021

When I try to use the jdbc or jinst library in multiple threads, I get Error: Module did not self-register. exception.

Reproduction steps

import { isMainThread, Worker } from 'worker_threads';

if (isMainThread) {
  require('jdbc/lib/jinst'); 
  require('jdbc/lib/pool'); 
  new Worker(__filename);
} else {
  require('jdbc/lib/jinst'); // throws: `Error: Module did not self-register.` 
  require('jdbc/lib/pool'); // throws: `Error: Module did not self-register.` 
}

Environment

  • Node version: 12.18.1
  • Typescript: 3.6.4
  • JDBC: 0.7.5

Full Stack Trace

Error: Module did not self-register: '\\?\C:\projectFolder\node_modules\java\builde\Release\nodejavabridge_bindings.node' 
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1188:18)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\projectFolder\node_modules\java\lib\nodeJavaBridge.js:21:16)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (C:\projectFolder\node_modules\source-map-support\source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32) 
@tonioss22
Copy link

This is an issue with node-java, node-java needs to be converted to be context aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants