Mango 1.13.0 Adding Datapoints Fails
-
We've been using Mango at our brewery two years with great success. We have two Modbus IP data Sources which work great, among others. SQL is mySQL.
I added a third Modbus IP datasource which went without a problem. But when I try adding dataponts I get:PreparedStatementCallback; SQL [insert into dataPoints (xid, dataSourceId, data) values (?,?,?)]; Cannot add or update a child row: a foreign key constraint fails (
mungo1
.datapoints
, CONSTRAINTdataPointsFk1
FOREIGN KEY (dataSourceId
) REFERENCESdatasourcesold
(id
)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (mungo1
.datapoints
, CONSTRAINTdataPointsFk1
FOREIGN KEY (dataSourceId
) REFERENCESdatasourcesold
(id
))I can successfully add additional datapoints to all other existing datasources.
I tried deleting one of the existing datasources but that did not help.
I exported the database and installed on another computer with a new installation of xampp and mango 1.13.0. The problem followed to this installation. Maybe this points to some sort of data corruption???...
Many thanks in advance.
Ken
-
Additionally, this is found in the CMD window. It may help identify the problem:
ERROR 2014-10-20 08:17:45,664 (com.serotonin.mango.web.filter.ExceptionDetection
Filter.doFilter:52) - DWR invocation exception
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallba
ck; SQL [insert into dataPoints (xid, dataSourceId, data) values (?,?,?)]; Canno
t add or update a child row: a foreign key constraint fails (mungo1
.datapoint s
, CONSTRAINTdataPointsFk1
FOREIGN KEY (dataSourceId
) REFERENCESdatasour cesold
(id
)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegr
ityConstraintViolationException: Cannot add or update a child row: a foreign key
constraint fails (mungo1
.datapoints
, CONSTRAINTdataPointsFk1
FOREIGN KEY
(dataSourceId
) REFERENCESdatasourcesold
(id
))
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.d
oTranslate(SQLErrorCodeSQLExceptionTranslator.java:245)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslat
or.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:
602)
at com.serotonin.db.spring.ExtendedJdbcTemplate.update(ExtendedJdbcTempl
ate.java:172)
at com.serotonin.db.spring.ExtendedJdbcTemplate.update(ExtendedJdbcTempl
ate.java:130)
at com.serotonin.db.spring.ExtendedJdbcTemplate.update(ExtendedJdbcTempl
ate.java:126)
at com.serotonin.db.DaoUtils.doInsert(DaoUtils.java:154)
at com.serotonin.mango.db.dao.DataPointDao.insertDataPoint(DataPointDao.
java:188)
at com.serotonin.mango.db.dao.DataPointDao$1.doInTransactionWithoutResul
t(DataPointDao.java:172)
at org.springframework.transaction.support.TransactionCallbackWithoutRes
ult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(T
ransactionTemplate.java:130)
at com.serotonin.mango.db.dao.DataPointDao.saveDataPoint(DataPointDao.ja
va:167)
at com.serotonin.mango.rt.RuntimeManager.saveDataPoint(RuntimeManager.ja
va:382)
at com.serotonin.mango.web.dwr.DataSourceEditDwr.validatePoint(DataSourc
eEditDwr.java:309)
at com.serotonin.mango.web.dwr.DataSourceEditDwr.saveModbusPointLocator(
DataSourceEditDwr.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilt
er.java:34)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.j
ava:428)
at com.serotonin.mango.web.dwr.util.LoggedInAjaxFilter.doFilter(LoggedIn
AjaxFilter.java:39)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.j
ava:428)
at com.serotonin.web.dwr.LocalizationFilter.doFilter(LocalizationFilter.
java:62)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.j
ava:428)
at com.serotonin.mango.web.filter.ExceptionDetectionFilter.doFilter(Exce
ptionDetectionFilter.java:40)
at org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.j
ava: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(PlainCallHandle
r.java:52)
at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:1
01)
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(Appl
icationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp
11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoin
t.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationExce
ption: Cannot add or update a child row: a foreign key constraint fails (mungo1
.datapoints
, CONSTRAINTdataPointsFk1
FOREIGN KEY (dataSourceId
) REFERENC
ESdatasourcesold
(id
))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:1761)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:2046)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:1964)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java
:1949)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Del
egatingPreparedStatement.java:108)
at com.serotonin.db.spring.ExtendedJdbcTemplate$1.doInPreparedStatement(
ExtendedJdbcTemplate.java:179)
at com.serotonin.db.spring.ExtendedJdbcTemplate$1.doInPreparedStatement(
ExtendedJdbcTemplate.java:172)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:
586)
... 47 moreAgain, many thanks.
Ken
-
Hi Ken
If you wrap your text in 'code' tags it will be easier to read and make it easier for folks to help you.
I exported the database and installed on another computer with a new installation of xampp and mango 1.13.0.
Did you do an actual mysql database dump or did you simply export the mango datas ource and data point configuration?
I am not a Mango developer nor a java developer, just a user. But if the problem 'followed' you to a new install and you only exported the configuration (and didn't do a full db dump), then I would start looking for odd/escaped characters, whitespace, or otherwise invalid contents in your data source and point config. The message you receive seems to hint at that kind of thing.
-
Hi Ken,
It looks like something has gone wrong in the database but I can't really tell exactly what. Mango 1.13 isn't supported anymore so the only thing I can suggest is to upgrade to Mango Automation or get someone experience in MySQL to go through your database. Mango Automation has lots of benefits over 1.13 including support but also if you go with the Enterprise edition we have an upgrade process which will convert all your data over to the new high performance database. We also have a modules specially for Breweries that you might want to look at: http://forum.infiniteautomation.com/forum/forums/show/21.page
Joel.
-
Jeremy and Joel:
Thanks for the replies.
Jeremy: To reinstall, i exported the entire mango data base, using mySQL Export, then imported it into a virgin mango installation on another computer with mySQL Import.
I found the problem. At some time in the past, Mango created a table called datasourcesold which appears to be identical to datasources. When I created a new datasource, a new entry was made in datasources but not in datasourcesold. Then when I tried to create a new point, the difference btween datasources and datasourcesold triggered the error.
I copied the newly created datasource record from datasources to datasourcesold. Then the new point was created wih no problem.
I'll be testing this extensively before going forward.
Again, thanks for the responses.
Ken