Error with relational mapping on new server - orm

I just moved a custom built CMS over to a live server (it was on the development server) because it is easier to set up RSS. The problem is that none of my relational mappings work anymore, despite me changing the application.cfclocation to reflect the new path. It uses an absolute path, as well. The setup is like so:
F:\...\cmsRoot\com\dac (this is the original path)
F:\...\cmsRoot\admin\com\dac (this is the path on the new server. The only difference is the extra layer for the admin folder; the drive letters are the same)
The Application.cfc and most pages are located in the cmsRoot and cmsRoot\admin folders, respectively. The dac folders contain my relational CFC files.
Originally, when loading each cfc for the first time Coldfusion would throw an error saying
"Error Occurred While Processing Request
Cannot load the target CFC abc for the relation property abc in CFC xyz
for each relational mapping (I commented them out to make sure every single one had the same problem).
After I added the line <cfscript>ORMReload();</cfscript> to the beginning of each CFC file, I could get past this error and access the login page just fine. However, now I get an error any time I try to create an entity:
Mapping for component abc not found.
The first instance that calls it (and throws the error) looks like this:
objectABC = EntityToQuery(EntityLoad("abc", {ActiveInd=1}));
I've already searched for any related problems on stackoverflow already, and it helped me fix the original error by adding ORMReload() calls. However, that doesn't solve the current problem. I've changed the mapping for the CFC's (in the Application.cfc) to use a relative path, and that did not help either (since I figured it was likely a mapping issue). I also checked folder permissions to make sure they matched, since one user said that fixed their problem. Both folders have the same permissions, as well.
Here's any useful Application.cfc info, if that helps:
this.ormsettings = { cfclocation = ["F:\...\cmsRoot\admin\com\dac", "F:\...\cmsRoot\admin\com"]
, dialect="MicrosoftSQLServer"
, eventHandling = true
};
The only difference I can find between the Application.cfc files on the two servers is the filepaths. Database is set up correctly, and the pages themselves have no problems (that I know of).
Another thing I've found is that commenting out any relational mappings causes everything to load correctly (minus any objectABC.getXYZ() calls since I removed those properties).
I have also restarted the Coldfusion application server, but there were no noticeable differences.
Is it possible that an Application.cfc farther up in the file structure is overriding any cfclocation settings I set up? I didn't think this would be the case, but since nothing seems amiss with my Application.cfc, I am out of ideas. And the application.cfc/.cfm lookup order (under "Settings" in the CFIDE administrator) is the same for both; set as default.
I have also tried removing the extra folder layer (so all mappings are the same), but the error is identical.
Update: By adding a specific mapping for /cmsRoot (to F:...\cmsRoot), I get a new error that the components are not persistent. However, all my cfc's start like this:
component persistent = "true" entityName = .....
Is there a reason why Coldfusion would think the entities aren't persistent even though I defined it otherwise? And yes, I have used ormReload() to make sure it is updated properly.

The solution I found was to add a specific mapping to the cmsRoot folder by using application.mappings['\cmsRoot'] = 'F:\...\cmsRoot'; in my Application.cfc file.
I had some old ormReload() calls at the top of all the .cfc files because that allowed some things to work; by deleting those calls it now loads properly.

Related

How to fix empty semantic media wiki query results after restore?

After restoring a semantic media wiki installation from backup the SMW engine does no longer return any query results. I have (re)inserted all regular pages, all form pages, all property pages into the new MW instance. So all content is there but query results remain empty. It seems as the internal data structures maintained by SMW are not filled. How can this be fixed? Are there any specific scripts that need to be run manually?
Indeed the internal SMW cache is not filled after restore. The solution is simple: You need to go to extensions/SemanticMediaWiki/maintenance and run the script rebuildData.php which will reparse every single Wiki page and fill the SMW database accordingly.
Be aware that for this to work your Wiki needs to be configured properly. By default SMW will not process additional namespaces! You need to enable this manually for every single namespace you add yourself in LocalSettings.php after the line where you enable SMW in this file. (This configuration will only have effect if you do this after the line that enables SMW.)

How do I change the location for a (single) filesystem in Ravendb?

