B4J Question JRDC2 error

Prosg

Active Member
Licensed User
Longtime User
Hello

I want to install jrdc2 in a VPS

i compile and when i do this :

B4X:
java -jar jRDC.jar

i have this error

B4X:
java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/HttpConfiguration$Customizer : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at b4j.example.main._process_globals(main.java:113)
        at b4j.example.main.initializeProcessGlobals(main.java:104)
        at b4j.example.main.main(main.java:28)

Any idea ?
 

Prosg

Active Member
Licensed User
Longtime User
forget it i was not in java 8 ^^

1. how i can have always this server running ?

2. Can someone help me to configure jdc driver with cassandra :

B4X:
#DATABASE CONFIGURATION
DriverClass=cassandra-2.1-2.jdbc41
JdbcUrl=jdc:cassandra://149.202.42.138:9160/myKeyspace
User=root
Password=mypassword
#Java server port
ServerPort=9160

i think this config is not good :(

3. May i upload to my VPS the cassandra driver or it's not necessary (compiled)

4. when i unzip the cassandra driver i have a folder lib with a lot of .jar... i have to do something with them ?

5. how i can know if my server is running i test http://149.202.42.138:9160/?method=test
and ERR_CONNECTION_REFUSED

Regards
 
Last edited:
Upvote 0

Anser

Well-Known Member
Licensed User
Longtime User
forget it i was not in java 8 ^^

1. how i can have always this server running ?

2. Can someone help me to configure jdc driver with cassandra :

B4X:
#DATABASE CONFIGURATION
DriverClass=cassandra-2.1-2.jdbc41
JdbcUrl=jdc:cassandra://149.202.42.138:9160/myKeyspace
User=root
Password=mypassword
#Java server port
ServerPort=9160

i think this config is not good :(

3. May i upload to my VPS the cassandra driver or it's not necessary (compiled)

4. when i unzip the cassandra driver i have a folder lib with a lot of .jar... i have to do something with them ?

5. how i can know if my server is running i test http://149.202.42.138:9160/?method=test
and ERR_CONNECTION_REFUSED

Regards
1. https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content

Answers for your question numbers 3,4
3. You don't need the cassandra driver on the VPS, instead when you compile your jRDC2 use the following lines on your Main. All the required connector jar will be included in the jRDC.jar file.
B4X:
#AdditionalJar: <your casandra connecter jar file>

Regards
Anser
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
other problem where is the library for DBCommand ?

i use DBRequestManager but DBocmmand is error

regards

edit :
B4X:
Type DBCommand (Name AsString, Parameters() As Object)
 
Last edited:
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i go in the folder where i updload jRDC.jar and i do
B4X:
java -jar jRDC.jar

after i don't know if with jRDC2 the check test in the url brower can be make ?

After maybe in a frist time i have to connect mysql Driver who is more simple... and when i success (i will be sure that my jRDC work correctly) i have to change to cassandra

Because for now i don't know if the problem is cassandra connexion or my jRDC installation.
 
Last edited:
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
upload_2016-3-8_15-50-2.png


but i think i have trouble to run the server on ubuntu

Here what i did :

B4X:
sudo apt-get update
sudo apt-get upgrade

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-set-default
java -version

and in jRDC2 :
1. in my Additionnal Libraries folder i copy "cassandra-2.1-2.jdbc41.jar"
2. i had #AdditionalJar: cassandra-2.1-2.jdbc41 in jRDC
3. in config.proprieties

B4X:
#DATABASE CONFIGURATION
DriverClass=cassandra-2.1-2.jdbc41
JdbcUrl=jdc:cassandra://149.202.42.138:9160/myKeyspace
User=root
Password=mypassword
#Java server port
ServerPort=9160

4. i compile in release mode
5. i upload /objects/jRDC.jar in a folder in my VPS
6. ===>> i have trouble to run the server with nohup :( with ubuntu

here where i m
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
B4X:
root@vps254455:/home/prosg# java -jar jRDC.jar
2016-03-08 17:20:10.155:INFO::main: Logging initialized @289ms
mars 08, 2016 5:20:10 PM com.mchange.v2.log.MLog <clinit>
INFOS: MLog clients using java 1.4+ standard logging.
mars 08, 2016 5:20:10 PM com.mchange.v2.c3p0.C3P0Registry banner
INFOS: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-03-08 17:20:10.717:INFO:oejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-03-08 17:20:10.806:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@6767c1fc{/,file:///home/prosg/www,AVAILABLE}
2016-03-08 17:20:10.813:INFO:oejs.AbstractNCSARequestLog:main: Opened /home/prosg/logs/b4j-2016_03_08.request.log
main._appstart (java line: 89)
java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:326)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:244)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.server.Server.doStart(Server.java:384)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:182)
        at b4j.example.main._appstart(main.java:89)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
        at b4j.example.main.main(main.java:29)

main.main (java line: 29)
java.lang.RuntimeException: java.net.BindException: Address already in use
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
        at b4j.example.main.main(main.java:29)
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:326)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:244)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.server.Server.doStart(Server.java:384)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:182)
        at b4j.example.main._appstart(main.java:89)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
        ... 2 more
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i re install my server and i test with mysql driver to be sure that my jRDC2 work fine

i have this
upload_2016-3-9_8-36-33.png


When i change something in config.proprietie => i just have to upload again the jRDC.jar only ? or may i have to restart the server jRDC ? or something like that ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Check the server logs (tail -f nohup). The server is running but is unable to connect to the database.

You need to upload jRDC and then kill the current running instance and run it again.

During "development" I prefer to run the server without nohup:
B4X:
java -jar <yourjar>
This way it is easier to see the logs and you can kill the server with Ctrl + C.

Once everything is working, you should run it with nohup.
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i'm getty crazy for one think... when u have make
B4X:
java -jar <yourjar>
how to exit the server ?
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i think 1. i make an error here :

B4X:
#DATABASE CONFIGURATION
DriverClass=cassandra-2.1-2.jdbc41

Driverclass must be incorrect if i understand
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i think it's better like that
B4X:
DriverClass=org.apache.cassandra.cql.jdbc.CassandraDriver
but i have Error fetching connection with cassandra.... i continue searching

edit : i have this error :

AVERTISSEMENT: Could not load driverClass org.apache.cassandra.cql.jdbc.CassandraDriver
 
Upvote 0
Top