NameAlreadyBoundException

13 views
Skip to first unread message

a.re...@web.de

unread,
Jul 31, 2008, 9:17:35 AM7/31/08
to osjava
version simple-jndi-0.11.3

jndi.propertis:
--------------------------------------------------------------
java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
org.osjava.sj.root=/tmp/foo
org.osjava.sj.colon.replace=--
org.osjava.sj.delimiter=/
org.osjava.sj.jndi.shared=false
--------------------------------------------------------------

invoking the contructor new InitialContext()
leads to this exception:

javax.naming.NameAlreadyBoundException: Name
java.naming.factory.initial
already bound. Use rebind() to override
at org.osjava.sj.jndi.AbstractContext.bind(AbstractContext.java:
327)
at org.osjava.sj.jndi.AbstractContext.bind(AbstractContext.java:
342)
at org.osjava.sj.loader.JndiLoader.jndiPut(JndiLoader.java:321)
at org.osjava.sj.loader.JndiLoader.load(JndiLoader.java:266)
at
org.osjava.sj.loader.JndiLoader.loadDirectory(JndiLoader.java:156)
at
org.osjava.sj.loader.JndiLoader.loadDirectory(JndiLoader.java:104)
at org.osjava.sj.SimpleContext.<init>(SimpleContext.java:98)
at
org.osjava.sj.SimpleContextFactory.getInitialContext(SimpleContextFactory.java:
69)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
667)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
...

os: Linux dev002 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC
2006
x86_64 x86_64 x86_64 GNU/Linux


java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)

the exception is thrown for the first time invoking the constructor
there is no need to invoke it twice

Henri Yandell

unread,
Jul 31, 2008, 3:49:58 PM7/31/08
to osj...@googlegroups.com
(note, I answered private email on this and think it might be due to
jndi.properties being in /tmp/foo)

andiger@, please answer on this thread if possible rather than the private one.

Hen

a.re...@web.de

unread,
Aug 1, 2008, 4:09:28 AM8/1/08
to osjava
hi folks
hi Henri
thanks a lot for the response!
actually you are right, the jndi.properties file is inside /tmp/foo
- and /tmp/foo is the working dirrectory, where I start the
application
- and the /tmp/foo is inside the class path (of course must be for
jndi.properties beeing in the class path)
- and org.osjava.sj.root=/tmp/foo
all this was just for a "hello world" test, quick and dirty...

now i have separated all this things, and it seems to work!!! great!!!
thank you
Reply all
Reply to author
Forward
0 new messages