This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 512

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: 10067

See this

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: NoInitialContextException