Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Error editing e-mail address


  • on a new installation of 1.12.4 with derby, when I hit the save icon after changing a user e-mail address:

    
    ERROR 2012-07-10 14:10:55,666 (com.serotonin.mango.web.filter.ExceptionDetectionFilter.doFilter:52) - DWR invocation exception 
    org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [update users set   username=?, password=?, email=?, phone=?, admin=?, disabled=?, homeUrl=?, receiveAlarmEmails=?,   receiveOwnAuditEvents=? where id=?]; An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'null'.; nested exception is java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'null'.
    	at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.translate(SQLExceptionSubclassTranslator.java:63)
    	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:237)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:606)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:791)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:849)
    	at com.serotonin.db.spring.ExtendedJdbcTemplate.update(ExtendedJdbcTemplate.java:132)
    	at com.serotonin.mango.db.dao.UserDao.updateUser(UserDao.java:148)
    	at com.serotonin.mango.db.dao.UserDao$2.doInTransactionWithoutResult(UserDao.java:122)
    	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
    	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
    	at com.serotonin.mango.db.dao.UserDao.saveUser(UserDao.java:116)
    	at com.serotonin.mango.web.dwr.UsersDwr.saveUserAdmin(UsersDwr.java:146)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
    	at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
    	at com.serotonin.mango.web.dwr.util.LoggedInAjaxFilter.doFilter(LoggedInAjaxFilter.java:39)
    	at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
    	at com.serotonin.web.dwr.LocalizationFilter.doFilter(LocalizationFilter.java:42)
    	at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
    	at com.serotonin.mango.web.filter.ExceptionDetectionFilter.doFilter(ExceptionDetectionFilter.java:40)
    	at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
    	at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
    	at org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
    	at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
    	at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
    	at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'null'.
    	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setObject(Unknown Source)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:228)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:160)
    	at com.serotonin.db.spring.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:24)
    	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:795)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:590)
    	... 44 more
    Caused by: java.sql.SQLException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'null'.
    	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
    	... 57 more
    
    

    Does anyone else have this problem?


  • What is your O/S?


  • To answer your question, yes, others have reported this problem, but it was never reproducable. I have added some code to try to protect against it based on information from Derby forums, and some logging in case it still happens. Hopefully, one way or another, this will be dealt with. The changes will be in the next release.


  • the OS is windows 7. It does happen every time.


  • Sorry, by "reproduceable", i meant not reproduceable in a development environment.


  • on my local machine it is reproduceable if you would like me to test any patches


  • Unfortunately, the UserDao class has undergone changes for multiple purposes, so i can't just send you a class file. But if you're feeling ambitious, you could modify the code by changing the updateUser method to that below. I have not tested this in 1.12.4, so ymmv.

        void updateUser(User user) {
            // Potential fix for "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'null'"
            if (user.getPhone() == null)
                user.setPhone("");
            if (user.getHomeUrl() == null)
                user.setHomeUrl("");
    
            try {
                ejt.update(
                        USER_UPDATE,
                        new Object[] { user.getUsername(), user.getPassword(), user.getEmail(), user.getPhone(),
                                boolToChar(user.isAdmin()), boolToChar(user.isDisabled()), user.getHomeUrl(),
                                user.getReceiveAlarmEmails(), boolToChar(user.isReceiveOwnAuditEvents()),
                                user.getId() }, new int[] { Types.VARCHAR, Types.VARCHAR,
                                Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER,
                                Types.VARCHAR, Types.INTEGER });
                saveRelationalData(user);
            }
            catch (DataIntegrityViolationException e) {
                // Log some information about the user object.
                LOG.error("Error updating user: " + user, e);
                throw e;
            }
        }
    
    

  • that fixed it. thanks.


  • Awesome. Thanks Craig.


  • Can you make the updated library available for 1.12.4? I'm also having the same error when changing data point permissions on any users.

    Actually I get the error when changing anything on a user.


  • You should consider using Mango Automation. http://m2m2.serotoninsoftware.com/


  • I have attached the patched UserDao classes off of an instance of 1.12.4.
    Good Luck

    @Victorino said:

    Can you make the updated library available for 1.12.4?

    Attachment: download link


  • I had the same problem in mango 1.12.3 and I solved it using the Derby.jar file from mango 1.12.5