Solved

Getting my site to work with Railo

Posted on 2014-01-05
13
526 Views
Last Modified: 2014-03-04
I have a website that works fine using Coldfusion and now I am trying to get it to work using Railo.  When I am comparing values from a query I am getting the error:

Msg: can't compare complex object types as simple value

I have a line of code that looks like the following:
<cfif getThreadID.LoggedInUsersOnly EQ 0>

If I use cfdump to look at the value it displays:

Native Array (byte[])
Raw      [0]
Base64 Encoded      AA==

What do I have to do differently so that it works using Railo?

Also, the URL that I am using to view my site is: localhost:8888/index.cfm. Having the port number in the URL seems to be causing me problems when I am trying to load css, js, and other files.  Is there anything that I can do in the Railo admin so that I can use localhost without the port number?

Thank you for your help
0
Comment
Question by:WestCoast_BC
  • 7
  • 6
13 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 39758117
What's the source of getThreadID.LoggedInUsersOnly? If it's from a db query - which db - and what's the column data type?

seems to be causing me problems when I am trying to load css, js, and other files
Can you be more specific? The port number shouldn't make any difference to relative url's. However, you should be able to change the port number to the default port 80 (assuming it's available on your machine).

http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/running-the-same-code-on-coldfusion-railo-348

... you can choose a different port by editing the following line in the jetty.xml configuration file.


<Set name="port"><Property name="jetty.port" default="8888"/></Set>

Open in new window


If you do choose port 80, make sure that IIS and the Apache webserver are not running.
0
 

Author Comment

by:WestCoast_BC
ID: 39758145
Question 1: getThreadID.LoggedInUsersOnly is from a db query.  The column data type is Bit(1)

Question 2: When I try to load a js or css file and I just a relative URL it does not find the file, I get an error.  My code works fine using Coldfusion.  I was wondering if the port number in the url is my problem since I don't have a port number in my URL when I run using Coldfusion
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39758176
Which db? I know mySQL sometimes returns binary when you're not expecting it. From the error it sounds like that's what's happening.   The causes can vary. I'd need to know the exact mySQL version, driver version and query used.  As a quick workaround, try casting the column as an UNSIGNED INTEGER in your SQL query. See if that fixes the error: (AFAIK MySQL doesn't allow casting to smallint, etc...)

          SELECT   CAST( YourColumn AS UNSIGNED INTEGER) AS LoggedInUsers


EDIT: RE URL's, I've never had that problem w/Railo, but I don't think the different port number should make any difference unless you were using a full URL, such as:   http://localhost/app/someFile.css. In that case it *would* make a difference. Assuming you're not, can you give post a small example showing the paths you're trying and the exact error message?

ie  
CSS location:   c:/railo/www/myApp/css/styles.css
TestScript.cfm location:   c:/railo/www/myApp/testPage.cfm
HTML/CFML Code:    <link ....>
0
 

Author Comment

by:WestCoast_BC
ID: 39758358
DB Info:
I am using mySQL 5.0.19

My query looks like:
<CFQUERY NAME="getThreadID" DATASOURCE="#application.defDSN#">
      SELECT      LoggedInUsersOnly
      FROM      thread_threads
      WHERE      ThreadID = <cfqueryparam value="#URL.ThreadID#" cfsqltype="CF_SQL_INTEGER">
</CFQUERY>

As for my URL it seems to be using the full url, ie, http://localhost:888/....

I am accessing my site by using : http://localhost:8888/index.cfm.  I can't get anything else to work for me.

In my code I am accessing the file using a relative path, ie, js/myjs.js but when I look at the console it seems to be using the full URL
0
 

Author Comment

by:WestCoast_BC
ID: 39758378
I am thinking that instead of changing all of my code to cast my result that it might be easier for me to modify my database and change all of my fields that are of type bit to integer.  Are there other datatypes that I should avoid using?
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 500 total points
ID: 39758502
You might also try BOOLEAN. I *think* that worked for me in one case.

Unfortunately I don't know all of the rules for when the mySQL returns the result as binary instead of a string, number, etc... and it varies depending on the exact driver version. For example, your code worked fine for me w/a BIT column and Railo 4.1.  You could try a different driver. Find one that doesn't return the result as binary, but I think your idea of changing the column data type is simpler.

> when I look at the console it seems to be using the full URL

If your code uses a relative URL, it should be fine. As far as what the console displays, as long as it's displaying the correct port ie localhost:8888, then again it should still work. Assuming your actual files really are in the correct place. Hard to say whether they are though without an example of the actual paths or the full error message.

What happened you changed the port to the default 80?

http://www.experts-exchange.com/Software/Internet_Email/Web_Browsers/Q_28330823.html#a39758117
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:WestCoast_BC
ID: 39759798
I just tried changing my port to 80 by setting the following in the jetty.xml file:
<Set name="port"><Property name="jetty.port" default="80"/></Set>

I stopped and restarted Railo and I don't have Apache and IIS running. I have not installed IIS or Apache on this computer.

When I try to access my site by trying:
localhost:80/index.cfm (when I try this it automatically changes to localhost/index.cfm) or localhost/index.cfm I get:

Oops! Google Chrome could not connect to localhost

When my port is set to 8888 when I run the site I get errors in the console like:
GET http://localhost:8888/js/datetime.js 404 (Not Found)  and I think I have just figured out what that problem is. When running Coldfusion the case of the file names is not important.  I see when running Railo that file name case is important.

I think with the combination of changing the datatypes from bit to boolean in my database  and fixing the file name case I should be able to get everything working.

Thank you for all of your help!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39759865
Oh... yeah, you may be right. I remember with CF10 (running on Tomcat) I think it may be case sensitive. Ugh... I remember reading there might be a setting to disable that.  If it's a Tomcat setting it should work for Railo too. Let me see if I can find it.
0
 

Author Comment

by:WestCoast_BC
ID: 39759927
Do you know of any good resources that have information about converting coldfusion tags that are not supported by Railo?
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39760201
I don't know of anything official. I pretty much look up issues as they occur in the Railo docs and their google groups.  

BTW, the two issues you encountered aren't really related to Railo. One is likely due to the behavior of the mySQL driver used (which could occur on any platform) and the other is due to Tomcat config.
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39760217
0
 

Author Comment

by:WestCoast_BC
ID: 39760304
Thank you for all of your help!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39760637
You're welcome. Any time :)
0

Featured Post

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now