bpurcell.org - Debugging Tip: Identifying Which Jar file a class was loaded from in ColdFusion MX
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Subject Archives
Amazon EC2 (15)
ColdFusionMX (155)
Corvette (3)
Flash Lite (4)
Flash Media Server (5)
Flash Player (3)
Flex (39)
General Web Dev (14)
HDTV (3)
Jboss (1)
Jquery (2)
JRun (59)
Max 2003 (3)
Other (33)
PC Hardware (16)
Software (17)
SpatialKey (7)
Wireless (8)
Working Out (1)

RSS Feed
Feed Listing

Site Contents
My Blog
Wireless & Networking
Hardware & Gadgets
Software Picks
Contact Me

My Articles & Papers
Flex Performance
mm.com Under the Hood
Multiple Instances of CFMX
Multiple Instance Config
NLB with ColdFusion
Clustering CFMX for J2EE
Multi-Tier Hardware LB w CFMX
Cisco CSS & Coldfusion MX
JRun 4 Jini based Clustering
WiFi Growth

2ID Tacweb

Other Hobbys
Body-For-Life Challenge

Personal Projects
Family Pool
Deck Gate


Viewing Individual Entry / Main
December 3, 2003

I ran into a case where a developer was having issues with the Oracle driver packaged with CF.  This is a known issue and the workaround is to move back to the U3+ drivers.  After following replacing the macromedia_drivers.jar in JRun4\lib the problem still exhibited itself so the thought was that the drivers did not fix the problem.  My thought was that the problematic drivers were still being loaded from some other location.  There is an easy way to determine this in ColdFusion using the Java API.  Here is the code:

<cfset resource="macromedia/jdbc/oracle/OracleDriver.class">
#resource#: [#resolveResource(resource)#]<br>

<cffunction name="resolveResource" returnType="string">
<cfset var resourceURL = getClass().getClassLoader().getResource(resource)>
<cfif isDefined("resourceURL")>
<cfreturn resourceURL>
<cfreturn "could not resolve resource">

This code will return the location of the Jar file that is loading the class, and it output the following on my machine:

 macromedia/jdbc/oracle/OracleDriver.class: [ jar:file:/C:/JRun4/servers/latestcfbuild/cfusion/WEB-INF/cfusion/lib/macromedia_drivers.jar!/macromedia/jdbc/oracle/OracleDriver.class]

This told me that the drivers were being loaded from another location and they needed to update that Jar instead. 


test comment

Page Render Time:0