My task: to move the directory containing the databases and filesystems for a Ravendb-installation from one drive to another (because of disk-space issues) without moving or altering the Ravendb-installation itself.
I managed to move the databases by:
shutting down the Ravendb service
Moving the data-folder containing the subfolders Databasesand FileSystems
Opening Raven.Server.exe.config and changing the value for the settings Raven/DataDirand Raven/FileSystem/DataDir
Starting the Ravendb service again
Tricky part: going to some (not all) databases using Raven Studio and choosing Settings > Database Settings and changing the value here (again) for Raven/DataDir. So apparently, somehow, for some of my databases, this value was overridden in some metadata for the db itself rather than using the tilde to look relatively to the global setting (although the actual db or db definition or something was being loaded correctly, since I could even see this setting/value)
So far so good. But here the problem:
Apparently, too, for some filesystems (again not all), Ravendb seemed to think, their "data-data" was still in the old location (again, the actual filesystem metadata seemed to be loaded from the new location). But alas, filesystem do not have something similar to Database Settings in Raven Studio where I could change this data-dir, probably overridden here too.
The way I know the filesystems' data is assumed to still be in the old location, is that I can see new folders being created in the old location with the name of the respective filesystems.
I tried going to the system db (Main Window > Manage Your Server > To System Database), but the file-systems do not appear here.
So my question is: how can I change or set the Raven/FileSystem/DataDir setting for a single filesystem?
Eureka, I found this out:
The error was indeed, that for some reason, my filesystems do not appear in the system db when viewed in Raven Studio. I realized this, because the status-bar in the system db said 40 documents, but fewer were visible in the list. This must definitely be a bug in Raven Studio.
The solution: In system db, put my mouse cursor in the quick-goto-/search-field in the top ("Go to document") and typed Raven/FileSystems/ and from here on, the autocomplete would show me the available filesystems. Choosing the correct filesystem, I was now able to edit the (indeed overridden) path to the filesystem, which was set to an absolute path.
Note, that in general you should definitely use a path relative to the Raven/DataDir and Raven/FileSystem/DataDir settings, like e.g. ~\filesystems\my-db to more easily be able to move all dbs and fs'es around collectively.

PouchDB corruption detection

