Why can't I get an initial context in websphere!?!

I am using WebSphere App Dev v.4.0, and I have written a client application which should call methods from an EJB. But I don't seem to be able to get an initial context no matter what I do. Here is a snippet of the app code and the exception it throws: I will be most grateful if someone could help me out. Thanks Ben.
THE CODE...
try {          
    System.out.println("about to retrieve initial context.");   
    java.util.Properties p = new java.util.Properties();   
    p.put(Context.PROVIDER_URL, "iiop://localhost:901");   
    p.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");   
    InitialContext initContext = new InitialContext(p);
    System.out.println("initial context has been created.");     
}catch (Exception e) {        
    e.printStackTrace();
THE EXCEPTION...
about to retrieve initial context.
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:212)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at BeanClient.main(BeanClient.java:18)

Hi Ben,
As the gurus told in the earlier replies, it is the problem with Class loading.
Make Sure that following jar files are in CLASSPATH. (Assuming C:\Websphere is your websphere installation directory)
J2EE.jar - C:/Websphere/AppServer/lib/J2ee.jar
Websphere.jar - C:/Websphere/AppServer/lib/websphere.jar
Ibmorb.jar - C:/Websphere/AppServer/java/jre/lib/ext/ibmorb.jar
Once you have all these in your CLASSPATH, try running your client application. If you are using Sun JDK you will encounter an error message in the runtime which says like "Service Unavaible.. XXXX Service not found".
When you encounter this problem make sure that your service named XXXX is running and you are calling it appropriately. To find whether a service with name XXXX is running type
>>>>dumpnamespace
at the command prompt. If your service name is listed by dumpnamespace.. your service is running. So there is something wrong with the client code. Proceed to the next step.
In this tep you can use IBM JDK to fix the error. But that might not be the most suitable solution.
Here is how you can run Websphere EJB client programs without IBM JDK.
http://www7b.software.ibm.com/wsdd/downloads/pluggableclient.html
Follow this link and download the Websphere Pluggable application client and follow the instructions given in Readme to install the pluggable application client.
Once you finish installing the pluggable application client, you should be able to run with no problems.
For dwildcat92
I was also under the impression that we SHOULD use IBM JDK to make the client run. But our integration process demanded that the clients be called from Apache Tomcat. Thats how I was forced to find this link
http://www7b.software.ibm.com/wsdd/downloads/pluggableclient.html
Thanks for making me learn guys,
Ravi.

