I’m trying to see if I can implement the mysqlx protocol (used with MySQL 8 for their “nosql” document store) in Lucee. The protocol is supported by the Connector/J 8.x driver so Lucee should have everything it needs to connect. I was trying to convert the example “Java Code” on this page:
https://dev.mysql.com/doc/x-devapi-userguide/en/database-connection-example.html
import com.mysql.cj.xdevapi.*;
Session mySession = new SessionFactory().getSession("mysqlx://localhost:33060/test?user=user&password=password");
to CFML and I’m getting an error on the second line of code, so I have:
var SessionFactory = createObject( "java" , "com.mysql.cj.xdevapi.SessionFactory" );
var mySession = SessionFactory.getSession('mysqlx://root@mysql:33060/testdb');
However, the second line of code above generates this error:
lucee.runtime.exp.NativeException: com/google/protobuf/Message
at com.mysql.cj.MysqlxSession.<init>(MysqlxSession.java:61)
at com.mysql.cj.xdevapi.SessionImpl.<init>(SessionImpl.java:72)
at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:85)
at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:107)
at jdk.internal.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at lucee.runtime.reflection.pairs.MethodInstance.invoke(MethodInstance.java:56)
at lucee.runtime.reflection.Reflector.callMethod(Reflector.java:877)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:831)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
This isn’t a particularly helpful error message/stack.
I’ve confirmed the container can connect to the MySQL container via the mysqlx protocol using mysql-shell
so it isn’t a network connection issue. Also, the root user on my MySQL container doesn’t have a password, hence their not being one above and the password is optional according to the MySQL Connector/J docs here:
https://dev.mysql.com/doc/dev/connector-j/8.0/com/mysql/cj/xdevapi/SessionFactory.html
Anyone got any ideas?
Thanks.
OS: CommandBox Docker container (Linux)
Java Version: 11.0.11
Lucee Version: 5.3.8.201