Could anyone help me out in fixing the above mentioned exception in my AdviceBean application? Please find below the exception details:
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 AdviceClient.go(AdviceClient.java:31) at AdviceClient.main(AdviceClient.java:18)
I got this exception when i tried to run the client. Pl find below the client code:
I did try without passing the system properties to InitialContext and I got the same exception. I thought by passing environment properties , it would create initial context factory . But, it didn't help me either. I have deployed enterprise bean(AdviceBean ) in Sun Application Server 8. Deployment was successful ...but couldnt run the client.
Thanks for your response. Well, you know I'm using Sun Application Server 8. I guess the Context.PROVIDER_URL and Context.INITIAL_CONTEXT_FACTORY will be different for this server. How do I find these properties for Sun application Server 8 ? Hope to hear from you soon.
I found the same thing, and added the stuff about the environment. That fixed that problem, but you'll see another post of mine because having found the previous posts describing this, I then found that I get an exception at runtime in the call to "narrow." I'm using the RI (AS8) too, so if you manage to make this work, please let me know as I'm beginning to believe it's impossible.
Hmm, why would I believe that? Well, I next moved to trying the "converter" application in the J2EE tutorial. This version is their own code, downloaded with the book, so I can't have got much wrong. I find that the app works from the web page, but that version trys to use the "appclient" command, and that command complains that the client jar (created by AS8 just moments before) is bad! What's with that? If I try to launch the application client by hand, I get the same problem with initial context that you describe.
You had your fun. Now it's time to go to jail. Thanks for your help tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss