Title:
Bug 85099:From an email exchange with Himavanth:In this case the folder with the components is above the currentfolder, so it's using a relative path:this
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Bob Silverberg / Bob Silverberg (Bob Silverberg)
Created: 11/18/2010
Components: ORM Support
Versions: 9.0.1
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 / 276000
Priority/Frequency: Major / Unknown
Locale/System: English / Platforms All
Vote Count: 2
Problem:
From an email exchange with Himavanth:In this case the folder with the components is above the currentfolder, so it's using a relative path:this.mappings["/common"]=GetDirectoryFromPath(GetCurrentTemplatePath() ) & "../../common";this.mappings["/local"]=GetDirectoryFromPath( GetCurrentTemplatePath()) & "../";Those mappings work fine for locating cfcs - CF is able to createobjects with paths using the mappings, but ORM is not able to writethe correct mapping to the hbmxml file. The example I am working withright now is very large and proprietary, so I cannot share it at themoment, but could you possibly do a quick test using mappings such asthose and see if you run into problems too.I found the the problem is a bit inconsistent. What happens most ofthe time is that the hbmxml file gets written with the path to the cfcjust being the cfc name, whereas is should be something like"common.model.myObj". However, on some rare occasions it does getwritten properly, with the correct mapping.I just did another test where I replaced those relative paths withactual physical paths to the folders and the problem went away! So itdoes sound like an issue with the relative paths.
Method:
More from the email thread:I was able to replicate the problem with your sample files. I thinkperhaps the reason you were not might have been because of thelocation of the files on your system.The way the app is configured, the folder in which the Application.cfcfile resides is the web root, so both the /actual folder and the/common folder reside outside of the web root. The actual app uses anApache vhost which points to the /app folder (in your example) as theweb root. Rather than setting up a vhost to test your files I simplyput all of the files in a folder outside of the web root and created asymbolic link to the app folder in my web root, so it looks somethinglike this:Webroot: /Library/WebServer/Documents/All files unzipped: to /Users/robertsilverberg/Documents/workspace/bobmax/so the resulting files look like:/Users/robertsilverberg/Documents/workspace/bobmax/actual/app/Applicaton.cfc/Users/robertsilverberg/Documents/workspace/bobmax/actual/app/bug.cfm/Users/robertsilverberg/Documents/workspace/bobmax/actual/C2.cfc/Users/robertsilverberg/Documents/workspace/bobmax/common/C1.cfcI deleted the hbmxml files for testing purposes.I then created a symbolic link that points to the folder:/Users/robertsilverberg/Documents/workspace/bobmax/actual/app/And I put that symbolic link into my webroot into a folder calledbobmax: /Library/WebServer/Documents/bobmax/When I browse to localhost/bobmax/bug.cfm the problem is replicated.There are some inconsistencies for when it happens, but I found thefollowing sequence is replicable on my system every time:1. Turn savemapping off - this makes it easier to replicate withouthaving to delete files.2. In the CF Admin, clear the template cache.3. Browse to localhost/bobmax/bug.cfm.I get the error:Mapping for component common.C1 not found.Either the mapping for this component is missing or the applicationmust be restarted to generate the mapping.The error occurred in/Users/robertsilverberg/Documents/workspace/bobmax/actual/app/bug.cfm:line 1311 : obj.setFirstname("James");12 : obj.setLastname("Bond");13 : entitysave(obj);14 : writeDump(obj);4. Refresh the page.I get the error:Could not find the ColdFusion component or interface C2.Ensure that the name is correct and that the component or interface exists.The error occurred in/Users/robertsilverberg/Documents/workspace/bobmax/actual/app/bug.cfm:line 1917 :18 : obj1 = createobject("component","local.C2");19 : obj1 = entitynew("C2");20 : obj1.setProductName("Pepsi");21 : obj1.setDesc("Beverages");5. Refresh the page.No more errors.6. Clearing the template cache via the CF Admin always brings me backto step 3. That is, I forst get an error on C1, then it is fixed onthe next request, and I get an error on C2, then it is fixed on thenext request.If I set savemapping="true" I get the following hbmxml files (afterclearing the template cache):C1.hbmxml:<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping> <class entity-name="C1" lazy="true" name="cfc:C1" table="comp1"> <id name="id" type="int"> <column name="id"/> <generator class="native"/> </id> <property name="firstname" type="string"> <column name="firstname"/> </property> <property name="lastname" type="string"> <column name="lastname"/> </property> </class></hibernate-mapping>C2.hbmxml:<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping> <class entity-name="C2" lazy="true" name="cfc:C2" table="comp2"> <id name="id" type="int"> <column name="id"/> <generator class="native"/> </id> <property name="productname" type="string"> <column name="productname"/> </property> <property name="desc" type="string"> <column name="`desc`"/> </property> </class></hibernate-mapping>Please try placing the test files as I have described and let me knowif you can recreate the issue.
Result:
Errors resolving component paths when reloading orm
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3042802
External Customer Info:
External Company:
External Customer Name: Bob Silverberg
External Customer Email: 5AD606C248A4C7F0992015A9
External Test Config: 11/18/2010
Attachments:
Comments: