Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with JNDI name lookup

 
patrick patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am creating a novice web application using JBoss, Struts and Hibernate. I have problems creating a EJB Home object using JNDI lookup. The lookup method always throws an exception.

Here are some of the details of my program:

Action class (subclass of Action):
InitialContext ctx = new InitialContext();
mySchoolHome = (SchoolHome)ctx.lookup("java:comp/env/ejb/SchoolHome");

web.xml:
<jndi-link>
<jndi-name>java:comp/env/ejb</jndi-name>
<jndi-factory>org.jnp.interfaces.NamingContextFactory</jndi-factory>
</jndi-link>

jboss.xml:
<jboss>
<enterprise-beans>
<session>
<ejb-name>SchoolEJB</ejb-name>
<jndi-name>ejb/SchoolHome</jndi-name>
</session>
</enterprise-beans>
</jboss>

I am a novice to J2EE applications. Please help me out.

Patrick
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patrick,
Welcome to JavaRanch!

Can you post the exception message it is throwing?
 
patrick patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.naming.NameNotFoundException: SchoolEJB not bound
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Jeanne

I have same problem as patrick patel has.
<<<< javax.naming.NameNotFoundException: myEJB not bound >>>

Can u help me?

Regards.
Solmaz Anvar

[ July 20, 2005: Message edited by: Solmaz Anvar ]
[ July 21, 2005: Message edited by: Solmaz Anvar ]
 
krishna valavala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you paste your contents of your ejb-jar.xml? It could be that your ejb-name is not pointing to right class file.
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Krishna

I new in Ejb.
I develop my Ejb in jBuilder with jboss.

I create session bean with simple remote method to show 'Hello World' .when i test my Application client
it work fine. but when i create session bean that call one BMP entity bean method localy and try client application
this errror appear :

javax.naming.NameNotFoundException: Roster not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

-- Calling create()
-- Failed : create()
-- Return value from create(): null.

