Including B's interfaces in A's jar does not seem to work and is causing the
class cast exception. I spoke to someone here who knows Weblogic and he said
Weblogic has the same problem. In Weblogic it's apparently a class loader
'thing' i.e. the interface classes are in two different jar's, which in turn
are loaded by two different class loaders, so they are not 'seen' to be the
same, and the cast fails.
Is this the case with JBoss?
-----Original Message-----
From: Nortje, Andrew
Sent: Tuesday, November 14, 2000 8:56 AM
To: 'jBoss'
Subject: RE: [jBoss-User] External ejb reference
Thanks, that did it. I however now get java.lang.ClassCastException. This is
the jboss output with some of my own debug statements. As you see I print
out objRef which is account/InternalAccountHome, which is what I want, and
what I am trying to cast/narrow to.
[Default] Shutdown hook added
[Default] jBoss 2.0 BETA-PROD-03 Started
[Customer] CustomerBean setSessionContext()
[Customer] 1
[Customer] 2
[Customer] 3 account/InternalAccountHome
[Customer] java.lang.ClassCastException
[Customer] at
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narr
ow(PortableRemoteObject.java:296)
[Customer] at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.ja
va:137)
[Customer] at
com.uni.trader.ejb.CustomerBean.ejbCreate(CustomerBean.java:3
1)
[Customer] at java.lang.reflect.Method.invoke(Native Method)
This is my 'client' code
...
public void ejbCreate( long customerID ) {
try {
// Get a naming context
System.out.println( " 1" );
InitialContext jndiContext = new InitialContext( );
System.out.println( " 2" );
// Get a reference to the Interest Bean
Object objRef =
jndiContext.lookup("java:comp/env/ejb/InternalAccount");
System.out.println( " 3 " + objRef );
//this.internalAccount = ( InternalAccountRemote )
objRef;
//InternalAccountHome home = ( InternalAccountHome )
objRef;
com.uni.account.ejb.InternalAccountHome home = (
com.uni.account.ejb.InternalAccountHome )
PortableRemoteObject.narrow( objRef,
com.uni.account.ejb.InternalAccountHome.class );
System.out.println( " 4" );
InternalAccountRemote r = home.find( this );
System.out.println( " 5" );
}
catch( Throwable e ) {
e.printStackTrace();
System.out.println( "Exception: " + e.toString() );
throw( new EJBException( e.toString() ) );
}
}
-----Original Message-----
From: Rickard Oberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 8:30 AM
To: jBoss
Subject: Re: [jBoss-User] External ejb reference
Hi!
"Nortje, Andrew" wrote:
> I am try to use external ejb references. The ejb's are running under the
> same jBoss server but deployed in two different jar's. I have followed the
> jBoss documentation (a cut and paste is given below). In the jboss.xml I
> have replaced the jndi-name with the jndi-name of Bean B (the
documentation
> example illustrates bean B running in another server)
>
> I get the exception
>
> [Customer] Exception: java.lang.NoClassDefFoundError: BHome
>
> Now I can use both Bean A and B independently from a client, so I know
they
> are properly deployed and bound in the jndi tree, however Bean A is unable
> to use Bean B.
Have you included B's interfaces in A's jar?
/Rickard
--
Rickard Oberg
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]