Hi,
I've successfully deployed an
ejb jar to Sybase (Jaguar 4.0) through JBuilder 6 Enterprise but cannot get a client to lookup the ejb successfully. I can get a context but get the following exception:
Errorjavax.naming.NamingException [Root exception is com.sybase.ejb.CosNaming.NamingContextPackage.NotFound]
Anyone have any ideas?
Here's the client code:
<code>
import javax.naming.*;
import javax.ejb.*;
import javax.rmi.PortableRemoteObject;
import java.util.*;
import welcome.*;
public class Client {
private static Enterprise1Home enterprise1Home = null;
private static Enterprise1 enterprise1 = null;
public static void main(
String[] args) {
try {
System.out.println("Trying:");
Context jndiContext = getSybInitialContext();
if(jndiContext !=null) {
System.out.println("Context Not Null");
} else {
System.out.println(jndiContext.getClass());
System.out.println("Null Context");
}
Object obj= jndiContext.lookup("Jaguar/Enterprise1");
if (obj !=null) {
System.out.println("Object Not Null");
}else {
System.out.println("Null Object");
}
enterprise1Home = (Enterprise1Home) PortableRemoteObject.narrow(obj, Enterprise1Home.class);
if(enterprise1Home != null){
System.out.println("Home available");
}
} catch(Exception e) {
System.out.println("Error"+e);
}
}
public static InitialContext getSybInitialContext() throws NamingException
{
java.util.Properties p = new java.util.Properties();
// Sybase implementation of InitialContextFactory
p.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sybase.ejb.InitialContextFactory");
// URL for the Server's IIOP port
p.put(Context.PROVIDER_URL, "iiop://localhost:9000");
p.put(Context.SECURITY_PRINCIPAL, "jagadmin");
p.put(Context.SECURITY_CREDENTIALS, "");
// Now create an InitialContext that uses the properties
return new InitialContext(p);
}
}
</code>
---------------------------
Jaguar Server startup
....
2 Phase Commit Option Licensed
Clustering Option Licensed
High Availability Option Licensed
Application Integrator for CICS Option Licensed
Invalid listen port number: 8787
Transport dt_socket failed to initialize, rc = -1.
FATAL ERROR in native method: No transports initialized
Starting services...
Accepting connections.
Exception in
thread "Thread-5"
///-----------------------
Manoj had a similar problem at sybase.public.easerver.j2ee JNDI lookup problems. The solution was a combo of wrong JNDI name and a patch for JBuilder 5. I'm using JBuilder 6 so would think the patch would be included and tried every combo of the JNDI name possible....
Yoo-Jin.
[ January 04, 2002: Message edited by: Yoo-Jin Lee ]