You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Mike Engelhart <me...@earthtrip.com> on 2000/01/22 00:00:40 UTC

Cocoon access from XSP

I'm having trouble accessing objects that i have added to Cocoon from within
XSP's.  I have this code which works fine in my Producer classes but throws
a null pointer exception when I try and do it from within an XSP.

Connection conn = ((DBBroker) director.getActor("dbPool")).getConnection();

I thought XSP's were compiled into Producers?  Wouldn't they be able to
access the Cocoon engine as easily as a hand coded one?  The XSPPage class
extends AbstractProducer so I should be able to access director right?


Also I load in a bunch of PropertyResourceBundle's on startup and get this
error when I try and access them.

java.lang.NoSuchMethodError: java.lang.ClassLoader: method
getParent()Ljava/lang/ClassLoader; not found
    at 
org.apache.cocoon.processor.xsp.language.java.XSPClassLoader.loadClass(XSPCl
assLoader.java:83)
    at java.lang.ClassLoader.loadClass(Compiled Code)
    at java.util.ResourceBundle.findBundle(Compiled Code)
    at java.util.ResourceBundle.getBundle(Compiled Code)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java)

Ricardo thought it was probably because of a mismatched .jar file trying to
access a JDK1.2 method (getParent()) but I have double-checked all my jar
files and they're all up to snuff.  Also, my custom producers that basically
do the same thing work fine too.


Mike


RE: Cocoon access from XSP

Posted by Gerard van Enk <ge...@eo.nl>.
> I'm having trouble accessing objects that i have added to Cocoon
> from within
> XSP's.  I have this code which works fine in my Producer classes
> but throws
> a null pointer exception when I try and do it from within an XSP.
>
> Connection conn = ((DBBroker)
> director.getActor("dbPool")).getConnection();
>
> I thought XSP's were compiled into Producers?  Wouldn't they be able to
> access the Cocoon engine as easily as a hand coded one?  The XSPPage class
> extends AbstractProducer so I should be able to access director right?
>

Did you solve this problem?? I'd like to do something like this, but I don't
know if this is the right way to do it???

Gerard