Solved

To connect to session bean from swing client

Posted on 2004-10-18
4
431 Views
Last Modified: 2013-12-29
We are working on WSAD 5.1 and WAS. While connecting to an EJB in application server from Swing client using RMI/IIOP we are getting an error.

A communication failure occurred while attempting to obtain an initial context with the provider URL.

We tried using WSAD test server and WAS. We have created the EJB using WSAD and have build the files to create jar files and ear file. We are able to run the program using same machine as clent and test server in WSAD. While trying to run the application client jar file from a different client machine it is throwing exception. The piece of code used to access ejb is as mentioned below. Could you please guide us where we are going wrong, is it that we have missed some setting in server or WSAD,  hope this is conceptually correct.

contextfactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
providerurl = "corbaloc:iiop://145.30.240.129:2809";

properties = new java.util.Properties();
properties.put(InitialContext.INITIAL_CONTEXT_FACTORY, contextfactory);
properties.put(InitialContext.PROVIDER_URL, providerurl);

context = new InitialContext(properties);
objref = context.lookup("ejb/testpack/testHome");
testHome home = (testHome) objref;


Help in this regard will be much appreciated. If you need any further details please get back.



0
Comment
Question by:subrav98
4 Comments
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 125 total points
ID: 12344662
Hi subrav98,

Is there a JNDI server running on "corbaloc:iiop://145.30.240.129:2809"?

\t
0
 
LVL 13

Assisted Solution

by:petmagdy
petmagdy earned 125 total points
ID: 12345488
First did u defined in ur client module application-client.xml the following
      <ejb-ref>
         <description>testpack</description>
         <ejb-ref-name>ejb/testpack/testHome</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
         <home>ur home interface</home>
         <remote>ur remote interface</remote>
      </ejb-ref>

also use:

objref = context.lookup("java:comp/env/ejb/testpack/testHome");

instead of:

objref = context.lookup("ejb/testpack/testHome");


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

947 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

21 Experts available now in Live!

Get 1:1 Help Now