Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

what is the reason? please help me  RSS feed

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write a Entity bean by Jbuilder6, it insert database table 4 rows,the table has two columns: name,balance
and I deploy it in the weblogic6.1.
I write a client program under below:
package jb6entity1;
import javax.naming.*;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
public class AccountTestClient1 {
private AccountHome accountHome = null;
//Construct the EJB test client
public AccountTestClient1() {
try {
//get naming context
Context ctx = getInitialContext();
//look up jndi name
Object ref = ctx.lookup("Account");
//cast to Home interface
accountHome = (AccountHome) PortableRemoteObject.narrow(ref, AccountHome.class);

Account ac1=accountHome.create("John","150");
Account ac2=accountHome.create("Paul","150");
Account ac3=accountHome.create("George","150");
Account ac4=accountHome.create("Ringo","150");

catch(Exception e) {
private Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
return new InitialContext(properties);
catch(Exception e) {
System.out.println("Unable to connect to WebLogic server at " + url);
System.out.println("Please make sure that the server is running.");
throw e;
// Utility Methods
public AccountHome getHome() {
return accountHome;
//Main method
public static void main(String[] args) {
AccountTestClient1 client = new AccountTestClient1();
// Use the getHome() method of the client object to call Home interface
// methods that will return a Remote interface reference. Then
// use that Remote interface reference to access the EJB.
there is always a error:
javax.naming.NameNotFoundException: Unable to resolve Account. Resolved: '' Unresolved:'Account' ; remaining name ''
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(
at weblogic.rmi.internal.ProxyStub.invoke(
at $Proxy0.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(
at javax.naming.InitialContext.lookup(
at jb6entity1.AccountTestClient1.<init>(
at jb6entity1.AccountTestClient1.main(

what is reason???
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!