• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

jndi nosuchmethoderror

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi this is my Ejb Client code
===========================================================
import java.io.*;
import java.util.*;
import javax.naming.*;
import javax.ejb.*;
public class testclient {
public static void main (String args[]) {

javax.ejb.Handle beanHandle;
ConverterHome myConvHome;
Converter myConvRemote;
InitialContext initContext = null;
System.out.println("\nconvServlet is executing ...");
System.out.println("Retrieving JNDI initial context");
try {
Hashtable p = new Hashtable();
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
p.put(Context.PROVIDER_URL,"iiop://localhost:900");
initContext = new javax.naming.InitialContext(p);
}
catch (Exception e) {
System.out.println("Exception creating InitialContext: " + e.toString());
return;
}
try {
System.out.println("Looking up converter bean home interface");

//java:comp/env/ejb/Hello
String JNDIName = "java:comp/env/ConverterHome";
System.out.println("Looking up: " + JNDIName);
Object obj = initContext.lookup(JNDIName);
myConvHome = (ConverterHome) javax.rmi.PortableRemoteObject.narrow(obj,ConverterHome.class);
}
catch(Exception e) {
System.out.println("Converter bean home not found - " +
"Is bean registered with JNDI?: " + e.toString());
e.printStackTrace();
return;
}
try {
System.out.println("Creating the conv bean");
myConvRemote = myConvHome.create();
}
catch(CreateException e) {
System.out.println("Could not create the greeter bean: "+
e.toString());
return;
}
catch(java.rmi.RemoteException re) {
System.out.println("Remote exception occured");
re.toString();
return;
}

System.out.println("Getting the value from the converter bean");
try {
double input = Double.valueOf("15").doubleValue();
double conval = myConvRemote.dollarToYen(input);
System.out.println("Got this message from greeter bean: " + conval);
System.out.println("Storing the message in request object");
System.out.println("Dispatching JSP for output");
return;
} catch(java.rmi.RemoteException re) {
System.out.println("Remote exception occured");
re.toString();
return;
}
}


}
=======================================
while accessing the JNDI i'm getting the following error:
Exception in thread "main" java.lang.NoSuchMethodError: com.ibm.ws.naming.util.H
elpers: method mergeWsnJndiProperties(Ljava/util/Hashtable V not found
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(W
snInitialContextFactory.java:72)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
69)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at testclient.main(testclient.java:22)

Plz. help me to resolve..
Thx. in advance.
Regs,
Sundar
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!