[Coldbox-4.0] Injecting VirtualEntityService - Dependency Not Found

Starting a brand new project, I am trying to get ORM configured and my first VES working. I’ve downloaded the ColdBox bundle and placed the folder in the root of my application. I’ve also downloaded the Wirebox standalone and placed it in the same app root. In the Application.cfc, I’ve created the following mappings:

this.mappings[ "/coldbox" ] = "#getDirectoryFromPath(getCurrentTemplatePath())#coldbox/"; this.mappings[ "/wirebox" ] = "#getDirectoryFromPath(getCurrentTemplatePath())#wirebox/";

In the Coldbox.cfc config, I added the following:

//Wirebox wirebox = { singletonReload = true, binder = 'config.WireBox' };

In my handler (models/Hierarchy.cfc), I am trying to inject the following:

property name="businessService" inject="entityService:hierarchy.BusinessService";

That service is located in models/hierarchy/HierarchyService.cfc with the following:

component extends="models.BaseService" { BusinessService function init () { super.init(entityName="Business", useQueryCaching = true); return this; } }

When calling the handler, I get:

Type: Builder.DSLDependencyNotFoundException
Messages: The DSL Definition {JAVACAST={null},NAME={businessService},ARGNAME={},DSL={entityService:hierarchy.BusinessService},VALUE={null},SCOPE={variables},REQUIRED={true},REF={null},TYPE={any}} did not produce any resulting dependency The target requesting the dependency is: ‘groups.na.dialerstrategy.Dev.Sandbox_tmp.handlers.Hierarchy’

The only thing different about this project than previous ones I’ve implemented Coldbox in is the need for me to include the Wirebox framework along side Coldbox. I don’t remember having to do that in the past, but without it, references to coldbox.system.orm.* do not exist. I don’t know if this is part of the issue though… I thought the Coldbox bundle included Wirebox.

So to start, can you confirm what version of ColdBox you i’ve actually installed. The subject of your message said 4.0, however ColdBox 4.0 is still in release candidate status and I don’t think there’s a “bundle” version of the download yet.

Secondly, you don’t need to install WireBox along side ColdBox. If you’re having issues with component paths not working, that’s a different issue.

If you’re using ColdBox 3.x, the ORM stuff is built in. If you’re actually using ColdBox 4.0, then you’ll need to install the cborm module. I’d recommend you be using CommandBox to do all of this for many reasons, including the dependant modules that cborm requires. CommandBox (which acts as a package manager) will take care of all that for you.

Open the CommandBox interactive shell and issue the following commands:

cd C:\path\to\your\app
install coldbox-be
install cborm
list

That last command will have you a nice overview of everything you have installed. Note, the cborm module requires you to manually add a “/cborm” mapping to your Application.cfc for it to work.

Next, the wirebox.binder setting isn’t really necessary unless you’ve but your WireBox config somewhere different than the default location of /config/Wirebox.cfc. Also, make sure you only enable wirebox.singletonReload on your development server. I recommend setting it to false in the main config, and overriding it to true in your development function.
http://blog.coldbox.org/blog/tip-of-the-week-using-environment-control-in-coldbox

property name=“businessService” inject=“entityService:hierarchy.BusinessService”;

When using the entity service to load entities, ColdFusion’s ORM is employed which means you need to reference the entity name, not the full path. However, I think you may be confused about what you’re doing. You only need to use the “EntityService” injection namespace if you want a VIRTUAL entity service. Your code seems to imply that you’ve created a concrete entity service which means you should just inject it directly. it also needs to extend the correct entity service base classes, which I can’t tell since you didn’t include the source of your BaseService CFC. Your examples also seem to be switching back and forth between a HierarchyService and a BusinessService so it’s a little hard to follow what you’re doing.

> references to coldbox.system.orm.

There are no more references to coldbox.system.orm in ColdBox 4.0 which is another reason why we need to determine just what version of ColdBox you’re actually using. Please read through our ColdBox 4.0 compatibility guide that explains this all:

http://wiki.coldbox.org/wiki/Compatibility:4.0.0.cfm

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks for the reply, Brad.

To confirm, I am using 4.0 even though it’s still the RC. On the download page, there is an option for “standalone” and “bundle”. I downloaded both. The bundle appears to include the API docs, sample folder structure, and a few other non-related items.

The only reason I installed Wirebox along side was in the ORM settings example, it had
this.ormSettings.eventHandler = "coldbox.system.orm.hibernate.EventHandler"

which did not seem to be a valid component and was only available in wirebox.system.orm.hibernate.*. It may be referenced differently, or no longer applicable anymore since the docs says it’s only current to version 3.7.0. Do I need this setting?

I got confused on the VirtualEntityService because in my example I certainly had a concrete service. My BaseService was also extending coldbox.system.orm.hibernate.VirtualEntityService but I now see where I messed up there.

I’m having a difficult time accessing the docs from work due to the proxy. Unfortunately almost everything is blocked in the wiki/blog/api. All downloads are blocked too which made this difficult for me to get setup. (downloaded to my phone, e-mailed zip to myself, downloaded from e-mail). This also leaves out the option for CommandBox since permissions will not allow me to use it (no local dev here). This leaves my research to happen either through the luck of cached Google results, Google Groups, or wait until I get home. :slight_smile:

Thanks, Brad. I had a more elaborate post typed out, but it seems to have disappeared. To recap in short:

I am using CB 4. There is a “bundle” and “standalone” download option, those it appears the only difference is the app folder structure and API docs.

Most things related to Ortis products (wiki/api/docs/downloads) is blocked by a proxy so I was able to do limited research on the Virtual Entity Service, thus the confusion on how it was implemented. It makes sense now.

CommandBox isn’t a solution unfortunately, though it’s the first thing I tried. Strict system policies prevent the application from running, and the proxy would likely block external resources to think like ForgeBox where (I assume) cborm is located.

I’ll try a few things tomorrow and I’m sure this will be resolved.

Is this a proxy on your network? I can’t imagine developing in whatever environment you seem to be in. Can you raise a bug for whatever issues you have with CommandBox so we can see if it can be worked around?
https://ortussolutions.atlassian.net/browse/COMMANDBOX/

Please note, the “release candidate” downloads on coldbox.org are rather out of date. (October, I think). Please download the bleeding edge from ForgeBox or our integration server:
http://www.coldbox.org/forgebox/view/coldbox-be
http://integration.staging.ortussolutions.com/artifacts/ortussolutions/coldbox/4.0.0/

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’ll take a look and see if I can get anywhere further with CommandBox and provide info as I get it. I have a feeling any road block is still going to based on local policies.

The proxy is on the network. There’s no local dev and certainly not admin access. I can’t plug in headphones without the security policy disabling the hardware. I’ve only been able to get Coldbox by downloading to my phone, e-mailing to myself, and accessing e-mail from the dev PC. Financial institutions sure know how to make development efficient :wink: