Railo Datasource Errors

54 views
Skip to first unread message

Pete

unread,
Mar 18, 2011, 1:08:02 PM3/18/11
to ra...@googlegroups.com
I know there are loads of posts about this all over the internet... but I've read so many in the last few hours and I can't create a single datasource in my Railo install despite trying multiple tips from multiple posts.

I'm running Railo 3.2.2, on Apache 2.2, with MySQL 5.0

I've tried setting up 2 datasources but I get the same errors on both:

Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
...
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)

** END NESTED EXCEPTION **

Last packet sent to the server was 1 ms ago.


The username and password and database all work, they work in phpmyadmin and they work in the command line.
I've granted "all" permissions in MySQL

I've tried setting up a MySQL datasource and also an Other -JDBC one with the following:

class: com.mysql.jdbc.Driver
connection string: jdbc:mysql://127.0.0.1:3306/dbname

I've also tried localhost and 127.0.0.1, and it makes no difference.

I can supply the full stack trace if necessary.

Does anyone have any ideas how to fix this? I really want to use Railo! I can't go back to PHP!

Todd Rafferty

unread,
Mar 18, 2011, 1:19:23 PM3/18/11
to ra...@googlegroups.com
You need to give us a little more background here. Is Railo on the same server as the MySQL instance? or is it on a different machine?
--
~Todd Rafferty
Volunteer
Community Manager
Railo Server - Open Source
----

Todd Rafferty

unread,
Mar 18, 2011, 1:20:29 PM3/18/11
to ra...@googlegroups.com
I guess I should be paying attention to the 127.0.0.1 or localhost comment below. I have Railo working with MySQL just fine on both windows and linux.

Could you supply a full stack trace please?

Pete

unread,
Mar 18, 2011, 1:21:19 PM3/18/11
to ra...@googlegroups.com
Sorry, yes I only have one server, with Apache, Railo, MySQL all running together.

Todd Rafferty

unread,
Mar 18, 2011, 1:21:59 PM3/18/11
to ra...@googlegroups.com
What operating system?


On Fri, Mar 18, 2011 at 1:21 PM, Pete <ske...@gmail.com> wrote:
Sorry, yes I only have one server, with Apache, Railo, MySQL all running together.

Ronan Lucio

unread,
Mar 18, 2011, 1:27:25 PM3/18/11
to ra...@googlegroups.com
Hi Pete,

O can see an "Connection refused" erro in your message.

I suggest you first try to connect via command line:
$ mysql -h your.hostname -u your_username -p

Hope that helps,
Ronan

Pete

unread,
Mar 18, 2011, 1:44:19 PM3/18/11
to ra...@googlegroups.com
Operating System: 

CentOS release 5.2 (Final)

Kernel : 2.6.9-023stab052.4-smp

Stack trace: 

Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.ConnectException
MESSAGE: Connection refused

STACKTRACE:

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:268)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2745)
at com.mysql.jdbc.Connection.(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at railo.runtime.tag.Admin.getConnection(Admin.java:2423)
at railo.runtime.tag.Admin._doVerifyDatasource(Admin.java:2405)
at railo.runtime.tag.Admin._doVerifyDatasource(Admin.java:2395)
at railo.runtime.tag.Admin.doUpdateDatasource(Admin.java:2156)
at railo.runtime.tag.Admin._doStartTag(Admin.java:547)
at railo.runtime.tag.Admin.doStartTag(Admin.java:280)
at admin.services_datasource_create_cfm1334$cf.call(/Users/mic/Projects/Railo/Source2/railo/railo-cfml/railo-admin/admin/services.datasource.create.cfm:68)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:764)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:717)
at admin.services_datasource_cfm414$cf.call(/Users/mic/Projects/Railo/Source2/railo/railo-cfml/railo-admin/admin/services.datasource.cfm:78)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:764)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:717)
at admin.web_cfm$cf.call(/Users/mic/Projects/Railo/Source2/railo/railo-cfml/railo-admin/admin/web.cfm:242)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:764)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:717)
at admin.server_cfm$cf.call(/Users/mic/Projects/Railo/Source2/railo/railo-cfml/railo-admin/admin/server.cfm:2)
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:764)
at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:205)
at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:23)
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1973)
at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:281)
at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
Message has been deleted

Todd Rafferty

unread,
Mar 18, 2011, 1:51:58 PM3/18/11
to ra...@googlegroups.com
Very strange, I'm running on my domain ( web-rat.com) :

cat /proc/version
Linux version 2.6.18-164.9.1.el5xen (mock...@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Dec 15 21:31:37 EST 2009

MySQL Server version: 5.0.77 Source distribution

"Fábio Jr."

unread,
Mar 18, 2011, 2:01:20 PM3/18/11
to ra...@googlegroups.com
Hi Pete,

How is your my.cnf setup, especially the bind_adress config? Is it set to your internal ip, or is not even set?

Did you tried to put your internal address (like 192.168.1.199) to the database configs on railo admin?

[]s

Justin Edwards

unread,
Mar 18, 2011, 2:06:19 PM3/18/11
to ra...@googlegroups.com, "Fábio Jr."
I second this, and make sure the user is granted access on the proper IPs.

Todd Rafferty

unread,
Mar 18, 2011, 2:09:34 PM3/18/11
to ra...@googlegroups.com
Right, so your grant statement should look like:

Grant (whatever) to 'user'@'localhost' identified by 'password'

"Fábio Jr."

unread,
Mar 18, 2011, 2:16:27 PM3/18/11
to Justin Edwards, ra...@googlegroups.com
Hmm.. really weird this behavior.

What about the mysql error log? Tells anything about the attempt to connect?

[]s

Ronan Lucio

unread,
Mar 18, 2011, 2:18:20 PM3/18/11
to ra...@googlegroups.com
Also check in your my.cnf file:

port
skip-networking

port is 3306 by default
skip-networking needs to be commented to acceptc network connections

Ronan

Pete

unread,
Mar 18, 2011, 3:50:21 PM3/18/11
to ra...@googlegroups.com
mysql> show grants for 'user'@'localhost';
+----------------------------------------------------------------------------------------+
| Grants for user@localhost                                                          |
+----------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxx' |
| GRANT ALL PRIVILEGES ON `db`.* TO 'user'@'localhost'                              |
+----------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Pete

unread,
Mar 18, 2011, 3:51:44 PM3/18/11
to ra...@googlegroups.com
my.cnf doesn't have bind_address set.

And I have no idea what my internal IP is, or how to find it.

I probably should have mentioned it's a VPS as well

Pete

unread,
Mar 18, 2011, 3:55:32 PM3/18/11
to ra...@googlegroups.com
Ronan you are the best man in the world!

Commenting out "skip-networking" seems to have fixed it!

I don't understand at all why it worked, but thanks Ronan!

And thanks to everyone else as well!

Ronan Lucio

unread,
Mar 18, 2011, 4:20:52 PM3/18/11
to ra...@googlegroups.com
Hi Pete,

I'm glad it's working... :-)

"skip-netwoking" is a security level to use when you're running mysql on localhost.
this way you block any tcp connection to your box.

The problem here is "I think" java jdbc connects via tcp even on localhost.
That's why you need it commented.

Ronan

2011/3/18 Pete <ske...@gmail.com>
Reply all
Reply to author
Forward
0 new messages