?
Solved

Urgent - How to lookup JMS resource from standalone client in Websphere Application Server 7

Posted on 2010-08-17
4
Medium Priority
?
2,362 Views
Last Modified: 2013-12-11
I created a EAR project and an application Client project using RAD 7.5. Client project has been included as a module in EAR. The client project has Main.java (Standalone class).

RAD7.5 has been configured to use local WAS7.0.11 test environment. JMS resources have been configured in WAS7.0.11 test environment and SI bus has already been created in WAS. My final goal is to send a message to SI bus queue using Main.java class. But I am getting the below exception during InitialContext lookup itself.

Exception in RAD7.5 console is below:

InitialContext starts....
Aug 11, 2010 10:07:46 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
Aug 11, 2010 10:07:47 PM com.ibm.ws.naming.util.CommonHelpers
WARNING: jndiproviderProperties
Aug 11, 2010 10:07:47 PM com.ibm.websphere.naming.WsnInitialContextFactory
WARNING: noInitCtxFactoryImpl
Exception in thread "main" javax.naming.ConfigurationException: The property com.ibm.ws.naming.wsn.factory.initial is not set. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/jndiprovider.properties cannot be found by the class loader.
at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:194)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:675)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:257)
at javax.naming.InitialContext.init(InitialContext.java:233)
at javax.naming.InitialContext.<init>(InitialContext.java:209)
at sender.Main.main(Main.java:29)


Main.java class snippet is below:


24 public static void main(String[] args) throws Exception {  
25 Hashtable env = new Hashtable();  
26 env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");  
27 env.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2810");
28 System.out.println("InitialContext starts....");  
29 InitialContext initCtx = new InitialContext(env);  

Open in new window


I verified Bootstrap_address, it is 2810 in my case in configuration file.

When I googled it, people suggest to include few jars into client class path, if is it so, Can you please advise me, what are those and from where I can get those?. Please advise me, it is very urgent to me.
0
Comment
Question by:MatrixStar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Expert Comment

by:Radek Baranowski
ID: 33462685
if you have assemblied your ear in some improper way. that means, failed to attach all necessary information in deployment descriptor you may need to either correct it (to provide all necessary resour ces on ear level), or try to change classloader policy in WAS to parent first (that means that many common classes will be supplied by the application container of the WAS rather than from ear package.
0
 
LVL 8

Expert Comment

by:AdminRAM
ID: 33465922
Most of the class contains under C:\WebsphereV7.0\plugins or C:\WebsphereV7.0\lib
0
 
LVL 2

Accepted Solution

by:
calboronster earned 1500 total points
ID: 33515742
I could make these suggestions

1. If you are going to use java as jms client, remove corbaloc directive.
2. On websphere 6 the libraries are -
\IBM\WebSphere\AppServer\lib\naming.jar;namingserver.jar;namingclient.jar, runtime.jar
Can you check in these?
3.  THIS LOOKS LIKE A CHANGE FROM WAS6 - Use the Java constant, javax.naming.Context.INITIAL_CONTEXT_FACTORY, for the property name, and the constant, com.ibm.websphere.naming.PROPS.INITIAL_CONTEXT_FACTORY, for the property value.

(http://publib.boulder.ibm.com/infocenter/wasinfo/fep/index.jsp?topic=/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/naming/WsnInitialContextFactory.html)

Including more libraries (typically websphere libraries) in application classpath than required causes classloading issues so beware.
0
 

Author Closing Comment

by:MatrixStar
ID: 33550396
Thank you!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Invest in your employees with these five simple steps to improve employee engagement and retention.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question