coldbox w/railo

All,

To be quick, I cannot get a coldbox app running under railo. I get the
following error on a fresh new application...

"invalid component definition, can't find coldbox.system.coldbox"

also when I browse to the cb dashboard, I do not get any styles or
images...

I'm not sure if I have to do anything different, but I've setup railo/
resin running with apache, and also setup a vhost pointing to my newly
created cb app.

here's my stack trace:
invalid component definition, can't find coldbox.system.coldbox
  at railo.runtime.component.ComponentLoader.loadComponentImpl(Unknown
Source):-1
  at railo.runtime.ComponentImpl.init(Unknown Source):-1
  at application$cfc.initComponent(/Users/sal/Sites/railo_test/
Application.cfc):-1
  at application$cfc.newInstance(/Users/sal/Sites/railo_test/
Application.cfc:16):16
  at railo.runtime.component.ComponentLoader.a(Unknown Source):-1
  at railo.runtime.component.ComponentLoader.loadComponentImpl(Unknown
Source):-1
  at railo.runtime.listener.ModernAppListener._onRequest(Unknown
Source):-1
  at railo.runtime.listener.MixedAppListener.onRequest(Unknown
Source):-1
  at railo.runtime.PageContextImpl.execute(Unknown Source):-1
  at railo.runtime.engine.CFMLEngineImpl.serviceCFML(Unknown Source):-1
  at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):32
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:91):91
  at com.caucho.server.dispatch.ServletFilterChain.doFilter
(ServletFilterChain.java:103):103
  at com.caucho.server.webapp.WebAppFilterChain.doFilter
(WebAppFilterChain.java:175):175
  at com.caucho.server.dispatch.ServletInvocation.service
(ServletInvocation.java:240):240
  at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:
424):424
  at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481):
481
  at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685):685
  at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607):607
  at java.lang.Thread.run(Thread.java:613):613

any thoughts?

Just create /coldbox CF - Mapping :slight_smile:

Thanks
Sana

right on, I figured as much...

Is this necessary for coldbox to run under railo?

thanks

This is necessary to run anything that resides outside of the application’s web root. Doesn’t matter if it’s ColdBox, ColdSpring, Transfer, or BillyJoeBobsSuperDuperBadAssFramework. If it resides outside of the web root, it must be mapped.

NOTE: You can also setup a Virtual Directory (IIS) or an Alias (Apache), but that is a horrible “solution” because you’ve now made the entire framework code browsable via the web.

"This is necessary to run _anything_ that resides outside of the
application's web root."

how do you figure? when running coldbox with adobe CF8, there is no
mapping necessary, also Im a bit confused on what you mean by
application's web root? The "application servers" web root? and if
that's the case, I do have coldbox in the web root...

but thx

Let’s say your website @ www.mycoolwebsite.com has the home directory of

/sites/mycoolwebsite/html_public/

then everything that is served from that site must either reside under that location, or be mapped. Without a mapping, no web server or application server in the world can serve those files if they reside elsewhere.

From what you’re saying it sounds to me as though you have everything in your web root, which is why it “works”. But the only reason it “works” is that it resides in the web root. For instance, if you are running IIS, the default web root is something like

C:\Inetpub\wwwroot\

If you have your directories set up like…

C:\Inetpub\wwwroot\coldbox
C:\Inetpub\wwwroot\mycoolwebsite\

and you browse to http://localhost/mycoolwebsite/index.cfm, the reason it “works” is because you have both coldbox and mycoolwebsite in the web root. Try moving those elsewhere and see what happens.

Since your Railo install is not on IIS (not sure that Railo even supports IIS), your web server root and your project (application) root are not in the same location. Therefore, a mapping is necessary. That’s the way every single application and/or web server on the planet works. It has nothing to do with Railo vs. Adobe ColdFusion or ColdBox or IIS or Apache or JBoss or anything else. A mapping is required if you’re using files that don’t reside in the application/project’s web root.

Since your Railo install is not on IIS (not sure that Railo even supports IIS),

It does. :slight_smile:

http://www.railo.ch/blog/index.cfm/2008/4/7/Configuring-IIS6-with-Railo

~Brad

sounds good.

however my railo install, I believe *is* on Apache, so my web servers
root is "~/Sites" and I tried setting my root on the resin conf file
to be pointing to the same root, which probably confused me on why I
had to setup a mapping... It's no big deal, I now have my coldbox test
application running under Railo (which is SUPER sweet).

does railo support application specific mappings?

i havent tried but if it does you can just add the mapping to your
Application.cfc

to avoid conflicts later with other apps using different versions of the
framework

<cfset this.mappings['/coldbox'] = pathToColdBox />