I am building up a webapp with offline functionality. I am using combination of webcache and pouchDB to achieve it.
Currently I am testing recovery mechanisms against DB corruption. My premise is that since pouchDB is running in client, it is exposed to anyone who by mistake or on purpose can corrupt the DB. Also maybe in case of bugs or similar, DB could get corrupted. Then, if DB gets corrupted, unless it gets detected and clean by webapp, this will never work correctly.
Test is quite simple:
- Create PouchDB:
var dbOptions = {
auto_compaction : false,
cache : false
};
var db = new PouchDB('myDB',dbOptions);
With Developer Tools delete part of the database.
On loading the application it tries to read all documents:
db.allDocs({include_docs : true}, function(_err,_response){
(certain code here)
}
It is at this point when "Uncaught TypeError: Cannot set property '_rev' of undefined " is thrown. I tried to catch exception and using provided promise by pouchDB but none did work.
Did any of you fellows have similar problem? How did you solve it?
EDIT:
When PouchDB returns 500 Internal error, how is the application supposed to recover from it? I tried to destroy the database
db.destroy(function(err,info){console.log(err||info);}
but it does not work. It returns 500 Internal error as well.
It indeed sounds like your database got corrupted. Sorry about that; we try to write bulletproof code, but since we're working against the WebSQL/IndexedDB APIs, there's always the possibility that something goes wrong at that interface, the browser crashes, lightning strikes your computer, etc.
500 errors indicate an internal PouchDB error, so you're not supposed to recover from them. Probably the best way to protect against corruption like that is just to set up continual sync with a CouchDB server (kind of the point of PouchDB anyway). CouchDB is a full database implemented from top to bottom and is very robust – since it uses append-only database files, your database can never get corrupted. So if you use continuous sync, you can always delete the PouchDB database and recover from CouchDB.
That being said, if you could let us know which version of PouchDB you're running, which browser you saw this on, or even a code snippet to reproduce, that would be really helpful. If you're using Firefox, you can also send us the storage files themselves for IDB by following the instructions here to find the Profile folder and then sending us the contents of the storage/persistent/<my_site>/idb folder. Thanks!
I got this error while adding a new schema to my RxDB database. It turned out I included the primary key and wrong property names into encrypted fields. I removed the primary key and put proper names and it worked fine after that.

How to debug coldfusion orm settings and mappings

I'm having trouble with a specific ORM cfclocation not being mapped correctly. Coldfusion is checking in the cfclocation I have provided and then cacheing the mapping in a different location so that when I try to load the entity it can't find the cfc (its looking in the wrong folder).
This is only happening to one of my cfclocations. I have tried the same application on a cf10 server and it worked, and on another cf9 server where it didn't work.
So somehow its getting confused about where the cfc is located and generating a different location.
What I am wondering is how can I debug the process coldfusion is going through to cache the locations? I read the outline on orm's architecture on adobes doc pages and it mentioned coldfusion generating .hbmxml files. Where do I find these? Is there another way I can work out why coldfusion thinks a file is located somewhere else.
(I had another question similar to this which I deleted to post this one as the previous question was asking for a fix, this one is asking how to debug)
UPDATE:
I have turned saveMapping on and am getting the hbmxml files now. I can see that the class name is being generated incorrectly. Is there a way to manually set this? IS there a way to manually tell coldfusion what to map the location as. I have no clue why Coldfusion is mapping the location elsewhere.
Answers to questions below
The entityname, name, and file name are all the same.
The file is located in an area that uses a nameing convention that is the same for all of our applications which are working. In inetpub/resources/applications/[application name]/cfcs/orm.
I can dump out the array of addresses that are sent to cfclocation and it is clearly there. It has to be or the file wouldn't be detected in the first place. The ColdFusion and webroot are in different areas, but as mentioned before this works fine for all our other apps.
I have restarted the application and the ColdFusion service repeatedly while testing different things.
The folder that the hbmxml file specifies does not even exist, and never did.
Rebooting coldfusion has no effect. After messing around by adding additional mappings closer to the specific folder and then removing the mappings I eventually got the app working temporarily on my local site. but as soon as i moved it to another server it didn't work. so it seems like a 99% chance of not working

Set Coldfusion ORM not to affect parent folders

I came from PHP/MySQL background, and now I landed new back-end position as Coldfusion 9 developer. Im totally new with Coldfusion, so for learning and testing purposes I have installed CF on my localhost. On my localhost I have set and tested ORM, which worked perfectly, and it did not interfere with other parent folders. Once I uploaded my Application.cfc file to our main server, under site/project89/cfc/orm/
<cfcomponent>
<cfset this.name = "whatevername">
<cfset this.ormenabled = "true">
<cfset this.datasource = "name_db">
</cfcomponent>
It affected the whole parent server folders, including main "site" folder where we have all other coldfusion projects that were build before.
Is there a way to set ORM to affect only its own subdirectories and DO NOT make any changes to its parent folders?
Example, enable ORM for site/project89, and prevent ORM on other site/project**.
Any help or advise will be greatly appreciated, because where I work no one familiar with ORM and I can not afford to crash our server again.
Thank you.
I think the issue you are having relates to the location/struture of your application.
You need to move your Application.cfc to the root of site/project89.
From the ColdFusion docs:
When ColdFusion starts processing the request, it does the following:
It searches the page's directory for a file named Application.cfc. If
one exists, it creates a new instance of the CFC, processes the
initial events, and stops searching. (ColdFusion creates a new
instance of the CFC and processes its initialization code for each
request.)
If the requested page's directory does not have an
Application.cfc file, it checks the directory for an Application.cfm
file. If one exists, ColdFusion logically includes the Application.cfm
page at the beginning of the requested page and stops searching
further. If the requested page's directory does not have an
Application.cfc or Application.cfm file, ColdFusion searches up the
directory tree and checks each directory first for an Application.cfc
file and then, if one is not found, for an Application.cfm page, until
it reaches the root directory (such as C:).
When it finds an Application.cfc or Application.cfm file, it processes the page and
stops searching.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=appFramework_06.html (ColdFusion 8 but still relevant)
I guess under "affected" you mean that it is looking for model CFCs everywhere. If this is true, you can try to solve it by restricting the path of models:
this.ormsettings.cfclocation = "path.to.models";