<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/jashan07">jashan07</a> in <i>JNDI and Naming</i> - <a href="https://community.jboss.org/message/829512#829512">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am trying to run my application on 6.0.1 EAP and m getting the following error: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="color: #0066cc; font-size: 10pt; text-decoration: underline;"><span style="color: #0066cc; font-size: 10pt; text-decoration: underline;"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>javax.naming.NoInitialContextException</p></span></span><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;"><span style="text-decoration: underline;"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></span><span style="font-size: 10pt;"> Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is </span><span style="text-decoration: underline;"><span style="color: #0066cc; font-size: 10pt; text-decoration: underline;"><span style="color: #0066cc; font-size: 10pt; text-decoration: underline;">java.lang.ClassNotFoundException</span></span></span></span></span></span></span></span></span></p><p><span style="color: #0066cc; font-size: 10pt;"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I found from some forums that i have to add jbossall-client.jar file but jboss 6.0.1 doesnt contain any jar like this.</p><p>Can any one help me to get out of this problem?</p><p>my BookClient code: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>public</strong></span><span style="color: #000000; font-size: 10pt;"> </span><span style="color: #7f0055; font-size: 10pt;"><strong>class</strong></span><span style="font-size: 10pt;"><span style="color: #000000;"> BookClient {</span><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><strong><span style="color: #7f0055; font-size: 10pt;">public</span><span style="font-size: 10pt;"> </span><span style="color: #7f0055; font-size: 10pt;">static</span><span style="font-size: 10pt;"> </span><span style="color: #7f0055; font-size: 10pt;">void</span></strong><span style="font-size: 2;"><strong> main(String z[]) {</strong></span></span></p><span style="font-size: 10pt;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>try</strong></span><span style="font-size: 2;"><strong> {</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>int</strong></span><span style="font-size: 2;"><strong> choice = 1;</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>Properties p = </strong></p></span><span style="color: #7f0055; font-size: 10pt;"><strong>new</strong></span><span style="font-size: 2;"><strong> Properties();</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>p.put(Context.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>INITIAL_CONTEXT_FACTORY</strong></em></em><span style="font-size: 2;"><strong>,</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #2a00ff; font-size: 10pt;"><strong>"org.jnp.interfaces.NamingContextFactory"</strong></span><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>p.put(Context.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>URL_PKG_PREFIXES</strong></em></em><span style="font-size: 2;"><strong>,</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #2a00ff; font-size: 10pt;"><strong>"org.jboss.naming:org.jnp.interfaces"</strong></span><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>p.put(Context.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>PROVIDER_URL</strong></em></em><strong><span style="font-size: 10pt;">, </span><span style="color: #2a00ff; font-size: 10pt;">"localhost:4447"</span></strong><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>InitialContext ctx = </strong></p></span><span style="color: #7f0055; font-size: 10pt;"><strong>new</strong></span><span style="font-size: 2;"><strong> InitialContext(p);</strong></span></span><span style="font-size: 10pt;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><span style="font-size: 2;"><p align="left"><strong>BookHome home = (BookHome) ctx.lookup(</strong></p></span><span style="color: #2a00ff; font-size: 10pt;"><strong>"BK"</strong></span><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left"><strong>Book bean = home.create();</strong></p><span style="font-size: 2;"><p align="left"><strong>Scanner sc = </strong></p></span><strong><span style="color: #7f0055; font-size: 10pt;">new</span><span style="font-size: 10pt;"> Scanner(System.</span><em style="color: #0000c0; font-size: 10pt;"><strong><em style="color: #0000c0; font-size: 10pt;">in</em></strong></em></strong><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>while</strong></span><span style="font-size: 2;"><strong> (choice != 2) {</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>String bname;</strong></p><span style="font-size: 2;"><p align="left"><strong>System.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>out</strong></em></em><strong><span style="font-size: 10pt;">.println(</span><span style="color: #2a00ff; font-size: 10pt;">"Enter choice 1. Add 2. Over"</span></strong><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>choice = sc.nextInt();</strong></p><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>if</strong></span><span style="font-size: 2;"><strong> (choice == 1) {</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>System.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>out</strong></em></em><strong><span style="font-size: 10pt;">.println(</span><span style="color: #2a00ff; font-size: 10pt;">"Enter book name"</span></strong><span style="font-size: 2;"><strong>);</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>bname = sc.next();</strong></p><p align="left"><strong>bean.addBook(bname);</strong></p><span style="font-size: 2;"><p align="left"><strong>} </strong></p></span><strong><span style="color: #7f0055; font-size: 10pt;">else</span><span style="font-size: 10pt;"> </span><span style="color: #7f0055; font-size: 10pt;">if</span></strong><span style="font-size: 2;"><strong> (choice == 2) {</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><span style="color: #7f0055; font-size: 10pt;"><strong>break</strong></span><span style="font-size: 2;"><strong>;</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>}</strong></p><p align="left"><strong>}</strong></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left"><strong><span style="text-decoration: underline;">Vector</span> v = bean.getBooks();</strong></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><span style="font-size: 2;"><p align="left"><strong>System.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>out</strong></em></em><strong><span style="font-size: 10pt;">.println(</span><span style="color: #2a00ff; font-size: 10pt;">"Size of vector \t"</span></strong><span style="font-size: 2;"><strong> + v.size());</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span><strong><span style="color: #7f0055; font-size: 10pt;">for</span><span style="font-size: 10pt;"> (</span><span style="color: #7f0055; font-size: 10pt;">int</span></strong><span style="font-size: 2;"><strong> i = 0; i &lt; v.size(); ++i) {</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>System.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>out</strong></em></em><span style="font-size: 2;"><strong>.println((String) v.elementAt(i));</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>}</strong></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><span style="font-size: 2;"><p align="left"><strong>} </strong></p></span><span style="color: #7f0055; font-size: 10pt;"><strong>catch</strong></span><span style="font-size: 2;"><strong> (Exception e) {</strong></span></span><span style="font-size: 10pt;"><span style="font-size: 2;"><p align="left"><strong>System.</strong></p></span><em style="color: #0000c0; font-size: 10pt;"><em style="color: #0000c0; font-size: 10pt;"><strong>out</strong></em></em><span style="font-size: 2;"><strong>.println(e);</strong></span></span><span style="font-size: 10pt;"><p align="left"><strong>}</strong></p><p align="left"><strong>}</strong></p><span style="font-size: 2;"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></span></span><p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left"><strong>where is the error or which jar file i need to add or modification i need to do?</strong></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left"><strong>Thanks,</strong></p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p align="left" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/829512#829512">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JNDI and Naming at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>