[jboss-user] [JNDI and Naming] - javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

jashan07 do-not-reply at jboss.com
Wed Jul 24 09:10:05 EDT 2013


jashan07 [https://community.jboss.org/people/jashan07] created the discussion

"javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]"

To view the discussion, visit: https://community.jboss.org/message/829512#829512

--------------------------------------------------------------
Hi,

I am trying to run my application on 6.0.1 EAP and m getting the following error: 


javax.naming.NoInitialContextException

 Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException


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.
Can any one help me to get out of this problem?
my BookClient code: 

*public* *class* BookClient {
*public static void* *main(String z[]) {*


*try* *{*
*int* *choice = 1;**Properties p =* 
*new* *Properties();**p.put(Context.*
++*INITIAL_CONTEXT_FACTORY*++*,*
*"org.jnp.interfaces.NamingContextFactory"**);**p.put(Context.*
++*URL_PKG_PREFIXES*++*,*
*"org.jboss.naming:org.jnp.interfaces"**);**p.put(Context.*
++*PROVIDER_URL*++*, "localhost:4447"**);**InitialContext ctx =* 
*new* *InitialContext(p);*
*BookHome home = (BookHome) ctx.lookup(*
*"BK"**);*
*Book bean = home.create();*
*Scanner sc =* 
*new Scanner(System.+*+in+*+**);*
*while* *(choice != 2) {**String bname;*
*System.*
++*out*++*.println("Enter choice 1. Add 2. Over"**);**choice = sc.nextInt();*

*if* *(choice == 1) {**System.*
++*out*++*.println("Enter book name"**);**bname = sc.next();*
*bean.addBook(bname);*
*}* 
*else if* *(choice == 2) {*
*break**;**}*
*}*

*Vector v = bean.getBooks();*

*System.*
++*out*++*.println("Size of vector \t"* *+ v.size());*
*for (int* *i = 0; i < v.size(); ++i) {**System.*
++*out*++*.println((String) v.elementAt(i));**}*

*}* 
*catch* *(Exception e) {**System.*
++*out*++*.println(e);**}*
*}*



*where is the error or which jar file i need to add or modification i need to do?*

*Thanks,*
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/829512#829512]

Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130724/1adba574/attachment.html 


More information about the jboss-user mailing list