facebook

EJB client exception javax.naming.NoInitialContextException

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #286845 Reply

    shayan672
    Member

    i am new to ejbs. read the tutorial “http://www.myeclipseide.com/documentation/quickstarts/ejb3/” for having a start on ejbs 3.0. i am using Application server “jboss-4.2.2.GA” and myeclipse ide “MyEclipse_5.5.1GA”.
    i have created the session bean and deployed it successfully. but now when i run the client, i get the following exception

    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at com.myeclipseide.ejb3.MyBeanClient.main(MyBeanClient.java:16)

    can anyone tell the reason for this exception and what to do in order to slve this problem. if the answer can be please in detail. thanks

    #286849

    Loyal Water
    Member

    Can you paste the entire error here for me. Could you cross post this query on the ejb forums as well.

    Can you go to MyEclipse > Installation Summary > Installation Details and paste the information here for me.

    #286850

    Loyal Water
    Member

    You can go through this as well:-
    http://forum.java.sun.com/thread.jspa?threadID=5012497

    #286989

    shayan672
    Member

    its the entire error that i have pasted already here. i face this error onlywhen ever i try to run the ejb client.

    #287030

    shayan672:
    This is the error you get from JBoss when you omit the jndi.properties file (right under src). This file should contain the following entries:

    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

    Cheers,
    Jean-Michel

    #287125

    shayan672
    Member

    well, after adding the jndi.properties file under the src, now i get the following exception

    javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory ]
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at com.myeclipseide.ejb3.MyBeanClient.main(MyBeanClient.java:17)
    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    … 5 more

    ?????????????

    #287139

    Loyal Water
    Member

    shayan672,
    There is a user who has listed out the jars that need to be present to overcome this error. Can you make sure your not missing any of these jars:-
    http://www.jboss.com/?module=bb&op=viewtopic&t=57223

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: EJB client exception javax.naming.NoInitialContextException

You must be logged in to post in the forum log in