Thanks Charlie and Jason for the info. I did move the classloader jar file to the wwwroot\WEB-INF\lib directory like you suggested. I then stopped, and then started CF. Even after doing so, line 211 of JavaLoader.cfc is throwing this exception:

java.lang.ClassNotFoundException: com.compoundtheory.classloader.NetworkClassLoader at java.net.URLClassLoader

I'm using JavaLoader 1.1, and this worked fine in CF 7, 8, and 9. I have verified that I'm not running CF 10 in sandbox security mode and I do not have the option checked under settings called "Disable access to internal ColdFusion Java components ". So, I'm curious to see how other people managed to get this working. I think I'm going to reach out to Mark Mandel on the JavaLoader mailing list. I found this and Ray Camden mentions the fact he's using the latest from the dev branch:

https://groups.google.com/forum/#!topic/javaloader-dev/8pq54Z0oN7U

I did grab the latest JavaLoader.cfc, and it didn't help. Clearly, I'm doing something wrong - but nothing is jumping out at me yet.

Thanks again for the info.

On 9/21/12 9:45 AM, Charlie Arehart wrote:

Interesting questions, Mike. While I don't for now know the answer to your question about the new dyamic loader feature, I will offer a couple of thoughts with respect to your problem trying to get javaloader working, and it's possible that what I share may even help you with getting your other intended class to load using the CF feature.

First, beyond Doug's helpful comment about classpath search order, there's still another factor that could influence things, especially in that you are trying to override a class loaded by CF. There's actually more to class loading in app servers like JRun (CF9 and before) and Tomcat (CF10). There are in fact several places where classes or Jars can be placed to different effect. For more on how things are likely working in CF10, being based on Tomcat, see the Tomcat 7 docs for more: http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html

As that indicates, there is also a difference about what you are specifically trying to override. Some things can't be at all, while others can only be depending on where you place the classes/jars to do the override. Note in particular, "There are exceptions. Classes which are part of the JRE base classes cannot be overridden. For some classes (such as the XML parser components in J2SE 1.4+), the J2SE 1.4 endorsed feature can be used. Last, any JAR file that contains Servlet API classes will be explicitly ignored by the classloader."

There's also useful info here: http://www.mulesoft.com/tomcat-classpath.

One last thing: you mention dropping the javaloader into cfusion/lib, and that may have "worked", but as you note you got an error. Typically, though, the place to put jars for CF (whether on jrun or tomcat or something else) is to put it in the [cf]\wwwroot\WEB-INF\lib (or classes, if it's just a class file). I wonder if you may see a difference doing it there instead.

Of course, in CF10, that wwwroot is in [cf10]\cfusion\wwwroot for the default instance, and would be [cf10]\[instancename]\wwwroot if you add instances with the Instance Manager (available in Enterprise, Trial, or Developer editions). Just being clear because if you put it in the wrong place for the instance you're using, that would certainly cause other problems! :-)

Let us know if this helps, and for sure, if you find out more about the new dynamic loader and how it may help you with your first challenge, please do report back here.

/charlie

*From:*[email protected] [mailto:[email protected]] *On Behalf Of *Mike Staver
*Sent:* Friday, September 21, 2012 2:51 AM
*To:* [email protected]
*Subject:* Re: [ACFUG Discuss] CF 10 Dynamic Java Loading

Thanks for the info. The idea I'm starting to get here is that there really isn't a built in method like JavaLoader in CF 10. With JavaLoader, I can be very specific - load up a jar into the server scope and access it whenever I choose. If I understand this correctly, CF 10 gives us the ability to load jar files - but in doing so, they can override the built in ones, which would in fact surely break a tag or two in the case of POI. I think that leaves me back to using JavaLoader, which I'm OK with. The only problem I have is I can't figure out how to make it work in CF 10. I have taken the classloader jar file and put in cfusion/lib and bounced CF. It shows up as a valid class, and I can create objects with it like so:

<cfobject type="java" class="com.compoundtheory.classloader.NetworkClassLoader" name="test">

However, when I run my usual JavaLoader code, it bombs. The code is:

<cfif NOT structKeyExists(server, var.JLKey)>
<cfset server[var.JLKey] = createObject("component", "component.JavaLoader").init(loadPaths=var.paths, loadColdFusionClassPath=true) />
</cfif>

When running this code, specifically line 211 of JavaLoader.cfc throws this exception:

java.lang.ClassNotFoundException: com.compoundtheory.classloader.NetworkClassLoader at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at

Has anyone seen this with CF 10 and been able to work around it?


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink <http://www.fusionlink.com>
-------------------------------------------------------------




-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to