Similar Messages

  • Why can't I get an initial context??!!

    I am using WebSphere App Dev v.4.0, and I have written a client application which should call methods from an EJB. But I don't seem to be able to get an initial context no matter what I do. Here is a snippet of the app code and the exception it throws: I will be most grateful if someone could help me out. Thanks Ben.
    THE CODE...
    try {       
        System.out.println("about to retrieve initial context.");
        java.util.Properties p = new java.util.Properties();
        p.put(Context.PROVIDER_URL, "iiop://localhost:901");
        p.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
        InitialContext initContext = new InitialContext(p);
        System.out.println("initial context has been created.");
    }catch (Exception e) {
             e.printStackTrace();
    THE EXCEPTION...
    about to retrieve initial context.
    javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
         at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:380)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:212)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:199)
         at BeanClient.main(BeanClient.java:18)

    Is it Manadatory to keep the jar(containing the vendor specific context factory ) in the class path ?
    E.g Bean A in Appserver 1 wants to invoke Bean B in Appserver 2.
    In Appserver 1 's local Classpath may not have the above mentioned jar.
    The problem is , I m using java.rmi.server.codebase url.I m able to load the context factory class using RMIClassLoader and code base url(having the Appserver 2 required classes), BUT when I try to create the new InitialCoNtext for Appserver 2(from Appserver 1), it says contextFactory class not found !! it's finding the class in local Classpath !
    Please help
    Thanks

  • If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    If you registrate one Apple ID for each iPhone/iPad, you'll get 5GB on iCloud for each Apple ID, right? I have two iPhones and one iPad  with the same Apple ID, why can't I get 5 GB fo each of them?

    Actually, everyone missed one point, when a device is priced, the cost of icloud storage space for that device is also included in it that is why they are able to give you 5gb each for each user ID, in nutshell there is nothing free coming with apple device purchase, it is paid for.  What they are trying by giving only 5gb per user ID irrespective of the number of devices used is pure broadlight looting, they take money from you when you buy each device and give you nothing, This is a case of goods and services bought but not fully deliverd ie apple can be suied for discreminatory treatment towards it's users. I wonder why no one tried this yet in America where everyone sue everyone for petty things..... there is no one to take up this issue? . if tim got any love for the guys who shell out money for the devices his company makes, he should be implimenting this as priority before someone wake up from sleep and sue him.

  • Why can't I get firefoc 6, I had it on my old computer and now I can not find it to download

    I updated to firefox 6 and have since gotten a new computer and now can only download 4.0. Why can't I get at least 5.6 update?

    You likely had FF 3.6 instead of 6. At the moment, FF 4 is the latest version. If you wish to rollback to an earlier version, you can download your preferred version for your OS here:
    http://releases.mozilla.org/pub/mozilla.org/firefox/releases/
    FF 4 is the latest and greatest. If you are not experiencing specific problems that force you to roll back to an earlier version, you will probably want to stick with FF 4.
    If you do roll back, you may want to back up your profile for safekeeping:
    http://support.mozilla.com/en-US/kb/Profiles

  • When I tap the mail icon on my iPhone 4s, the menu of email servers pops up.  I already have a me acct that I check all the time, no problem.  So I choose iCloud, sign in and it tells me that I already have an acct-.so why can't I get to my emails then?

    When I tap the mail icon on my iPhone 4s, the menu of email servers pops up.  I already have a me acct that I check all the time, no problem.  So I choose iCloud, sign in and it tells me that I already have an acct….so why can't I get to my emails then?  I've turned the phone off and on twice....that has fixed it in the past but not this time....

    all fixed ha

  • Why can't I get a straight answer re: Multi Room DVR and HD Boxes

    A rep that I spoke w/ on the phone and the website tells me that the HD set top boxes are not compatiable w/ the Multi Room DVR. But they are working on it. A rep I chatted w/ today told me they definitely WILL work together. Why can't I get a straight answer?? And what IS the correct answer? I want to switch to FIOS and I really like the Multi Room DVR option, but I don't want my 1 of my 2 main TVs to be w/o HD. And since the Multi Room Box is HD why wouldn't it be compatiable w/ the HD boxes??
    Does anyone know what's going on w/ this?? Thanks!

    Joe01880,
    And that info is out of date, whether it is on Verizon's website or not. If you have the latest level of the IMG (1.6), then, as confirmed one post above yours, that the HD STB is now supported, and works. This has been posted in multiple posts on multiple forums, so I believe that it is accurate. But I do not have the 1.6 level so I cannot confirm that personally, I can only repeat what other posters in this and other forums have said. For example:
    http://www.dslreports.com/forum/r21081661-Multiroom-DVR
    http://www.dslreports.com/forum/r21059693-With-16-update-HD-Shareing
    http://www.dslreports.com/forum/r21052654-MultiRoom-DVR-Question
    http://www.dslreports.com/forum/r20906318-Some-new-features-coming-w-IMG-16
    http://www.highdefforum.com/showthread.php?t=78850
    http://www36.verizon.com/fiostv/MyAccount/Members/Newfeatures.aspx
    Note that the last one is a Verizon site.
    Justin
    Verizon FiOS TV, Internet, and phone
    Keller, TX
    Message Edited by Justin on 09-09-2008 04:20 PM

  • Why can't I get Back To My Mac to work in both directions between my 2011 Mac Book Air and my 2012 Mac Mini?

    Why can't I get Back To My Mac to work in both directions between my 2011 Mac Book Air and my 2012 Mac Mini? The network uses a Time Capsule. Everything works when connecting from the Mini to the Air, but the reverse is not the case, none of the Mini's drives are visible, and the screen sharing option is not available. I've tried the measures already suggested in online articles, everything seems to be configured correctly using my iCloud account. I'm at a loss, any suggestions would be appreciated.

    I've now managed to get the service running in both directions, but not in the way I had anticipated. I had to create a second account on the Mac Book Air, this also has administrator privilages, everything works fine when connecting from this acccount. However, this is not the way I would expect to work, none of my documents, applications and settings would be available, unless I laboriously duplicated them to the new account.
    Also, I've yet to get the service running from outside my home network.

  • Why can't I get my iMessage & ICloud to work on my iPad???

    Why can't I get my iMessage &amp; ICloud to work on my iPad???

    No idea.
    Perhaps if you gave a few details of exactly what happens, exactly what you've tried, exactly what troubleshooting steps you've taken, and what error messages you get we may be able to offer some suggestions.
    However, with zero info to go on, it's impossible to say.

  • HT201343 I have an Early 2011 MacBook Pro from Early 2011 that is a 13-inch model... why won't it support airplay? why can't I get a software update to allow it to work?

    I have an Early 2011 MacBook Pro from Early 2011 that is a 13-inch model... why won't it support airplay? why can't I get a software update to allow it to work?

    About AirPlay and Airplay Mirroring
    AirPlay Mirroring requires a second-generation Apple TV or later, and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer). For non-qualifying Macs you can try using Air Parrot.
    Several Apple Articles Regarding AirPlay
    Apple TV (2nd and 3rd gen)- How to use AirPlay Mirroring
    How to set up and configure AirPort Express for AirPlay and iTunes
    About AirPlay Mirroring in OS X Mountain Lion
    iTunes 10- About playing music with AirPlay
    Troubleshooting AirPlay and AirPlay Mirroring
    Using AirPlay
    Thanks to the $15 Beamer, AirPlay streaming is still possible on Macs  that do not support Airplay and mirroring.
    Another solution is the Air Parrot.

  • I have a new macbook pro and an LG w2361v monitor.  The max resolution the mac is allowing me to set is 1400x1050, why can't I get to the max resolution the monitor can accept (1900x1080)

    I have a new macbook pro and an LG w2361v monitor.  The max resolution the mac is allowing me to set is 1400x1050, why can't I get to the max resolution the monitor can accept (1900x1080)?  I know that the monitor is able to accept this resolution but It can't seem to find it.  Is it something to do with the new thunderbolt port? or the fact that I'm utilizing the VGA adaptor?  I could go HDMI if that works better.

    Use DVI or HDMI.
    VGA runs out of steam after a while.

  • I have Mac OS X 10.7.4.  Why can't I get my iCloud photo stream to work?

    I have Mac OS X 10.7.4.  Why can't I get my iCloud photo stream to work?

    Without explaining what you have tried, it might be hard to answer your question. Providing a little more detail would probably be useful to those that want to help you.

  • Why can't I get my email to work on my Ipad??

    Why can't I get my email to work on my Ipad?
    I've checked everything back to my email on my computer to ensure all details are correct in trying to add the account onto the Ipad.  And yet it still won't work.
    The error that I keep getting is "One Seniors (the provider) is not responding!!
    Does anyone have any suggestions as to why it won't work?
    I have internet access and it's working.  I'm using WiFi and that's working??
    Help anyone..... It's driving me nuts....

    Best suggestion is to contact them directly for guidance.  I wasn't familiar with them, but found their contact information.  Click this link to contact them:  http://www.oneseniors.com.au/contact/

  • Why can't I get my printer to print out a playlist from i-tunes? It used to work but now my printer doesn't seem to receive the "print" command.

    Why can't I get my printer to print out a playlist from i-tunes? It used to work, but now the printer doesn't seem to recognize the "print" command coming from i-tunes. The printer works for other applications!

    I  finally solved this problem after toiling with it for a couple of  days.  Solution:  Once you have  burned your CD you must go back into  iTunes to your music/playlists and select the playlist you just burned  and click file; print and you will  get the mosaics that we have been  accustomed to.  I was on hold with  Apple Support when I found this  myself.  Yes......!!! Problem solved..for me anyway.  Good luck!
    Scott

  • Why can't I get the pdf to convert to publisher?

    Why can't I get the pdf to convert to publisher?

    If you are using ExportPDF, see http://forums.adobe.com/docs/DOC-1511

  • Why can't I get the Kodak Document Print App in the UK?

    Why can't I get the Kodak Document Print App in the UK?

    "Apparently it's available in the US iTunes store but not here?"
    Because Kodak has chosen not to make it available there.
    "Can't for the life of me understand why that should be!"
    You do not have to understand it for it to be so.
    You can try asking Kodak, as they make the app.

Maybe you are looking for