[ 
https://issues.apache.org/jira/browse/GUACAMOLE-1149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17168153#comment-17168153
 ] 

Nick Couchman commented on GUACAMOLE-1149:
------------------------------------------

Yeah, this is likely happening because Guacamole is trying to insert a record 
for the user into the database, but the user doesn't exist in the database, so 
it doesn't have an ID.  When you go in and check the "Change own password" box, 
the user is automatically created in the database, which resolves the issue.

It's probably worth some additional debugging to see what it would try to be 
creating in the database on initial login that would cause the problem, because 
I don't think that should be happening.  Also, you can probably make the issue 
go away completely by enabling the auto-create option, if that's the route you 
wanted to go:

http://guacamole.apache.org/doc/gug/jdbc-auth.html#jdbc-auth-auto-create

> Database query error after attempting to log-in with a new AD user
> ------------------------------------------------------------------
>
>                 Key: GUACAMOLE-1149
>                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-1149
>             Project: Guacamole
>          Issue Type: Bug
>          Components: guacamole-auth-jdbc-mysql
>    Affects Versions: 1.2.0
>         Environment: Ubuntu 18.04.4 LTS
> mariadb  Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) 
> using readline 5.2
> Tomcat 9 9.0.16-3ubuntu0.18.04.1
> openjdk-11-jre-headless 10.0.1+10-3ubuntu1
>            Reporter: Piotrek
>            Priority: Minor
>
> After updating our Guacamole 1.1.0 installation to 1.2.0 (extensions 
> included) we started experiencing the following error:
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: #011at 
> java.base/java.lang.Thread.run(Thread.java:834)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.560 
> [http-nio-8080-exec-7] INFO o.a.g.r.auth.AuthenticationService - User 
> "someaduser" successfully authenticated from 10.0.10.38.??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.574 
> [http-nio-8080-exec-7] DEBUG o.a.g.a.mysql.conf.MySQLEnvironment - Database 
> recognized as MySQL 5.5.5.??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.585 
> [http-nio-8080-exec-7] DEBUG o.a.g.a.mysql.conf.MySQLEnvironment - Database 
> recognized as MySQL 5.5.5.??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.586 
> [http-nio-8080-exec-7] DEBUG o.a.g.a.mysql.conf.MySQLEnvironment - Database 
> recognized as MySQL 5.5.5.??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.596 
> [http-nio-8080-exec-7] ERROR o.a.g.rest.RESTExceptionMapper - Unexpected 
> internal error:??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### Error updating database. 
> Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'user_id' 
> cannot be null??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### The error may involve 
> org.apache.guacamole.auth.jdbc.user.UserMapper.insertAttributes-Inline??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### The error occurred while 
> setting parameters??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### SQL: INSERT INTO 
> guacamole_user_attribute ( user_id, attribute_name, attribute_value ) VALUES 
> (?, ?, ?) , (?, ?, ?)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### Cause: 
> java.sql.SQLIntegrityConstraintViolationException: Column 'user_id' cannot be 
> null??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 14:16:54.596 
> [http-nio-8080-exec-7] DEBUG o.a.g.rest.RESTExceptionMapper - Unexpected 
> error in REST endpoint.??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: 
> org.apache.ibatis.exceptions.PersistenceException:??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### Error updating database. 
> Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'user_id' 
> cannot be null??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### The error may involve 
> org.apache.guacamole.auth.jdbc.user.UserMapper.insertAttributes-Inline??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### The error occurred while 
> setting parameters??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### SQL: INSERT INTO 
> guacamole_user_attribute ( user_id, attribute_name, attribute_value ) VALUES 
> (?, ?, ?) , (?, ?, ?)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: ### Cause: 
> java.sql.SQLIntegrityConstraintViolationException: Column 'user_id' cannot be 
> null??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: #011at 
> org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: #011at 
> org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: #011at 
> org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)??
> ??Jul 30 14:16:54 pvlgua03 tomcat9[23757]: #011at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)??
> This happens when we create a brand new AD user and attempt to log-in for the 
> very first time. Intrestingly, logging-in with guacadmin and checking the 
> "Change own password" for the user fixes the problem. it seems this might 
> have something to do with this new feature introduced by GUACAMOLE-708.
> The extensions are: guacamole-auth-jdbc-mysql-1.2.0.jar 
> guacamole-auth-ldap-1.2.0.jar guacamole-auth-totp-1.2.0.jar
> We're also using MariaDB as our DB backend and Tomcat 9 on Ubuntu 18.04.
>  
> Could you please help?
> Thanks.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to