Re: A couple of WebLogic specifec questions

David Jencks <[email protected]> Sun, 16 Feb 2003 23:38:39 -0500
Newsgroups gmane.comp.java.sun.connector
Message-ID <[email protected]>
I think the problem is that the copy of the class loaded from your war
is in a different classloader than the copy loaded from the .rar.
Therefore, they are different classes and you get a class cast
exception trying to cast one to the other.  Putting the classes in the
system class path solves this by having both classloaders delegate to
their parent and thus eventually to the system classloader: thus you
get the same class for both.  I recall complaints about this when the
jca spec first came out but I thought WL had come up with a solution.
JBoss solves this kind of problem by having a dynamically extensible
classloader scheme: both the war and rar can be loaded separately yet
their classes are visible to each other.

david jencks

On Sunday, February 16, 2003, at 11:26 PM, Jason wrote:

> Hello,
>
> First of all, I apoligize if this post is off-topic
> for this list, but I'm trying to deploy my RA into
> WebLogic and I've run into an issue.
>
> I've successfully deployed my RA in WebLogic 7.0 and
> added a bit of test code to a jsp to do a lookup for a
> ConnectionFactory and call getConnection( ).  The code
> looks like this:
>
> com.mycompany.ConnectionFactory cf =
>   (com.mycompany.ConnectionFactory)
> ic.lookup("java:comp/env/MyCtr");
>
> cf.getConnection( );
>
> The lookup( ) succeeds but I get a class cast
> exception on the cast to ConnectionFactory.  If I
> instead just declare the reference to Object and then
> call getClass( .getName( ) I get
> com.mycompany.ConnectionFactoryImpl just as I'd
> expect.  Further, if I then use reflection I can
> verify that the object does in fact implement
> ConnectionFactory.  However, if I do 'cf instanceof
> ConnectionFactory' it fails which is in agreement with
> the Class Cast Exception.  I've also tried 'casting'
> the ConnectionFactoryImpl to a ConnectionFactoryImpl
> and this also fails.
>
> I've included all of the relevent classes in both the
> Deployed Resource adapter (stand alone) as well as the
> classes directory of the war file containing the JSP
> so I can't figure out what's going on.
>
> The only way I've found to solve the problem is to add
> the classes to the App Servers ClassPath explictly but
> I'd really rather not do that and in fact WebLogic's
> own documentation discourages it.  Actually, I'm
> bothered that this solves the problem; since I wasn't
> getting a ClassDefNotFound error, but rather a CCE.
> In any case,   can anyone explain this behavior?
>
> -Jason
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
>
> =======================================================================
> ====
> To unsubscribe, send email to [email protected] and include in the
> body
> of the message "signoff CONNECTOR-INTEREST".  For general help, send
> email to
> [email protected] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff CONNECTOR-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".