this code snippet show the Account bean ..
--- cut here ---
package org.ejb.account;
import javax.ejb.*;
import javax.naming.*;
import org.ejb.person.*;
public class AccountBean implements javax.ejb.EntityBean {
// (container managed) bean fields
public PersonPK personPK;
// bean creation callbacks
public AccountPK ejbCreate( Person person )
{
try {
this.personPK = (PersonPK)person.getPrimaryKey();
}
catch( java.rmi.RemoteException e ) {}
return null;
}
public void ejbPostCreate( Person person )
{
// Do nothing. Required.
}
// entity bean methods
public Person getPerson()
{
try {
javax.naming.Context jndiContext = new InitialContext();
Object obj = jndiContext.lookup( "PersonBean" );
PersonHome home = (PersonHome) javax.rmi.PortableRemoteObject.narrow(obj,
PersonHome.class);
Person person = home.findByPrimaryKey( personPK );
return person;
}
catch( Exception e )
{
throw new EJBException( e );
}
}
// methods from javax.ejb.EntityBean
....
}
--- cut here ---
This does not work ... I get this exception in the client:
keyed it! =1234567 found by key! =PersonBean:1234567 1234567 Bavo De
Ridder javax.ejb.ObjectNotFoundException: Object with primary key Account
[1234567] not found in storage
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown
Source)
at
org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:221)
at $Proxy2.findByPrimaryKey(Unknown Source)
at AccountClient.main(AccountClient.java:42)
something to do with the jndi lookup, what is wrong here. ejb-ref things
or so (the ejb-jar.xml does not contain any ejb-ref tag) nor are there any
jboss.xml files.
--
Bavo De Ridder
Project Manager
VA Linux Belgium / Life
Interleuvenlaan 15A
3001 Haasrode, Belgium
phone: +32 16 20 89 61
fax: +32 16 20 79 73
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]