aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes NamingException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NamingException" Watch "NamingException" New topic
Author

NamingException

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I get a Naming Exception when I try to work with entityBean even though my Jndi name is correct and also my server address.
What should I do and how to debug the problem?
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
can u send it full description of that bug ..then i will say whats the actual thing.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
/********My app serevr running*********/
Log file: E:\Blazix\entityapp\Ejblog.log
Blazix EJB Server 1.2
Copyright (C) Desiderata Software, 2001-2002
All rights reserved
Configuration file: e:\blazix\myejb.ini
JRMP version
Deploying EJB-Home class "org.acme.DeptHome" at JNDI name "Dept"
Deploying EJB-Home class "org.acme.HelloHome" at JNDI name "Hello"
Evaluation license
Listening at pavilion:1011
EJB Server operational at Fri Aug 16 22:35:02 EDT 2002
******************************************/

My client program
*******************
package org.acme;
import javax.naming.*;
import javax.rmi.*;
import javax.ejb.*;
import java.util.*;
import java.io.*;
public class DeptClient {
public static void main(String[] args) {
Context ctx = null;
Object obj = null;
DeptHome ejbHome = null;
try {
Properties env = new Properties();
env.put( "java.naming.factory.initial",
"desisoft.ejb.client.JRMPFactory" );
env.put( "desisoft.ejb.nameServer1",
"pavilion:1011" );
ctx = new InitialContext( env );
obj = ctx.lookup("Dept");
//obj = ctx.lookup("Hello");
}catch(NamingException e)
{ System.out.println("Error 1." + e.getMessage());
e.printStackTrace();
}

try{
ejbHome = (DeptHome)PortableRemoteObject.narrow(obj,DeptHome.class);


}
catch (Exception e) {
System.out.println("Can't error.3" + e.getMessage());
e.printStackTrace();
}
try {

Dept ejbObject = ejbHome.create("100","IT","vienna");
}
catch (Exception e) {
System.out.println("Can't create new CDept.");
e.printStackTrace();
}

}
}
*****************
Error 1.Failed to locate ejb at host pavilion:1011
javax.naming.NamingException: Failed to locate ejb at host pavilion:1011. Root
exception is java.rmi.UnmarshalException: error unmarshalling return; nested exc
eption is:
java.lang.ClassNotFoundException: org.acme.DeptHomeCtx_Stub (no security
manager: RMI class loader disabled)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:169)
at desisoft.ejb.server.EjbServerJRMP_Stub.getEjbHome(Unknown Source)
at desisoft.ejb.client.EjbClientContext.lookup(EjbClientContext.java:102
)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at org.acme.DeptClient.main(DeptClient.java:28)
Caused by: java.lang.ClassNotFoundException: org.acme.DeptHomeCtx_Stub (no secur
ity manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:368)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
a:200)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:150
3)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
616)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:297)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:146)
... 4 more
Can't create new CDept.
java.lang.NullPointerException
at org.acme.DeptClient.main(DeptClient.java:52)

I get no error when i try to use stateless session Bean "HELLO" with the same host and port
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
hi,
I think ur pgm is correct way,but i new about blazix server.So can u test on weblogic to this program if possible .
georgejk
Greenhorn

Joined: Jul 29, 2002
Posts: 24
hai
i'll just suggest onething. Just try.when u set the properties before getting the initial context try to set the host also.
the code samples for weblogic server is as follows.
String url = "t3://localhost:7001";
Sring 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);
}
Just try
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: NamingException