How to load jndi bindings from within a Storm jar?
Asked Answered
T

0

6

We have a project moving to use Storm and as such our code must be packaged in a jar. We had previously used com.sun.jndi.fscontext.RefFSContextFactory as our InitialContextFactory implementation to load the jndicontext bindings from a file in the system config directory in the classpath (worked fine). However when attempting to use this factory to load the context from within 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 due to the factory attempting to load jdni context from the following URL:

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

This is a valid URL yet the factory does not understand how to open a jar. Is there an implementation of javax.naming.spi.InitialContextFactory that does? Alternatively is there a way I could work around this issue and add a config directory to Storm's classpath?

Tune answered 13/8, 2013 at 16:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.