Hi Sebastien,
now - I tried the beans in the testbeans and testbeans2 examples as well.
Hereafter I will present the some source code and output trace - both on the
client and the server.
1)Client source code:
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import org.jboss.zol.testbean2.interfaces.AllTypesHome;
import org.jboss.zol.testbean2.interfaces.AllTypes;
public class TestClient {
public static void main(String[] args) {
try {
InitialContext ic = new InitialContext();
Object objref = ic.lookup("AllTypes");
System.out.println("lookup ok");
AllTypesHome home =
(AllTypesHome)PortableRemoteObject.narrow(objref,
AllTypesHome.class);
System.out.println("narrow ok");
AllTypes oAll = home.create("1");//this line is generating the
exception!!!
System.out.println("create ok");
} catch(Exception e) {
e.printStackTrace();
}
}
}
2) Server trace:
[Default] JRMPCI:invokeHome create
[Default] Tx is null
[Default] invokeHome
[AllTypes] TX_REQUIRED for create
[AllTypes] begin tx
[AllTypes] commit tx 0
[Default] javax.ejb.CreateException: Create
failed:java.lang.reflect.InvocationT
argetException
at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersisten
ceManager.java:135)
at
org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:432)
at java.lang.reflect.Method.invoke(Native Method)
at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
ontainer.java:590)
at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
itySynchronizationInterceptor.java:162)
at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
anceInterceptor.java:79)
at
org.jboss.ejb.plugins.TxInterceptor.invokeNext(TxInterceptor.java:130
)
at
org.jboss.ejb.plugins.TxInterceptor.runWithTransactions(TxInterceptor
.java:196)
at
org.jboss.ejb.plugins.TxInterceptor.invokeHome(TxInterceptor.java:83)
at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
tor.java:122)
at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
03)
at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:310)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRM
PContainerInvoker.java:194)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRM
PContainerInvoker.java:148)
at java.lang.reflect.Method.invoke(Native Method)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Sour
ce)
at java.lang.Thread.run(Unknown Source)
3) Client trace:
[Default] JRMPCI:invokeHome create
[Default] Tx is null
[Default] invokeHome
[AllTypes] TX_REQUIRED for create
[AllTypes] begin tx
[AllTypes] commit tx 0
[Default] javax.ejb.CreateException: Create
failed:java.lang.reflect.InvocationT
argetException
at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersisten
ceManager.java:135)
at
org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:432)
at java.lang.reflect.Method.invoke(Native Method)
at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
ontainer.java:590)
at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
itySynchronizationInterceptor.java:162)
at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
anceInterceptor.java:79)
at
org.jboss.ejb.plugins.TxInterceptor.invokeNext(TxInterceptor.java:130
)
at
org.jboss.ejb.plugins.TxInterceptor.runWithTransactions(TxInterceptor
.java:196)
at
org.jboss.ejb.plugins.TxInterceptor.invokeHome(TxInterceptor.java:83)
at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
tor.java:122)
at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
03)
at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:310)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRM
PContainerInvoker.java:194)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRM
PContainerInvoker.java:148)
at java.lang.reflect.Method.invoke(Native Method)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Sour
ce)
at java.lang.Thread.run(Unknown Source)
Here is the text of the e-mail that I sent you yesterday (just in case
you've missed it):
I downloaded the source code from
http://www.jboss.org/zip_archives/zola-cvs-sources.zip and compiled
and deployed
successfully the account manager demo example.
I got exactly the same problem - when the 'account manager' bean
tries to
get the home interface of the Account bean as in the code below:
private AccountHome getAccountHome() throws NamingException {
System.out.println("Trying to get account home...");
Context root = new InitialContext();
System.out.println("Got initial context!");
Object obj = root.lookup(ACCOUNT_REF);
System.out.println("Got an object reference...");
Object ref = PortableRemoteObject.narrow(obj,
AccountHome.class);
System.out.println("Object reference narrowed successfully!");
/*
* [TODO] handle ClassCastException of narrow
*/
return (AccountHome)ref;
}
It's throwing an exception on the line:
Object obj = root.lookup(ACCOUNT_REF);
on the server I get the message the the bean reference is null or
something
similar.
I tried to change this line of code as follows:
Object obj = root.lookup("java:comp/env/" + ACCOUNT_REF);
but it did not work as well.
Fortunatelly I managed to find the previous version of 'jboss' and
the same
code seems to work there just fine. However with it I get
'NullPointerException' when I try to create BMP beans.
In other words the last version of jboss seems to have fixed this
problem
but there is a bug in referencing one BMP bean from another.
Once again - I downloaded the last version of jboss about 3 or 4 days
ago.
Please help me.
Regards,
Kamen.
----- Original Message -----
From: "Sebastien Alborini" <[EMAIL PROTECTED]>
To: "Kamen" <[EMAIL PROTECTED]>
Sent: Saturday, September 23, 2000 7:33 PM
Subject: Re: EJb-ref problem
> > Kamen wrote:
> >
> > Hi Sebastien,
> > I'm having a problem with invoking one entity ejb from another entity
> > ejb - they are both in the same package.
> > I downloaded jboss a few days ago.
> > Have you tried it yet?
> > Regards,
> > Kamen.
>
> Sure I have. Take a look at the testbeans test suite included in the
> distribution (source available at
> http://www.jboss.org/zip_archives/zola-cvs-sources.zip ).
>
> If you can't figure out to make it work, the appropriate way is to post
> a message on the jboss-user mailing list.
> http://www.jboss.org/mailing.htm
>
> Try to describe your problem as accurately as possible (server trace,
> maybe your xml file(s), source code...)
>
>
> Sebastien
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]