Error in show(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.

-----------------------------------------------------------------

Local Refrence in ejb-jar.xml >>>>>>>>

<ejb-local-ref>
<ejb-ref-name>ejb/Player</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>Roster.PlayerHome</local-home>
<local>Roster.Player</local>
<ejb-link>Player</ejb-link>
</ejb-local-ref>

---------------------------------------------------------------
Look up Method Entity Player in Session Bean >>>>>>

Object objref = initial.lookup("java:comp/env/ejb/Player");
PlayerHome plyHome = (PlayerHome) objref;

---------------------------------------------------------
Client Application Main Method >>>>>>>>>>>>

RosterTestClient client = new RosterTestClient();
client.create();
client.adPlayer(new Integer(4),"solmaz","anvar","1111");



I don't khow what is wrong.
Please Help me.

Regards.
Solmaz Anvar
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,again

I new in Ejb.
I develop my Ejb in jBuilder with jboss.

I create session bean with simple remote method to show 'Hello World' .when i test my Application client
it work fine. but when i create session bean that call one BMP entity bean method localy and try client application
this errror appear :

javax.naming.NameNotFoundException: Roster not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

-- Calling create()
-- Failed : create()
-- Return value from create(): null.

Error in show(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.

-----------------------------------------------------------------

Local Refrence in ejb-jar.xml >>>>>>>>

<ejb-local-ref>
<ejb-ref-name>ejb/Player</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>Roster.PlayerHome</local-home>
<local>Roster.Player</local>
<ejb-link>Player</ejb-link>
</ejb-local-ref>

---------------------------------------------------------------
Look up Method Entity Player in Session Bean >>>>>>

Object objref = initial.lookup("java:comp/env/ejb/Player");
PlayerHome plyHome = (PlayerHome) objref;

---------------------------------------------------------
Client Application Main Method >>>>>>>>>>>>

RosterTestClient client = new RosterTestClient();
client.create();
client.adPlayer(new Integer(4),"solmaz","anvar","1111");


I don't khow what is wrong.
Please Help me.

Regards.
Solmaz Anvar
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you need to post more code, since i am NOT able to find any code that tries to lookup Roster. Also post the detail log.

Thank you
 
krishna valavala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the limited code posted here I am not able to make out anything. I am assuming you have created two beans: One session bean (Roster??) and one entity bean (Player)

To define these beans, in ejb-jar.xml you need two blocks under <enterprise-beans> </enterprise-beans>
1. <entity> .. <ejb-name>Player<ejb-name> ...</entity>
2. <session> .. <ejb-name>Roster<ejb-name> ...</session>

I am hoping you already did this and you provided local interfaces for entity bean.

Now for the session bean to lookup entity bean locally you need to tell the container about the local reference. To do so, you need to specify in the deployment descriptor a local ref for the session bean. You do so by doing the following:
<session> .. <ejb-name>Roster<ejb-name>
<ejb-local-ref>
<ejb-ref-name>LocalPlayer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>PlayerHome</local-home>
<local>Player</local>
<ejb-link>PlayerBean</ejb-link>
</ejb-local-ref>
...</session>

Now you session bean will be able to lookup local entity bean. Client semantics should not change, because client does not deal with the entity bean, it just deals with session bean
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, again
thanks for your replies.
sorry for my mistake in code

I try to explain that again

I Have one Session Bean("PlayerSes") and one CMP Entity Bean("Player") In my Project("TestRosterCMP")

<<<<<ejb-jar.xml>>>>>-----------------------------------------------------------------

<enterprise-beans>
<entity>
<ejb-name>Player</ejb-name>
<local-home>testrostercmp.PlayerHome</local-home>
<local>testrostercmp.Player</local>
<ejb-class>testrostercmp.PlayerBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Player</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<cmp-field>
<field-name>position</field-name>
</cmp-field>
<cmp-field>
<field-name>salary</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<session>
<ejb-name>PlayerSes</ejb-name>
<home>testrostercmp.PlayerSesHome</home>
<remote>testrostercmp.PlayerSes</remote>
<ejb-class>testrostercmp.PlayerSesBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Player</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>testrostercmp.PlayerHome</local-home>
<local>testrostercmp.Player</local>
<ejb-link>Player</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>

----------------------------------------------------------------------------------------
PlayerSesBean have method("getName") with remote interface

<<<<PlayerSesBean.java>>>>>>>>>>>>

public String getName(Integer id) throws NamingException, CreateException
{
javax.naming.Context context = new javax.naming.InitialContext();
Object object = context.lookup("java:comp/env/ejb/Player");
PlayerHome plyHome = (PlayerHome)object;
Player ply = plyHome.create(id);
return ply.getName();
}


<<<<PlayerSes.java>>>>>>>>>>>>

public interface PlayerSes extends EJBObject {
public String getName(Integer id) throws RemoteException;
}

--------------------------------------------------------------------------------------------
After Run Client Application this error appear:

javax.naming.NameNotFoundException: PlayerSes not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)-- Failed initializing bean access.
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at testrostercmp.PlayerSesTestClient1.initialize(PlayerSesTestClient1.java:47)
at testrostercmp.PlayerSesTestClient1.<init>(PlayerSesTestClient1.java:32)
at testrostercmp.PlayerSesTestClient1.main(PlayerSesTestClient1.java:179)
java.lang.NullPointerException
at testrostercmp.PlayerSesTestClient1.create(PlayerSesTestClient1.java:91)
at testrostercmp.PlayerSesTestClient1.main(PlayerSesTestClient1.java:180)

-- Calling create()
-- Failed : create()
-- Return value from create(): null.

Error in getName(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.


---------------------------------------------------------------------------------------
I don't know what's wrong?

Regards.
Solmaz Anvar

[ July 22, 2005: Message edited by: Solmaz Anvar ]
[ July 23, 2005: Message edited by: Solmaz Anvar ]
 
krishna valavala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please paste your client code. Looks like you are looking up the session bean in the create() method. Post the entire client code which relates to the lookup of session bean
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Krishna

<<<<<<<<<<<<<<<<<< Client Code >>>>>>>>>>>>>>>>>>>>>>>>

public class PlayerSesTestClient1 {
private static final String ERROR_NULL_REMOTE = "Remote interface reference is null. It must be created by calling one of the Home interface methods first.";
private static final int MAX_OUTPUT_LINE_LENGTH = 100;
private boolean logging = true;
private PlayerSes playerSes = null;
private PlayerSesHome playerSesHome = null;

public PlayerSesTestClient1() {
initialize();
}

public void initialize() {
long startTime = 0;
if (logging) {
log("Initializing bean access.");
startTime = System.currentTimeMillis();
}

try {

//get naming context
Context context = getInitialContext();
//look up jndi name
Object ref = context.lookup("PlayerSes");
//look up jndi name and cast to Home interface
playerSesHome = (PlayerSesHome) PortableRemoteObject.narrow(ref,
PlayerSesHome.class);
if (logging) {
log(
"Succeeded initializing bean access through Home interface.");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}

} catch (Exception e) {
if (logging) {
log("Failed initializing bean access.");
}
e.printStackTrace();
}

}

private Context getInitialContext() throws NamingException {
Hashtable environment = new Hashtable();

environment.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
environment.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming rg.jnp.interfaces");
environment.put(Context.PROVIDER_URL, "jnp://localhost:1099");

return new InitialContext(environment);
}

---------------------------------------------------------------------------
Methods that use Home interface methods to generate a Remote interface reference
--------------------------------------------------------------------------
public PlayerSes create() {
long startTime = 0;
if (logging) {
log("Calling create()");
startTime = System.currentTimeMillis();
}

try {
playerSes = playerSesHome.create();
if (logging) {
log("Succeeded: create()");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
} catch (Exception e) {
if (logging) {
log("Failed : create()");
}
e.printStackTrace();
}
if (logging) {
log("Return value from create(): " + playerSes + ".");
}
return playerSes;
}
---------------------------------------------------------------------------
Methods that use Remote interface methods to access data through the bean
---------------------------------------------------------------------------

public String getName(Integer id) {
String returnValue = "";
if (playerSes == null) {
System.out.println("Error in getName(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging) {
log("Calling getName(" + id + ")");
startTime = System.currentTimeMillis();
}

try {
returnValue = playerSes.getName(id);
if (logging) {
log("Succeeded: getName(" + id + ")");
long endTime = System.currentTimeMillis();
log("Execution time: " + (endTime - startTime) + " ms.");
}
} catch (Exception e) {
if (logging) {
log("Failed : getName(" + id + ")");
}
e.printStackTrace();
}
if (logging) {
log("Return value from getName(" + id + "): " + returnValue + ".");
}
return returnValue;
}

public void executeRemoteCallsWithDefaultArguments() {
if (playerSes == null) {
System.out.println(
"Error in executeRemoteCallsWithDefaultArguments(): " +
ERROR_NULL_REMOTE);
return;
}

try {
getName(null);
} catch (Exception e) {
e.printStackTrace();
}
}

---------- Utility Methods -------------------------------------

private void log(String message) {

if (message == null) {
System.out.println("-- null");
}
if (message.length() > MAX_OUTPUT_LINE_LENGTH) {
System.out.println("-- " +
message.substring(0, MAX_OUTPUT_LINE_LENGTH) +
" ...");
} else {
System.out.println("-- " + message);
}
}

---------Main method----------------------------------------------

public static void main(String[] args) {
PlayerSesTestClient1 client = new PlayerSesTestClient1();
client.create();
client.getName(new Integer(1));
}
}


Regards.
Solmaz Anvar

[ July 23, 2005: Message edited by: Solmaz Anvar ]
[ July 23, 2005: Message edited by: Solmaz Anvar ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You should also be having the jboss.xml file, which you haven't posted. This file will actually contain the name of the bean and its corresponding jndi-name(which you are trying to lookup in the client code). I guess the entry for the jndi-name is NOT matching with the one which you are doing a lookup for. Please post jboss.xml file.

Also, if possible, try the following path in the explorer:
http://localhost:8080/jmx-console

This will give a listing of all beans and their jndi-names. Check if this listing contains your beans.
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, again

I checked all beans in [URL=http://localhost:8080/jmx-console].
Player and PlayerSes don't exist.

<<<<<<<<<<<<<<<<jboss.xml>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>Player</ejb-name>
<local-jndi-name>Player</local-jndi-name>
</entity>
<session>
<ejb-name>PlayerSes</ejb-name>
<jndi-name>PlayerSes</jndi-name>
</session>
</enterprise-beans>
</jboss>


Regards.
Solmaz Anvar

[ July 24, 2005: Message edited by: Solmaz Anvar ]
[ July 24, 2005: Message edited by: Solmaz Anvar ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked all beans in [URL=http://localhost:8080/jmx-console].
Player and PlayerSes don't exist.


This means your beans are NOT deployed. For a final confirmation of the same, please restart your jboss server and post the entire jboss server.log.


Also, after restarting jboss, go to http://localhost:8080/jmx-console

Search for jndiName=PlayerSes,plugin=pool,service=EJB
And post your findings

Thank you.
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, again

I restart jboss. make and run my project and EJBModule1.jar creat in Defualt\Deplay Directory. I think ejbs deployed successfully. but i can't find "jndiName=PlayerSes,plugin=pool,service=EJB" in http://localhost:8080/jmx-console.

Please help me.

Regards.
Solmaz anvar
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For deploying any ejbs, you would typically do the following:

1) Create a .ear file (Ex: Myapp.ear)
2) You would then have your .jar and .war files in this .ear file
3) You would also have an application.xml file in your .ear file mentioning the ejb and web modules in your application

The following link might help you:

http://www.devx.com/Java/Article/21065
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
 
krishna valavala
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though your code suggests that it is failing the create() method of the client, I am thinking the lookup of PlayerSes bean failed.

/*****************************/
Context context = getInitialContext();
//look up jndi name
Object ref = context.lookup("PlayerSes");
//look up jndi name and cast to Home interface
playerSesHome = (PlayerSesHome) PortableRemoteObject.narrow(ref,
PlayerSesHome.class);

/********************************/

Please try a lookup with the standard (best practice) lookup statement:

Object ref = context.lookup("java:/comp/env/ejb/PlayerSes");

Look at the following link for some useful info.
http://www-128.ibm.com/developerworks/websphere/library/bestpractices/increase_app_portability.html

Krishna
 
Marcio Endo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had this kind of problem with JBoss before.

Although the documentation states that EJB will be bound to java:/comp/env/ejb, they (for some reason I don't know) get actually bound to ejb only.

So instead of looking it up with:



Do it with



See if it works.
Regards.

Marcio Endo
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
thanks guys for useful refrences.

I khow for look up jndi name and cast to Home interface with local interface, must use

javax.naming.Context context = javax.naming.getInitialContext();
Object ref = context.lookup("ejb/LocalRef"); OR
Object ref = context.lookup("java:comp/env/ejb/LocalRef");
MyBeanHome myBeanHome = (MyBeanHome)ref;

<<<<<< ejb-jar >>>>>>

<ejb-local-ref>
<ejb-ref-name>ejb/LocalRef</ejb-ref-name>
.
.
.
</ejb-local-ref>


and for look up jndi name and cast to Home interface with remote interface, must use

javax.naming.Context context = javax.naming.getInitialContext();
Object ref = context.lookup("ejb/RemoteRef"); OR
Object ref = context.lookup("java:comp/env/ejb/RemoteRef");
MyBeanHome myBeanHome = (MyBeanHome)
javax.rmi.PortableRemoteObject.narrow(ref,MyBeanHome.class);

<<<<<< ejb-jar >>>>>>

<ejb-ref>
<ejb-ref-name>ejb/RemoteRef</ejb-ref-name>
.
.
.
</ejb-ref>


and in jboss.xml :

<<<<<<<<<<<<jboss.xml>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<ejb-name>MyBean</ejb-name>
<local-jndi-name>MyBean</local-jndi-name>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


I don't Know ,if <local-jndi-name> in jboss.xml must be as same as <ejb-ref-name> in ejb-jar.xml ?

I creat SessionBean ("PlayerSes") with simple method ("showHello") that return "Hello World".
I look up jndi name and cast to Home interface in my client application as follow:

Object ref = context.lookup("PlayerSes");
PlayerSesHome playerSesHome = (PlayerSesHome)
PortableRemoteObject.narrow(ref,PlayerSesHome.class);

It work fine.

but when I creat CMP EntityBean ("Player") in same Module with local refrence in ejb-jar.xml
<ejb-local-ref><ejb-ref-name>ejb/Player</ejb-ref-name>......</ejb-local-ref> for TestSes
and look up jndi name and cast to Home interface in another PlayerSes method ("getName()") as follow:

Object object = context.lookup("java:comp/env/ejb/Player");
PlayerHome plyHome = (PlayerHome)
javax.rmi.PortableRemoteObject.narrow(object,PlayerHome.class);

and in jboss.xml :

<ejb-name>Player</ejb-name>
<local-jndi-name>Player</local-jndi-name>

and use previous client application look up method to find PlayerSes, this error apears:

log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1382)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at testrostercmp.PlayerSesTestClient2.initialize(PlayerSesTestClient2.java:47)-- Failed initializing bean access.

-- Calling create()
at testrostercmp.PlayerSesTestClient2.<init>(PlayerSesTestClient2.java:32)
at testrostercmp.PlayerSesTestClient2.main(PlayerSesTestClient2.java:179)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:711)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1272)
... 7 more

java.lang.NullPointerException

-- Failed : create()
at testrostercmp.PlayerSesTestClient2.create(PlayerSesTestClient2.java:91)
at testrostercmp.PlayerSesTestClient2.main(PlayerSesTestClient2.java:180)
-- Return value from create(): null.

Error in getName(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.


What is wrong . any suggestion?

Regard.
Solmaz Anvar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic