> Would it make sense for your connection objects to work across VMs? I
> could make it an option to bind the factory to the global namesapce.
Probably not now that I think about it. I guess you would just run the
resource adapter in "two-tier" mode and use the DefaultConnectionManager.
> > ClassCastException on the JCA-side when I go to do
> Sorry, what does "on the JCA-side" mean? Is this inside your resource
> adapter code, or in your EJB code?
sorry, here's the sequence - for a CCI connection, you don't make method
calls directly on the connection, rather you use the connection as a factory
for an interaction and call your methods by invoking execute on the
interaction and passing in an input record which is the data for the call,
and an interactionspec, which is meta-information about the call (in my case
that's the function name in the back-end system)
interface SInteractionSpec extends javax.resource.cci.InteractionSpec
class SInteractionSpecImpl implements SInteractionSpec
interface SRecord extends javax.resource.cci.Record
class SRecordImpl implements SRecord
1. [client] talks to Bean, calls bean.noop()
2. [bean] looks up jca adapter in jndi and:
3. [bean] gets the ConnectionFactory (works)
4. [bean] gets a Connection from the ConnectionFactory (works)
5. [bean] gets an interaction from the Connection (works)
6. [bean] creates instance of SRecordImpl and SInteractionSpec (works)
7. [bean] passes the instances into Interaction.execute(InteractionSpec a,
Record b) (dies)
8. [jca adapter's interaction class] tracks down the real back-end
connection (works)
9. [jca adapter's interaction class] tries to cast InteractionSpec "a" into
an SInteractionSpecImpl
(ClassCastException is thrown)
> I don't understand where these messages are from. Can you post some code
> that shows what you are actually logging?
sorry again... the Tracing is coming from inside the JCA adapter, and
specifically from inside the Interaction class "SNoTxInteraction". It dumps
what it sees as arguments when step 7 above happens, which is:
the method looks like:
public Record execute(InteractionSpec ispec, Record input) {
if(Trace.TRACE) Trace.trace("Record execute(" + ispec + ", " + input +
")", this);
and when it gets called by the bean, it writes out:
> [TRACE] com.xxx.jca.cci.SNoTxInteraction: Record
> execute(com.xxx.jca.cci.SInteractionSpecImpl@78dc4c,
> com.xxx.impl.SRecordImpl@51283116)
then it just calls ispec.getClass() and ispec.getClassLoader(), and you can
see that the args were created by the bean's classloader:
> [TRACE] ispec class is:com.xxx.jca.cci.SInteractionSpecImpl
> [TRACE] ispec classloader is:java.net.URLClassLoader@3bdd48
> [TRACE] input class is:com.xxx.impl.SRecordImpl
> [TRACE] input classloader is:java.net.URLClassLoader@3bdd48
which is different than the resource adapter's classloader:
> [TRACE] My classloader is:java.net.URLClassLoader@3a1834
so the line
SInteractionSpecImpl sisi = (SInteractionSpecImpl)ispec;
which should work, instead throws:
> [ERROR] com.xxx.jca.cci.SNoTxInteraction:
> Exception in class-cast:java.lang.ClassCastException:
> com.xxx.jca.cci.SInteractionSpecImpl
> [MetaBean] java.lang.ClassCastException:
> com.xxx.jca.cci.SInteractionSpecImpl
hopefully that is a little better description.
> At the moment, there is no way for an EJB to load classes from the RAR. If
you
> want to pass around anything other than standard interfaces then you'll
need
> to put those interfaces and/or classes somewhere accessible to both the
EJB
> classloader and the RAR classloader. The system classpath or lib/ext
should
> work.
Ok, I tried putting the four classes:
SRecord, SRecordImpl, SInteractionSpec, SInteractionSpecImpl
into a jarfile and throwing it into lib/ext, then removing those same files
from the bean and the resource adapter but both the bean and the jca adapter
complained they couldn't find the classes.
I will try again and also on the system classpath and let you know how that
works out. Do they need to also be in the .rar and .ear files? (or do they
need to NOT be in those files?)
thanks,
-d
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]