Re: Problem using JavaLoader with Railo: No matching Method/Function for Struct.iterator() found

311 views
Skip to first unread message

Barnaby Relph

unread,
Mar 19, 2013, 9:39:55 AM3/19/13
to javaloa...@googlegroups.com

I'm sure you're already aware, but railo 4 ships with POI 3.8. I was using java loader in railo 3.3 but switched to using the built in POI in 4.0.

On 19 Mar 2013 13:04, "Ron Stewart" <ron.s...@gmail.com> wrote:
I'm clearly doing something wrong... I'm trying to use JavaLoader to load the Apache POI jars in a simple test file running under Railo 4.0.4.001 and failing miserably. I'm new to using JavaLoader, so I'm sure the problem is something really simple on my end...

Consider the following code:

<cfscript>
variables.jarsPaths = ArrayNew(1);
variables.jarPaths[1] = ExpandPath("poi/poi-3.9-20121203.jar");
variables.jl = CreateObject("component", "javaloader.JavaLoader").init(variables.jarPaths);
</cfscript>

Running it generates the following error:

Railo 4.0.4.001 Error (expression)
Message No matching Method/Function for Struct.iterator() found
Stacktrace The Error Occurred in
 /Users/ron/Sites/local/www/javaloader/JavaLoader.cfc: line 205
203: <cffunction name="loadClasses" hint="loads up the classes in the system" access="private" returntype="void" output="false">
204: <cfscript>
205: var iterator = getClassLoadPaths().iterator();
206: var file = 0;
207: var classLoader = 0;

 called from/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc: line 51
49: ensureNetworkClassLoaderOnServerScope();
50: 
51: loadClasses();
52: 
53: if(structKeyExists(arguments, "sourceDirectories") AND ArrayLen(arguments.sourceDirectories))

 called from/Users/ron/Sites/local/www/jltest.cfm: line 4
2: variables.jarsPaths = ArrayNew(1);
3: variables.jarPaths[1] = ExpandPath("poi/poi-3.9-20121203.jar");
4: variables.jl = CreateObject("component", "javaloader.JavaLoader").init(variables.jarPaths);
5: </cfscript>

Java StacktraceNo matching Method/Function for Struct.iterator() found
   at railo.runtime.reflection.Reflector.throwCall(Reflector.java:831):831
   at railo.runtime.reflection.Reflector.callMethod(Reflector.java:797):797
   at railo.runtime.type.util.MemberUtil.call(MemberUtil.java:74):74
   at railo.runtime.type.util.StructSupport.call(StructSupport.java:236):236
   at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
   at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
   at javaloader.javaloader_cfc$cf._1(/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc:205):205
   at javaloader.javaloader_cfc$cf.udfCall(/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc):-1
   at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
   at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
   at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
   at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
   at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
   at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
   at javaloader.javaloader_cfc$cf._1(/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc:51):51
   at javaloader.javaloader_cfc$cf.udfCall(/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc):-1
   at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
   at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
   at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
   at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
   at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
   at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
   at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
   at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
   at jltest_cfm$cf.call(/Users/ron/Sites/local/www/jltest.cfm:4):4
... (snipped)

I'd be grateful if someone could point out what I'm doing wrong...

Thanks in advance.

-- 
/ron

--
You received this message because you are subscribed to the Google Groups "javaloader-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javaloader-de...@googlegroups.com.
To post to this group, send email to javaloa...@googlegroups.com.
Visit this group at http://groups.google.com/group/javaloader-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ron Stewart

unread,
Mar 19, 2013, 10:36:43 AM3/19/13
to javaloa...@googlegroups.com
Yeah, I'm aware... I'm actually trying to work around a different problem at this point and am trying to prototype a solution, but got stuck right out of the gate.

Leigh

unread,
Mar 19, 2013, 3:25:50 PM3/19/13
to javaloa...@googlegroups.com
> variables.jarsPaths = ....
> variables.jarPaths[1] = ....

There is a typo in the variable name after the first line. So you are actually passing a structure into javaLoader.init() not an array.  Make it "jarPaths" all the way through and it will work.

-Leigh

Ron Stewart

unread,
Mar 19, 2013, 4:34:00 PM3/19/13
to javaloa...@googlegroups.com
GAH! Thank you, Leigh. Talk about embarrassing...

Leigh

unread,
Mar 19, 2013, 4:43:34 PM3/19/13
to javaloa...@googlegroups.com
Haha, no worries. I did not catch it right off the bat either... despite seeing "STRUCT.iterator()" ;-)

-Leigh

Ron Stewart

unread,
Mar 19, 2013, 4:57:03 PM3/19/13
to javaloa...@googlegroups.com
Now, I just need to find a way to delete this entire thread and crawl back under my rock...
Reply all
Reply to author
Forward
0 new messages