Foros de discusión

Data Truncation error while deploying into production

Anu Narayanan, modificado hace 8 años.

Data Truncation error while deploying into production

Junior Member Mensajes: 50 Fecha de incorporación: 24/04/15 Mensajes recientes
Hi, I have developed a Liferay portal application and trying to deploy the war file into the production on Tomcat server. I am getting the following error and not only that it deletes several rows from the table in the database. I have been trying to find what is causing the data truncation but unable to do so. Any help is appreciated.

18:35:12,226 ERROR [localhost-startStop-2][HotDeployImpl:230] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registerin
g plugins for WaterDevelopmentFFC-portletWaterDevelopmentFFC-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering plugins for WaterDevelopmentFFC-portletWaterDevelopmentFFC-p
ortlet
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeDeploy(PluginPackageHotDeployListener.java:64)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:227)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.liferay.portal.kernel.exception.SystemException: java.sql.BatchUpdateException: Data truncation
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.initServiceComponent(ServiceComponentLocalServiceImpl.java:
188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy94.initServiceComponent(Unknown Source)
at com.liferay.portal.service.ServiceComponentLocalServiceUtil.initServiceComponent(ServiceComponentLocalServiceUtil.java:288)
at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.initServiceComponent(PluginPackageHotDeployListener.java:247)
at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.doInvokeDeploy(PluginPackageHotDeployListener.java:132)
at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeDeploy(PluginPackageHotDeployListener.java:61)
... 23 more
Caused by: java.sql.BatchUpdateException: Data truncation
at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:947)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.kernel.upgrade.dao.orm.UpgradeOptimizedPreparedStatementHandler.invoke(UpgradeOptimizedPreparedStatementH
andler.java:50)
at com.sun.proxy.$Proxy436.executeBatch(Unknown Source)
at com.liferay.portal.upgrade.util.Table.populateTableRows(Table.java:529)
at com.liferay.portal.upgrade.util.Table.populateTable(Table.java:491)
at com.liferay.portal.upgrade.util.Table.populateTable(Table.java:434)
at com.liferay.portal.upgrade.util.BaseUpgradeTableImpl.updateTable(BaseUpgradeTableImpl.java:104)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.upgradeModels(ServiceComponentLocalServiceImpl.java:509)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.doUpgradeDB(ServiceComponentLocalServiceImpl.java:342)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl$DoUpgradeDBPrivilegedExceptionAction.run(ServiceComponentLo
calServiceImpl.java:262)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl$NoPACL.doUpgradeDB(ServiceComponentLocalServiceImpl.java:53
3)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.upgradeDB(ServiceComponentLocalServiceImpl.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy94.upgradeDB(Unknown Source)
at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.initServiceComponent(ServiceComponentLocalServiceImpl.java:
179)
... 37 more
Mar 22, 2016 6:35:12 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Loading file:/C:/Liferay/liferay-portal-tomcat-6.2-ce-ga4-20150416163831865/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/temp/2-WaterDevelop
mentFFC-portlet/WEB-INF/classes/service.properties
18:35:12,784 INFO [localhost-startStop-2][PortletHotDeployListener:344] Registering portlets for WaterDevelopmentFFC-portlet
Loading file:/C:/Liferay/liferay-portal-tomcat-6.2-ce-ga4-20150416163831865/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/temp/2-WaterDevelop
thumbnail
Bijan Vakili, modificado hace 8 años.

RE: Data Truncation error while deploying into production

Expert Mensajes: 375 Fecha de incorporación: 10/03/09 Mensajes recientes
Good evening Anu Narayanan,

It means a column isn't large enough! For example, we may have a column: varchar(5) name; and try to insert following entry: "123456" - since the value is larger than the size (size of string "123456" is larger than max length of column, 5) the data truncation is happening.

First you have to find out which column though; and then you can increase the column size.

Double-check column and data sizes. Provide more details so can help further:
I have developed a Liferay portal application and trying to deploy the war file into the production on Tomcat server

- Did you already have the war deployed?
- Was there data in the custom tables?
- Was any table column sized changed there?
Anu Narayanan, modificado hace 8 años.

RE: Data Truncation error while deploying into production

Junior Member Mensajes: 50 Fecha de incorporación: 24/04/15 Mensajes recientes
Thanks for your response. Yes I already have the application running in the production. I made some changes in the development environment and tested it there and tried to deploy the same changes to the production. The change was to add a new field in the database table. I tested in the development environment and works fine there.

From the error message I understood that the data is getting truncated as its not compatible with the existing data structure in the database. How can we find which field is the one doing this?
thumbnail
Bijan Vakili, modificado hace 8 años.

RE: Data Truncation error while deploying into production

Expert Mensajes: 375 Fecha de incorporación: 10/03/09 Mensajes recientes
One way is to export DB schemas: one for the PROD and one for DEV DBs; then compare the two schemas, find the diff emoticon
Anu Narayanan, modificado hace 8 años.

RE: Data Truncation error while deploying into production (Respuesta)

Junior Member Mensajes: 50 Fecha de incorporación: 24/04/15 Mensajes recientes
Thanks we tried doing that.
Later on after doing some research on the underlying Liferay infrastructure I found a solution/workaround. In my initial release we had the tables with all the columns. I had created the models in the Liferay by defining the entities in the service.xml. In the release 2, I had to add new fields to the existing tables. So I updated the entities in the service.xml and while installing the plugin, it gave me the "Data Truncation" error. I found that Liferay identified that the build number is greater now so it is trying to upgrade the database. While doing so it is failing to copy some of the data from the temporary file it is using. Hence the "data truncation" error. Not sure why its failing. But the workaround for it is to set the 'build.auto.upgrade' to false so that Liferay does not try to upgrade the database which I can do manually. Now I don't get that error anymore and the data is not getting deleted from the database.