aspose file tools*
The moose likes Websphere and the fly likes jndi nosuchmethoderror Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "jndi nosuchmethoderror" Watch "jndi nosuchmethoderror" New topic
Author

jndi nosuchmethoderror

Rajagopal Sundarrajan
Greenhorn

Joined: Apr 23, 2003
Posts: 5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jndi nosuchmethoderror
 
Similar Threads
Getting Class cast exception while Lookup EJB2.1 session bean using JNDI name in WAS6.1
ClassCastException when casting to home interface
ejb hanging
How to access EJB from a main method
How to run a client...