mike rowse a écrit :

Hey.
I am not a java programmer generally (although I understand enough
syntax to be able to get by). I am currently starting to learn how to
extend cocoon through additional java programming (as I'm going to have
to wrap some one elses java work to be used through cocoon).

With this in mind I have created a simple class that I wanted to load
through flowscript to get going.
class TestKlazz {
  public TestKlazz(){
        // Tried with this line and without
        // System.out.println("initialized");
  }
}

This class has been compiled and placed in
$COCOON/build/webapp/WEB-INF/classes

In flowscript I've called this function
function testj(){
        var test_obj = Packages.TestKlazz();
        cocoon.sendPage("/");
}

You need to instantiate your class by using

var test_obj = new Packages.TestKlazz();

Upon navigating to the pipeline that calls this function I get the
error.

org.mozilla.javascript.EvaluatorException:
"file:/home/sator/mike/work/hyperpo/trunk/hyperpo/controller/hyperpocontroller.js", line 84: 
Internal error: attempt to access private/protected field "Class org.mozilla.javascript.NativeJavaClass 
can not access a member of class TestKlazz with modifiers "public"".

I will post the stacktrace if this might help. The machine I'm using is
running cocoon 2.1.8 and the JVM is version 1.4.2 - 03

I have tried playing with the class loader setting in web.xml and I have
tried setting cocoon to run as a paranoid servlet. This is a very
bizarre error (for such a simple class) and I can't find any mention of
a similar problem on any of the mailing lists. The kind folks on IRC
were also baffled (since this is seems to be very frequently done).
I'm guessing there is something conceptually missing on my part or a
dumb gotcha. Any help is greatly appreciated.
Thanks,
Mike

------------------------------------------------------------------------

As an aside. Originally I was trying to run this class from a location
outside of the usual locations (a need of the project). I was able to
get the same error adding another directory through setting a
<classpath></classpath> parameter in cocoon.xconf (for the flowscript).
I stumbled upon this way of adding classes to the flowscript classpath
through documentation for old versions of cocoon and there is no mention
as far as I can see in the current documentation. I thought I'd mention
this because it was the only way I extend the flowscript classpath but
it seems like a deprecated way of doing things.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Philippe GASSMANN
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]