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 ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

what is the reason? please help me  RSS feed

 
Greenhorn
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) {
e.printStackTrace();
}
}
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(BasicOutboundRequest.java:85)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy0.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at jb6entity1.AccountTestClient1.<init>(AccountTestClient1.java:17)
at jb6entity1.AccountTestClient1.main(AccountTestClient1.java:70)

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