How to load jndi bindings from a Storm bin?

We have a project that moves to use Storm, and therefore our code is much packed in a jar. Earlier we used com.sun.jndi.fscontext.RefFSContextFactory as our implementation of InitialContextFactory to load jndicontext bindings from the file system configuration directory in the class path (works fine). However, when we try to use this factory to load context from inside the jar, we get the following:

javax.naming.InvalidNameException: unknown protocol: jar at com.sun.jndi.fscontext.FScontextFactory.getFileNameFromURLSTring(FSContextFactory.java:139) at com.sun.jndi.fscontext.RefFSContextFactory.createContext(RefFSContextFactory.java:31) 

This is because the factory is trying to load the jdni context from the following URL:

"jar: file: /mount/storm-dir/data/storm.jar! / jndicontext"

This is a valid URL, but the factory does not understand how to open the jar. Is there an implementation of javax.naming.spi.InitialContextFactory that does? Also, is there a way around this problem and add a configuration directory to the Stpath classpath?

+6
source share

Source: https://habr.com/ru/post/951662/


All Articles