This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Problem in getting Intial context in Websphere 5.0.1

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get an InitialContext from my Client program.My application Server is Websphere 5.0.1
My code for getting Initial Context is like :
Hashtable hash = new Hashtable();
hash.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
hash.put(Context.PROVIDER_URL,"iiop://test2.dev.prodigy.net:9092/");
InitialContext ctx = new InitialContext(hash);
I have addes following jars in classpath :
\WebSphere\AppServer\lib j2ee.jar;
\WebSphere\AppServer\lib\namingclient.jar;
\WebSphere\AppServer\lib\ecutils.jar;
Its giving me following errors at runtime:

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/Ob
jectURL
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(
WsnInitialContextFactory.java:168)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(W
snInitialContextFactory.java:108)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
62)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at TestJMS.main(TestJMS.java:59)

Any one have any idea what wrong I am doing.
Thanks
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can't just add those three Jars and hope to make your client run. Read in the infoCenter the entire section on Application clients for WebSphere. You will need to pick the application client type you want to use, and then carefully follow the infoCenter instructions to execute your client.
The easiest way to do this is to use the launchClient.bat file (which starts the full client container). But again, I strongly suggest you go to the infoCenter first and read the appropriate sections before proceeding.
Kyle
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, this is your lucky day , since, I just figure this out 1 hr before.
I use wsad5.1 and what you need to put in your class path is rt.jar from IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\java\jre\lib
and I assume you will have another problem, fogot how it looks like but, you need set LD_LIBRARY_PATH to server runtime bin.
set LD_LIBRARY_PATH=C:\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\bin
And I am try to test my MDB and I also have to set properties in my classpath,
set CLASSPATH=%CLASSPATH%;C:\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\properties
now I am able to run my client outside of WSAD

But, my code,
QueueConnectionFactory factory = (QueueConnectionFactory)jndiContext.lookup("jms/TestQueueFactory");
return my javax.naming.Reference so, I cannt cast it to QueueConnectionFactory or Queue. I dont know what I can do
PS, I come from weblogic world, to me, websphere and wsad is unnecessary complicated. Maybe I will get used to it. Hopefully, soon.....
 
On top of spaghetti all covered in cheese, there was this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!