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.
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 205203: <cffunction name="loadClasses" hint="loads up the classes in the system" access="private" returntype="void" output="false">called from/Users/ron/Sites/local/www/javaloader/JavaLoader.cfc: line 51
204: <cfscript>
205: var iterator = getClassLoadPaths().iterator();
206: var file = 0;
207: var classLoader = 0;
49: ensureNetworkClassLoaderOnServerScope();called from/Users/ron/Sites/local/www/jltest.cfm: line 4
50:
51: loadClasses();
52:
53: if(structKeyExists(arguments, "sourceDirectories") AND ArrayLen(arguments.sourceDirectories))
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 Stacktrace No 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.
> 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 |
Haha, no worries. I did not catch it right off the bat either... despite seeing "STRUCT.iterator()" ;-) -Leigh |