B4J Question [jRDC2] Timeout Exception

Hi.

i tried using jrdc2 and succesful to run both from b4j ide or jar file
but everytime i tested on browser on my developm machine --> http://localhost:17178/rdc

log :

=========================
Waiting for debugger to connect...
Program started.
2016-07-15 14:27:07.693:INFO::main: Logging initialized @1242ms
Jul 15, 2016 2:27:07 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Jul 15, 2016 2:27:08 PM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-07-15 14:27:08.708:INFO:eek:ejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-07-15 14:27:08.843:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@59f99ea{/,file:///C:/Users/Viek/Documents/B4A/Samples/jRDC2/jRDC/Objects/www,AVAILABLE}
2016-07-15 14:27:08.850:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Users\Viek\Documents\B4A\Samples\jRDC2\jRDC\Objects\logs\b4j-2016_07_15.request.log
2016-07-15 14:27:09.000:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@1edb8c16{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2016-07-15 14:27:09.002:INFO:eek:ejs.Server:main: Started @2558ms
Emulated network latency: 100ms
jRDC is running (version = 2.1)
Jul 15, 2016 2:28:28 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hgf2te9h1tvu8cz10e5iq9|9e89d68, debugUnreturnedConnectionStackTraces -> false, description -...
(TimeoutException) com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@2d6eabae -- timeout at awaitAvailable()
Command: , took: 20123ms, client=127.0.0.1
Jul 15, 2016 2:28:59 PM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@70243715 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:875)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1712)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1228)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)

=======================

i don't know what's wrong ....
pls help

thx
 
hi erel.

yes i know that.
then i try to access the database directly from mysql workbench using
username : root
password : mypassword

and it's okey

??

thx
 
Upvote 0
okey,

now i try to rdc client using b4j and log shown :

B4X:
Waiting for debugger to connect...
shell switching to alternate port: 9054
shell switching to alternate port: 9055
Program started.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /. Reason:
<pre>  Not Found</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
Error: Not Found


and this code on b4j
B4X:
#Region  Project Attributes
   #MainFormWidth: 500
   #MainFormHeight: 500
#End Region

Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Dim reqManager As DBRequestManager
   Dim TableView1 As TableView
   Type DBResult (Tag As Object, Columns As Map, Rows As List)
  Type DBCommand (Name As String, Parameters() As Object)
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
   MainForm.Show
   TableView1.Initialize("TableView1")
   MainForm.RootPane.AddNode(TableView1, 0, 0, 0, 0)
   MainForm.RootPane.SetAnchors(TableView1, 0, 0,0, 0) 'fill the screen
   reqManager.Initialize(Me, "http://127.0.0.1:17178")
   'reqManager.Initialize(Me, "http://127.0.0.1:3036")
   GetAnimal("a1")
End Sub

Sub GetAnimal(Name As String)
   Dim cmd As DBCommand
   cmd.Initialize
   cmd.Name = "select"
'   cmd.Parameters = Array As Object(123456789, "coba")
   cmd.Parameters = Array As Object()
   reqManager.ExecuteQuery(cmd, 0, Null)
End Sub


Sub JobDone(Job As HttpJob)
   If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
   Else
     If Job.JobName = "DBRequest" Then
       Dim result As DBResult = reqManager.HandleJob(Job)
       reqManager.PrintTable(result)
       reqManager.FillTableView(result, TableView1)
       MainForm_Resize(MainForm.Width, MainForm.Height)
     End If
   End If
   Job.Release
End Sub

Sub MainForm_Resize (Width As Double, Height As Double)
   For i = 0 To TableView1.ColumnsCount - 1
     TableView1.SetColumnWidth(i, (Width - 10dip)/ TableView1.ColumnsCount)
   Next
End Sub

and this config.properties
B4X:
#Lines starting with '#' are comments.
#Backslash character at the end of line means that the command continues in the next line.

#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/asa?characterEncoding=utf8
#JdbcUrl=jdbc:mysql://localhost:3306/asa?useSSL=false
User=root
Password=xtrapedas1
#Java server port
ServerPort=17178

#example of MS SQL Server configuration:
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<server address>/<database>

#example of postegres configuration:
#JdbcUrl=jdbc:postgresql://localhost/test
#DriverClass=org.postgresql.Driver

#SQL COMMANDS
#sql.create_table=CREATE TABLE IF NOT EXISTS animals (\
#  id INTEGER PRIMARY KEY AUTO_INCREMENT,\
#  name CHAR(30) NOT NULL,\
#  image BLOB)
#sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
#sql.select_animal=SELECT name, image, id FROM animals
sql.create_table=CREATE TABLE asa.article (col1 numeric(10,4) ,col2 text);
sql.select=select kd_brg, nm_brg from asa.barang ORDER BY kd_brg
sql.insert=INSERT INTO asa.article VALUES(?, ?)
 
Last edited:
Upvote 0
Top