Re: RhinoWrapper Exception
Attila Szegedi <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
What are the FreeMarker and the Rhino versions you are using? Rhino
changed a declaration of the "Undefined.instance" variable in a manner
that was not binary compatible, so certain combinations of Rhino and
FreeMarker unfortunately exhibit this...
Attila.
On 2009.01.30., at 7:14, Patrick Dobbs wrote:
> Hi,
>
> I'm trying to use Freemarker from a Rhino javascript script. I've the
> couple of related newsgroup posts on this, but not being that familiar
> with Freemarker I suspect I'm going something wrong.
>
> Below is the Rhino shell session.
>
> Thanks
>
> Patrick
>
>
> js> importPackage(Packages.freemarker.template);
>
> js> cfg = new Configuration();
> freemarker.template.Configuration@195dd5b
> js> cfg.setObjectWrapper(new Packages ext.rhino.RhinoWrapper());
> js> cfg.setDirectoryForTemplateLoading(new java.io.File("./
> templates"));
> js> root = {}
> [object Object]
> js> root.name="Joe";
> Joe
> js> root.age="7";
> 7
> js> out = new java.io.OutputStreamWriter(java.lang.System.out);
> java.io.OutputStreamWriter@1dacccc
> js> temp = cfg.getTemplate("test.ftl");
> <tr>
> <th>Name</th><td>${name}</td>
> </tr>
> <tr>
> <th>Age</th><td>${age}</td>
> </tr>
> js> temp.process(root,out);
>
> Exception in thread "main" java.lang.NoSuchFieldError: instance
> at freemarker.ext.rhino.RhinoWrapper.wrap(RhinoWrapper.java:21)
> at
> freemarker
> .template.Template.createProcessingEnvironment(Template.java:356)
> at freemarker.template.Template.process(Template.java:237)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword