cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist>
Subject Hibernate + Flowscript = trouble? Help!
Date Wed, 22 Jun 2005 05:40:21 GMT
Hi all,

I got a really nasty bug goin' on here.

An object percolating up into flow from my model layer was retrieved by 
Hibernate, and I'm getting the old "TypeError: xxxx is not a 
function.", and of course it is a public function in a freshly cleaned 
and compiled class in a cold-started Jetty instance (i.e. my usual 
dumb-@$$ reasons for this error already checked :-).

I have my flowscript print the object, and it's of the type I expect:


...or so it would seem.  But if I say this:

    print (order.payment.getClass().getName());

...then I get this:


OK, now maybe we are getting somewhere — Payment is the abstract base 
class of CreditCardPayment, and I've got a CGLIB proxy from Hibernate.  
I guess Rhino has to reflect on the object to wrap it, and this is 
screwing it up.


	 print (order.payment.process);			// a method from Payment
      print (order.payment.getCreditCard);	// a method from 

...gets this:

	function process() {/*
		void process()


So Rhino is not able to figure out that this is really a 
CreditCardPayment, I guess.

I figured that if I rummaged around in Rhino, I just might find 
something to help me.  I'm a total babe-in-the-woods here, I started 
with a "jar tf" on the Rhino jar to look for promising Javadocs to 
Google.  "Hmm, org.mozilla.javascript.NativeJavaObject, that looks 
hopeful, at least it might start me in the right direction... hey, it 
has this static method coerceType, that looks like just what I need!"

SooOOOOooo, I tried this:

	var creditCardPaymentClass =
	if (order.payment.type == PaymentMethod.CREDIT_CARD) {         		var 
ccPayment = NativeJavaObject.coerceType (

and.... pfffft.  I guess it did sound too good to be true.  I get:

	Cannot convert 
us.rocketsurgery.ecommerce.creditcards.CreditCardPayment@d4446b to 

Well... shoot and phooey!!!  I'm stuck and out of ideas.  Has anybody 
else ever run into anything like this, or have any ideas what I might 
try next?

Grumble, grumble, time for bed...

P.S.  Oh yeah, I tried setting 
hibernate.cglib.use_reflection_optimizer=false.  Didn't help.

View raw message