Solved

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

Posted on 2010-08-17
4
2,300 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
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 500 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This video shows how use content aware, what it’s used for, and when to use it over other tools.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now