File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NamingException" Watch "NamingException" New topic


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.
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.*;
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());

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

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

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

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(
at desisoft.ejb.server.EjbServerJRMP_Stub.getEjbHome(Unknown Source)
at desisoft.ejb.client.EjbClientContext.lookup(
at javax.naming.InitialContext.lookup(
at org.acme.DeptClient.main(
Caused by: java.lang.ClassNotFoundException: org.acme.DeptHomeCtx_Stub (no secur
ity manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(
at sun.rmi.server.LoaderHandler.loadClass(
at java.rmi.server.RMIClassLoader$2.loadClass(
at java.rmi.server.RMIClassLoader.loadClass(
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
at sun.rmi.server.UnicastRef.unmarshalValue(
at sun.rmi.server.UnicastRef.invoke(
... 4 more
Can't create new CDept.
at org.acme.DeptClient.main(

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
I think ur pgm is correct way,but i new about blazix server.So can u test on weblogic to this program if possible .

Joined: Jul 29, 2002
Posts: 24
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
Similar Threads
What UML Tool(s) are you using for SCEA Beta Part II?
Which RSS reader do u use?
Beta Part II submission acknowledgement
Convincing the management
prisoner problem