Summary:

The customer was experiencing an issue synching records using the Exchange integration. A single class of updates (Appointments -> Exchange to CRM) would work, but everything else would fail. The customer disabled appointment synching, and found that the error would also occur when synching contacts.

Symptoms:

The following was logged in the exchangesyncengine.log:

2013-03-11/10:15:17.401/GMT [SyncEngine thread] ERROR com.sage.scrm.core.httpconsumer.HttpConsumer.logError <sdata:diagnoses xmlns:sdata="http://schemas.sage.com/sdata/2008/1">
<sdata:diagnosis>
<sdata:severity/>
<sdata:sdataCode/>
<sdata:applicationCode/>
<sdata:message>com.sage.scrm.model.error.SageSynchronizationException: com.sage.scrm.model.error.SageDataAccessException: Data access failure.</sdata:message>
<sdata:stackTrace>com.sage.scrm.view.error.SageSDataGenerationException: com.sage.scrm.model.error.SageSynchronizationException: com.sage.scrm.model.error.SageDataAccessException: Data access failure.

at com.sage.scrm.model.store.SyncSourceSDataStore.handleSubsequentRequest(SyncSourceSDataStore.java:596)

at com.sage.scrm.model.store.SyncSourceSDataStore.generateContent(SyncSourceSDataStore.java:337)

at com.sage.scrm.model.store.SyncSourceSDataStore.getData(SyncSourceSDataStore.java:241)

at com.sage.scrm.controller.AbstractSyncController.getModelAndView(AbstractSyncController.java:275)

at com.sage.scrm.controller.AbstractSyncController.requestAction(AbstractSyncController.java:218)

...


Caused by: com.sage.scrm.model.error.SageSynchronizationException: com.sage.scrm.model.error.SageDataAccessException: Data access failure.

at com.sage.scrm.model.sync.SyncSourceManagerWorker.updateSynchronizationEntries(SyncSourceManagerWorker.java:105)

at com.sage.scrm.model.store.SyncSourceSDataStore.handleSubsequentRequest(SyncSourceSDataStore.java:519)

... 40 more

Caused by: com.sage.scrm.model.error.SageDataAccessException: Data access failure.

at com.sage.scrm.model.sync.db.SCRMAccessDB.getInsertedRecords(SCRMAccessDB.java:487)

at com.sage.scrm.model.sync.SyncSourceManager.processSychronizationData(SyncSourceManager.java:1223)

at com.sage.scrm.model.sync.SyncSourceManager.updateSynchronizationEntry(SyncSourceManager.java:1072)

at com.sage.scrm.model.sync.SyncSourceManager$$FastClassByCGLIB$$91c4d5b7.invoke(<generated>)

at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)

at com.sage.scrm.model.sync.SyncSourceManagerExchange$$EnhancerByCGLIB$$4cd57128.updateSynchronizationEntry(<generated>)

at com.sage.scrm.model.sync.SyncSourceManagerWorker.updateSynchronizationEntries(SyncSourceManagerWorker.java:96)

... 41 more

Caused by: com.sage.scrm.model.metadata.error.SageEntityDoesntExistException: entityDoesntExists: MyCustomTable

at com.sage.scrm.model.metadata.MetaDataStore.getEntityReadOnly(MetaDataStore.java:1257)

at sun.reflect.GeneratedMethodAccessor354.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)

at $Proxy38.getEntityReadOnly(Unknown Source)

at com.sage.scrm.model.sync.db.SCRMAccessDB.createSubSelectForRelationShip(SCRMAccessDB.java:653)

at com.sage.scrm.model.sync.db.SCRMAccessDB.createWhereClauseToGetInserts(SCRMAccessDB.java:568)

at com.sage.scrm.model.sync.db.SCRMAccessDB.getInsertedRecords(SCRMAccessDB.java:466)

... 52 more

</sdata:stackTrace>
<sdata:payloadPath/>
</sdata:diagnosis></sdata:diagnoses>

2013-03-11/10:15:17.406/GMT [SyncEngine thread] ERROR com.sage.scrm.syncengine.exchange.engine.SynchronisationThread.run com.sage.scrm.syncengine.core.engine.error.SageSyncEngineException: com.sage.scrm.syncengine.exchange.engine.model.error.SageSDataEndpointException: com.sage.scrm.core.httpconsumer.error.SageHttpConsumerException: POST on http://CRM-SERVER/sdata/crmj/crmExchange/-/contacts/$syncSource?trackingId=00ffd3ea-897e-4efe-aff6-f1b16a36e6b4&count=100 failed: 500

Work around / Resolution:

The error was occurring when the synch engine was requesting data from the crmj webapp. In the error above, you can see that it's complaining that and entity does not exist - MyCustomTable.

The customer had added a custom table to their CRM database without making reference to it through the CRM interface. As such, it had no metadata.
Adding a table connection in Administration -> Advanced Customisation -> Tables & Databases resolved the issue.