Hello everyone!
I’m trying to use the RethinkDB Driver to connect my database (local).
I don’t know why it does not work. Any suggestions?
Thanks for help
__Resource.lua
-- LIBS
client_script "nativeui.net.dll"
server_script "Newtonsoft.Json.net.dll"
server_script "Common.Logging.Core.net.dll"
server_script "Common.Logging.net.dll"
server_script "RethinkDb.Driver.net.dll"
-- ULIFE
server_script 'ULife.Servidor.net.dll'
client_script 'ULife.Cliente.net.dll'
Here is the server code:
using CitizenFX.Core;
using RethinkDb.Driver;
using System;
namespace ULife.Servidor
{
class Main : BaseScript
{
public static RethinkDB r = RethinkDB.R;
public Main() {
var c = r.Connection().Connect();
var dbs = r.DbList().Run(c);
Console.WriteLine(dbs);
}
//Test async
private async void Connection()
{
var con = await r.Connection().ConnectAsync();
}
}
}
I use this project to check that everything is fine.
ConsoleTest.exe
using System;
using RethinkDb.Driver;
namespace ConsoleTest
{
class Program
{
public static RethinkDB R = RethinkDB.R;
static void Main(string[] args)
{
var con = R.Connection().Connect();
var dbs = R.DbList().Run(con);
Console.WriteLine(dbs);
Console.ReadLine();
}
}
}
CitizenFX Error
Loaded Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed into ScriptDomain_616916357
Loaded Common.Logging.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e into ScriptDomain_616916357
Loaded Common.Logging, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e into ScriptDomain_616916357
Loaded RethinkDb.Driver, Version=2.3.20.0, Culture=neutral, PublicKeyToken=289e75d5145ae4e6 into ScriptDomain_616916357
Loaded ULife.Servidor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null into ScriptDomain_616916357
error in mono_error_set_type_load_name: Could not resolve type with token 01000055
Failed to instantiate instance of script ULife.Servidor.Main: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type of field 'RethinkDb.Driver.Net.SslContext:<LocalCertificateSelectionCallback>k__BackingField' (2) due to: Could not resolve type with token 01000055 assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Net.Security.LocalCertificateSelectionCallback member:<none>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at RethinkDb.Driver.Net.SocketWrapper.ConnectAsync (RethinkDb.Driver.Net.Handshake handshake) [0x0002b] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.Connection+<ReconnectAsync>d__26.MoveNext () [0x00068] in <8ad1d458549342fb91d9cca64a70de09>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at RethinkDb.Driver.Net.Connection+Builder+<ConnectAsync>d__15.MoveNext () [0x00088] in <8ad1d458549342fb91d9cca64a70de09>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at RethinkDb.Driver.Utils.TaskHelper.WaitSync[T] (System.Threading.Tasks.Task`1[TResult] task) [0x00012] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.Connection+Builder.Connect () [0x00006] in <8ad1d458549342fb91d9cca64a70de09>:0
at ULife.Servidor.Main..ctor () [0x00012] in <8be6624440e341af8908bc3b299c366b>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <0123fd5b1a1040fe9d70a7e0d4b28acb>:0
at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.Byte[] assemblyData, System.Byte[] symbolData) [0x00069] in C:\gl\builds\4ff63adb\0\cfx\fivem\code\client\clrcore\InternalManager.cs:78
Instantiated instance of script ULife.Servidor.jugador.Jugador.
Instantiated instance of script ULife.Servidor.Interfaz.Menu.
Started resource ULife
Console Test Output
C:\Users\oce\source\repos\ConsoleTest\bin\Debug>mono -V
Mono JIT compiler version 5.4.1 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: Thread + polling
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
C:\Users\oce\source\repos\ConsoleTest\bin\Debug>mono ConsoleTest.exe
[
"ULIFE",
"rethinkdb",
"test"
]
the windows server is using a slightly old mono, there’s no certain plans on when/if this is being updated
can you verify if this works on linux fxs?
I tried running it on ubuntu, but it does not work
Another suggestion?
Thanks for help.
Loaded Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed into ScriptDomain_258798590
Loaded Common.Logging.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e into ScriptDomain_258798590
Loaded Common.Logging, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e into ScriptDomain_258798590
Loaded RethinkDb.Driver, Version=2.3.20.0, Culture=neutral, PublicKeyToken=289e75d5145ae4e6 into ScriptDomain_258798590
Loaded ULife.Servidor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null into ScriptDomain_258798590
Exception loading assembly System.Numerics: System.IO.FileNotFoundException: Unable to find the specified file.
Server stack trace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) [0x0000a] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at (wrapper cominterop) CitizenFX.Core.IScriptHost:OpenHostFile (string)
at (wrapper cominterop-invoke) CitizenFX.Core.IScriptHost:OpenHostFile (string)
at CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile (System.String fileName) [0x00000] in /src/code/client/clrcore/MonoScriptRuntime.cs:254
at (wrapper remoting-invoke-with-check) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (string)
at (wrapper xdomain-dispatch) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (object,byte[]&,byte[]&,string)
Exception rethrown at [0]:
at (wrapper xdomain-invoke) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (string)
at CitizenFX.Core.InternalManager.LoadAssembly (System.String name) [0x00000] in /src/code/client/clrcore/InternalManager.cs:112
Exception loading assembly System.Numerics: System.IO.FileNotFoundException: Unable to find the specified file.
Server stack trace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR (System.Int32 errorCode) [0x0000a] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at (wrapper cominterop) CitizenFX.Core.IScriptHost:OpenHostFile (string)
at (wrapper cominterop-invoke) CitizenFX.Core.IScriptHost:OpenHostFile (string)
at CitizenFX.Core.MonoScriptRuntime+WrapScriptHost.OpenHostFile (System.String fileName) [0x00000] in /src/code/client/clrcore/MonoScriptRuntime.cs:254
at (wrapper remoting-invoke-with-check) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (string)
at (wrapper xdomain-dispatch) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (object,byte[]&,byte[]&,string)
Exception rethrown at [0]:
at (wrapper xdomain-invoke) CitizenFX.Core.MonoScriptRuntime+WrapScriptHost:OpenHostFile (string)
at CitizenFX.Core.InternalManager.LoadAssembly (System.String name) [0x00000] in /src/code/client/clrcore/InternalManager.cs:112
Failed to instantiate instance of script ULife.Servidor.Main: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Failure has occurred while loading a type.
at Newtonsoft.Json.Linq.JValue..ctor (System.Object value) [0x00000] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at Newtonsoft.Json.Linq.JContainer.ReadContentFrom (Newtonsoft.Json.JsonReader r, Newtonsoft.Json.Linq.JsonLoadSettings settings) [0x0012e] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Linq.JsonLoadSettings options) [0x00030] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at Newtonsoft.Json.Linq.JObject.Load (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Linq.JsonLoadSettings settings) [0x0006a] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at Newtonsoft.Json.Linq.JObject.Parse (System.String json, Newtonsoft.Json.Linq.JsonLoadSettings settings) [0x0000c] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at Newtonsoft.Json.Linq.JObject.Parse (System.String json) [0x00000] in <dc86da7fc46c487ba6c7ab826da479cc>:0
at RethinkDb.Driver.Net.Handshake+WaitingForProtocolRange.NextState (System.String response) [0x00000] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.Handshake.NextMessage (System.String response) [0x00000] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.SocketWrapper.ExecuteHandshake (RethinkDb.Driver.Net.Handshake handshake) [0x0002b] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.SocketWrapper+<ConnectAsync>d__12.MoveNext () [0x00289] in <8ad1d458549342fb91d9cca64a70de09>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at RethinkDb.Driver.Net.Connection+<ReconnectAsync>d__26.MoveNext () [0x000c8] in <8ad1d458549342fb91d9cca64a70de09>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at RethinkDb.Driver.Net.Connection+Builder+<ConnectAsync>d__15.MoveNext () [0x00088] in <8ad1d458549342fb91d9cca64a70de09>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at RethinkDb.Driver.Utils.TaskHelper.WaitSync[T] (System.Threading.Tasks.Task`1[TResult] task) [0x00012] in <8ad1d458549342fb91d9cca64a70de09>:0
at RethinkDb.Driver.Net.Connection+Builder.Connect () [0x00006] in <8ad1d458549342fb91d9cca64a70de09>:0
at ULife.Servidor.Main..ctor () [0x00012] in <cc602aea5a314f00b976ba1c4d269479>:0
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <fb0d2884a2b44d8db375bbed7cc70740>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <fb0d2884a2b44d8db375bbed7cc70740>:0
at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.Byte[] assemblyData, System.Byte[] symbolData) [0x00067] in /src/code/client/clrcore/InternalManager.cs:78
Instantiated instance of script ULife.Servidor.jugador.Jugador.
Instantiated instance of script ULife.Servidor.Interfaz.Menu.
Started resource ULife