File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes NoInitialContextException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "NoInitialContextException" Watch "NoInitialContextException" New topic


amit daundkar
Ranch Hand

Joined: Jan 24, 2009
Posts: 47
hello friends,
i am trying to configure DataSource with JBoss5.
i have a placed the connector jar file in the lib directory and the datasource file in the deploy directory.which is like-

but i get a NoInitialContextException. the code is-

the exception i get is-

please guide me regarding the env variable. which class name is to be specified in this variable and how can i do it?
this may be sounding a dumb question but please reply.

thank you.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 544

This will get you the InitialContext to lookup the JNDI object if and only if the Java Class that has this line of code deployed onto the Application server.

This will not work without supplying the InitialContextFactory and Provider URL ( Please check JBoss specific parameters and their values) if you have this line of code in a Java class that is running outside Server JVM.

amit daundkar
Ranch Hand

Joined: Jan 24, 2009
Posts: 47
hello Amit,
thank you for the reply.
am i supposed to specify this class name in the environment variable inside the DataSource descriptor(mysql-ds.xml) file?
actually i am doing this for the first time.
as you can see, i have given the JNDI name as MySqlDS.
so what i dont understand is in the code-
what is this env variable. or shall i code it simply as-

please reply.
please give me an example if possible.
sorry to bother,
thank you again.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

See this

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: NoInitialContextException
jQuery in Action, 3rd edition