and u can do the same if your app is not in the route
<cfset this.mappings['/'] = COLDBOX_APP_ROOT_PATH />

and update the AppMapping setting in the coldbox config to '/'

this will tell CF to treat the app as if its at the root level

yea, not sure Tom. good point tho...

however, after adding the mapping to the server admin, I still do not
get any styles or images in the coldbox admin interface... My
application is working just fine.

any thoughts?

If you view the source for a page in the coldbox admin interface, what path is it using to load the styles and css?

You may need to create another mapping to the “includes” folder which holds the public assets that would allow the path above to work.

  • Gabriel

seriously... is everyone having to create these mappings running under
railo!!?

hint hint Railo/Coldbox users...? :slight_smile:

Nope,

I do not create any mappings under railo if I don’t need to.

If you can’t see styles and css and stuff. Make sure they have the right permissions if under *nix.

Luis

right...

thats what I thought!! I don't particularly like creating mappings if
I don't have to as well...
Luis, do you have to create a mapping to the framework (coldbox
directory) in your webroot?

mmh, I changed recursively my coldbox directory to 755, and still
nothing, no styles/images...

ack!

I was leaving off the port when browsing to the dashboard... Once I
specified the port everything works!

any thoughts on that?

I've only been partially following this thread...

Is it that you are trying to access the ColdBox _dashboard_ from your website? ("coldbox admin interface")
And that this dashboard (including js, css, and images) are stored in the coldbox folder which is outside of your web root?

I don't see how you could get the non-CF parts of the dashboard WITHOUT a web server mapping. (with one exception)
The ColdFusion mapping will be enough for your server to find the .cfm or .cfc files, but when your browser requests a JPG. the web server generally serves that content without ever bugging the app server.

What is an example of an image, or js file that won't load? Plug that path into your URL all by itself. If you are getting a 404 (which I suspect you are) then it shouldn't have anything to do with permissions.

I'm not totally familiar with the admin interface you are speaking of, but if it is in a folder which is not web-accessible, you have two options. Map a virtual directory in your WEBSERVER, or move that directory into your web root. If it helps, you shouldn't need to make a mapping for the entire coldbox folder, just the dashboard folder.

Hrmm.. I just saw your last reply about the port number. If that worked, then I'm not sure what is going on. What port are you using? 80? The only time I have seen CF serve non-CF content (the exception I mentioned above) was when using the built-in web server in Adobe Coldfusion with a mulitserver install, where ALL files were associated with JRUN and passed through CF and therefore following CF mappings. Of course, since you're on Railo and Apache, that's sort of outside of my experience. :frowning:

~Brad

I'm not really sure what's going on with salomoko's install,
especially without knowing the details for how he set up his Apache/
Resin/Railo setup, but I just wanted to chime in on a couple of points
made:

1) As someone who is also running CB under Railo, no -- you don't need
a mapping to get ColdBox to run (if, as explained before, it's in your
site's web root).

2) To answer Tom's question -- yes, you can set up application-
specific mappings in Railo just like in CF8 in the Application.cfc.
However, it's kind of redundant for Railo to have that "feature",
since Railo provides an admin for each web site where you can set up
app-specific mappings as well as app-specific datasources and other
settings.

I used to be averse to mappings. But ever since I got my own VPS, I've
changed my tune. Having a mapping to a "central" ColdBox directory
makes it so much easier to upgrade the framework for all my sites at
once instead of having to upgrade the files for each individual site.

@ Tony G

"especially without knowing the details for how he set up his Apache/
Resin/Railo setup"

I simply followed Luis' guide:
http://www.luismajano.com/blog/index.cfm/2008/12/5/Railo-Resin-Apache-and-Mac-OS-X--A-FAST-Combination

"you don't need a mapping to get ColdBox to run (if, as explained
before, it's in your site's web root)."

This is just not the case with me, hence my initial posting on this
thread. My cb app cannot find the core install without a mapping, I
have coldbox at my webservers root. ~/Sites, which is defined via my
httpd.conf. and in my resin.conf... Are you saying to put the coldbox
framework folder in my applications root? ~/Sites/railo_app/coldbox

:slight_smile:

“Web server root” and “application root” are not synonymous.

“Web site root” and “application root” are synonymous.

As has been stated repeatedly, you must have a mapping to anything that resides outside of your application/web site root.

@ Tony G

I have coldbox at my webservers root. ~/Sites, which is defined via my
httpd.conf. and in my resin.conf…

Again, you have ColdBox at the web server root, so yes, you must have a mapping.

Are you saying to put the coldbox
framework folder in my applications root? ~/Sites/railo_app/coldbox

If you don’t want to use a mapping, you must place coldbox in your application/web site root.

I don’t know how else to explain it. It is not rocket science.