Having been tipped off that my problem was due to having a "space" in my
jboss install path, I've now managed to get past the lookup problem.
However, I now get a problem with trying to actually create the instance of
Bean B from Bean A.
Jboss log:
[Default] JRMPCI:invokeHome create
[Default] Tx is null
[MyTest] TX_REQUIRED for create
[MyTest] begin tx
[MyTest] SSC:invokeHome:mi is create map is createHome
[MyTest] null
[MyTest] commit tx 0
Client output:
Instantiating bean...
javax.ejb.CreateException: Create
failed:java.lang.reflect.InvocationTargetExcep
tion
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHom
e(Unknown Source)
at
org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java
:221)
at $Proxy0.create(Unknown Source)
at
org.pentadactyl.central.mytest.MyTestClient.main(MyTestClient.java:34
)
The problem comes at the point I try to use the create method for Bean B in
Bean A.
The salient code in Bean A is:
private SessionContext ctx;
private String systemID = "MyTest";
private EventLogger eventLogger;
public String testCall()
{
return systemID;
}
public void ejbCreate() throws CreateException
{
try
{
Context beanHome = new InitialContext();
EventLoggerHome home =
(EventLoggerHome)beanHome.lookup("java:comp/env/EventLogger");
eventLogger = home.create();
}
catch(Exception e)
{
System.out.println("Whoa: " + e.toString());
}
}
The error occurs at the line:
eventLogger = home.create();
The salient client code (that calls Bean A is):
InitialContext jndiContext = new InitialContext();
Object ref = jndiContext.lookup("MyTest");
MyTestHome home = (MyTestHome) PortableRemoteObject.narrow(ref,
MyTestHome.class);
MyTest test;
System.out.println("Instantiating bean...");
test = home.create();
test.remove();
}
Bean A's resource definitions are below.
jboss.xml:
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>MyTest</ejb-name>
<jndi-name>MyTest</jndi-name>
<ejb-ref>
<ejb-ref-name>EventLogger</ejb-ref-name>
<jndi-name>EventLogger</jndi-name>
</ejb-ref>
</session>
<secure>false</secure>
</enterprise-beans>
</jboss>
ejb-jar.xml:
<?xml version="1.0"?>
<ejb-jar>
<description>My Test</description>
<enterprise-beans>
<session>
<display-name>MyTest</display-name>
<description></description>
<ejb-name>MyTest</ejb-name>
<home>org.pentadactyl.central.mytest.MyTestHome</home>
<remote>org.pentadactyl.central.mytest.MyTest</remote>
<ejb-class>org.pentadactyl.central.mytest.MyTestBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Bean</transaction-type>
<ejb-ref>
<description></description>
<ejb-ref-name>EventLogger</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>org.pentadactyl.central.eventlogger.EventLoggerHome</home>
<remote>org.pentadactyl.central.eventlogger.EventLogger</remote>
</ejb-ref>
</session>
</enterprise-beans>
</ejb-jar>
Bean B works if I call it from a Java client.
Thanks for any more pointers on the cause of my problem. The only thing I
could think of is that the ejb-ref entries in my ejb-jar.xml are somehow
incorrect.
Jon.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]