Violation of PRIMARY KEY constraint 'PK_SERVER_HIT'. Cannot insert duplicate key in object 'ofbiz.SERVER_HIT'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Violation of PRIMARY KEY constraint 'PK_SERVER_HIT'. Cannot insert duplicate key in object 'ofbiz.SERVER_HIT'

snowch
Hi Forum,

I am receiving the following error message.  I think it's because I have a number of requests hitting the same resource at the same time.

For the moment, I have removed the primarykey from the SERVER_HIT table.

Any ideas?  Many thanks in advance.

Chris


---- stack trace ---------------------------------------------------------------
org.ofbiz.entity.GenericEntityException: Exception while inserting the following entity: [GenericEntity:ServerHit][contentId,xxx.ImageServlet(java.lang.String)][createdStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][createdTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][hitStartDateTime,2009-05-11 09:40:19.362(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][lastUpdatedTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][partyId,10000(java.lang.String)][referrerUrl,https://localhost/xxx/control/ImageEngineerDetails(java.lang.String)][requestUrl,https://localhost/xxx/control/ImageServlet?UpliftNumber=700002&ImgNum=2&thumb=true(java.lang.String)][runningTimeMillis,31(java.lang.Long)][serverHostName,XXXXX(java.lang.String)][serverIpAddress,10.0.0.2(java.lang.String)][userLoginId,csnow(java.lang.String)][visitId,10188(java.lang.String)] (while inserting: [GenericEntity:ServerHit][contentId,xxx.ImageServlet(java.lang.String)][createdStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][createdTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][hitStartDateTime,2009-05-11 09:40:19.362(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][lastUpdatedTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][partyId,10000(java.lang.String)][referrerUrl,https://localhost/xxx/control/ImageEngineerDetails(java.lang.String)][requestUrl,https://localhost/xxx/control/ImageServlet?UpliftNumber=700002&ImgNum=2&thumb=true(java.lang.String)][runningTimeMillis,31(java.lang.Long)][serverHostName,XXXXX(java.lang.String)][serverIpAddress,10.0.0.2(java.lang.String)][userLoginId,csnow(java.lang.String)][visitId,10188(java.lang.String)] (SQL Exception while executing the following:INSERT INTO ofbiz.SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Violation of PRIMARY KEY constraint 'PK_SERVER_HIT'. Cannot insert duplicate key in object 'ofbiz.SERVER_HIT'.)))
org.ofbiz.entity.datasource.GenericDAO.insert(GenericDAO.java:116)
org.ofbiz.entity.datasource.GenericHelperDAO.create(GenericHelperDAO.java:65)
org.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:560)
org.ofbiz.entity.GenericDelegator.create(GenericDelegator.java:533)
org.ofbiz.entity.GenericValue.create(GenericValue.java:112)
org.ofbiz.webapp.stats.ServerHitBin.saveHit(ServerHitBin.java:654)
org.ofbiz.webapp.stats.ServerHitBin.countHit(ServerHitBin.java:208)
org.ofbiz.webapp.stats.ServerHitBin.countHit(ServerHitBin.java:85)
org.ofbiz.webapp.stats.ServerHitBin.countRequest(ServerHitBin.java:58)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:255)
javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)
org.ofbiz.entity.GenericEntityException: while inserting: [GenericEntity:ServerHit][contentId,xxx.ImageServlet(java.lang.String)][createdStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][createdTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][hitStartDateTime,2009-05-11 09:40:19.362(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][lastUpdatedTxStamp,2009-05-11 09:40:19.393(java.sql.Timestamp)][partyId,10000(java.lang.String)][referrerUrl,https://localhost/xxx/control/ImageEngineerDetails(java.lang.String)][requestUrl,https://localhost/xxx/control/ImageServlet?UpliftNumber=700002&ImgNum=2&thumb=true(java.lang.String)][runningTimeMillis,31(java.lang.Long)][serverHostName,DH-BS5-SQL01(java.lang.String)][serverIpAddress,10.0.0.2(java.lang.String)][userLoginId,csnow(java.lang.String)][visitId,10188(java.lang.String)] (SQL Exception while executing the following:INSERT INTO ofbiz.SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Violation of PRIMARY KEY constraint 'PK_SERVER_HIT'. Cannot insert duplicate key in object 'ofbiz.SERVER_HIT'.))