B4J Question jRDC2 - I have a problem with running on the VPS server

kisoft

Well-Known Member
Licensed User
HI

I am trying to implement this solution and I have a problem with this path
/usr/share/java -jar jrdc.jar > nohup.out &
I am getting this error

Using username "root".
root@185.243.53.6's password:
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 2.6.32-042stab131.1 x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Last login: Tue Aug 7 14:55:34 2018 from 46.134.189.4
root@testbd:~# nohup /usr/share/java -jar jrdc.jar > nohup.out &
[1] 663
root@testbd:~# nohup: ignoring input and redirecting stderr to stdout
nohup: failed to run command '/usr/share/java': Permission denied

I redirected the port in this way

sudo iptables -I INPUT -p tcp -m tcp --dport 17178 -j ACCEPT

Can anyone advise you?
 

kisoft

Well-Known Member
Licensed User
Preceed the command with "sudo" so that it's run with Admin rigths
I try but the effect is the same.

I have this version of java installed

root@testbd:~# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

maybe I give the wrong path to start the server
 
Upvote 0

kisoft

Well-Known Member
Licensed User
What happens if you run:
java -jar jrdc.jar > nohup.out &
Or better:
nohup java -jar jrdc.jar > nohup.out &
Using username "root".
root@185.243.53.6's password:
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 2.6.32-042stab131.1 x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Last login: Wed Aug 8 01:48:05 2018 from 46.134.189.4
root@testbd:~# nohup java -jar jrdc.jar> nohup.out &
[1] 1004
root@testbd:~# nohup: ignoring input and redirecting stderr to stdout
 
Upvote 0

DonManfred

Expert
Licensed User
What happens if you connect to the running server now?
 
Upvote 0

kisoft

Well-Known Member
Licensed User
@DonManfred I'm sorry for answering so late. I get this in the nohup.out file:
Unable to access jarfile jrdc.jar

I have to check everything and compile the new jar file again.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
The jar file is located in the boot directory. I have Apache2 and Mysql installed on the VPS server
 
Upvote 0

OliverA

Expert
Licensed User
The jar file is located in the boot directory.
Boot or root? Where is the jar file is located? What does pwd produce when you are in the directory where the jar is located? Currently you are trying to execute the jar file in the root user's home directory, which is another location. Boot <> root <> root home directory.
 
Upvote 0

OliverA

Expert
Licensed User
And preferably to which directory to move?
One interpretation of the Filesystem Hierarchy Standards (FHS, see https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard and https://askubuntu.com/a/6900) would be to place it in a directory under /opt. /boot should definitely just be used for Linux boot files. So let's say you put the jar in /opt/myjrdc, then the command sould be
B4X:
root@testbd:~# nohup java -jar /opt/myjrdc/jrdc.jar > nohup.out &
. Of course for a permanent solution you may want to consider adding you application to systemd's services. For a write up on that see https://www.b4x.com/android/forum/t...ice-and-automatically-starting-at-boot.85739/.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
There is progress, but I still get mistakes

nohup.out
B4X:
Aug 08, 2018 5:51:43 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Aug 08, 2018 5:51:43 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Aug 08, 2018 5:51:43 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1f24fff8 -- 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:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.GeneratedConstructorAccessor6.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:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:358)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2489)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2526)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2311)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.GeneratedConstructorAccessor3.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:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
    at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:244)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:308)
    ... 20 more

Aug 08, 2018 5:51:43 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Aug 08, 2018 5:51:43 PM com.mchange.v2.resourcepool.BasicResourcePool
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.

B4A
B4X:
ResponseError. Reason: java.net.ConnectException: Failed to connect to /185.243.53.6:17178, Response:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.net.ConnectException: Connection refused (Connection refused)</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    java.net.ConnectException: Connection refused (Connection refused)</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
ResponseError. Reason: java.net.SocketTimeoutException: timeout, Response:
ResponseError. Reason: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 -- timeout at awaitAvailable(), Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 -- timeout at awaitAvailable()</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 -- timeout at awaitAvailable()</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
ResponseError. Reason: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 -- timeout at awaitAvailable(), Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b2c3990 -- timeout at awaitAvailable()</title>
 
Upvote 0

OliverA

Expert
Licensed User
Your MySQL server is refusing the connection from the jRDC program. Could be a mis-configuration of the jRDC configuration file or the MySQL server (in this case more a missing configuration).
 
Upvote 0

kisoft

Well-Known Member
Licensed User
I have to check it out, it worked very well locally. Probably somewhere I made a mistake in configuring Mysql.
 
Upvote 0

OliverA

Expert
Licensed User
Upvote 0
Top