An InvocationTargetException usually means that some method called
via reflection threw an exception. In this case, the likely suspect is
the create method of the 2nd bean called by the first one - though it is
odd that it wouldn't fail when called by a client. However, you seem to
be seeing the "client side" (since the client is an EJB all exceptions
appear in the jBoss console) of this exception - the exception generated
for the EJB that is the client. You may be able to see the "server
side" of the exception as well elsewhere in your console output, and this
may be more informative. If all else fails, you can put a try/catch
around the entire contents of ejbCreate.
Also, are your 2 beans packaged into 1 JAR? If not, does the
calling EJB JAR have the home & remote interfaces and primary key for the
called EJB?
Aaron
On Fri, 29 Sep 2000, Jon Barnett wrote:
> 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]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]