Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with statefull session bean

Status
Not open for further replies.

nkmb

Programmer
May 10, 2006
33
US
Hi,

I am doing statefull sessionbean program.i have deployed the bean on server,by testing it i'm getting msg that the EJB Count has been tested successfully with a JNDI name of CountHome.

But i'm trying to compile the client.......i'm getting following error.


C:\sessionbean>C:\bea\jdk142_11\bin\javac -d ..\test CountClient.java
CountClient.java:44: cannot resolve symbol
symbol : variable home
location: class sessionbean.CountClient
count = home.create(countVal);

somebody help me to get out of this problem.

thanks,
nkmb.
^
 
Hi,

Yes i did.Eventhough i'm getting the error.


<code>

package sessionbean;

import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import javax.rmi.*;

public class CountClient {

public static final int noOfClients = 30;

public static void main(String[] args) {

try {

Context ctx =(Context)getInitialContext();
Object obj = ctx.lookup("CountHome");

CountHome home =

(CountHome)javax.rmi.PortableRemoteObject.narrow(


obj, CountHome.class);


Count count[] = new Count[noOfClients];

int countVal = 0;

System.out.println("Instantiating

beans...");
for (int i=0; i < noOfClients; i++) {

count = home.create(countVal);


countVal = count.count();

System.out.println(countVal);


Thread.sleep(100);
}


System.out.println("Calling count() on

beans...");
for (int i=0; i < noOfClients; i++) {


countVal = count.count();

System.out.println(countVal);


Thread.sleep(100);
}


for (int i=0; i < noOfClients; i++) {
count.remove();
}
} catch (Exception e) {
e.printStackTrace();
}
}
static String user = null;
static String password = null;
static String url = "t3://localhost:7001";

static public Context getInitialContext()
throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.T3InitialContextFactory");
p.put(Context.PROVIDER_URL, url);
if (user != null) {
System.out.println ("user: " + user);
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null)
password = "";
p.put(Context.SECURITY_CREDENTIALS, password);
}
return new InitialContext(p);
}
}
</code>


somebody please reply me.

thanku,
nkmb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top