Customers and Partners are asking me frequently how to analyze problems related to SMP3 or HPms. Because we were running in such a problem recently I will share here how we handled this kind of situations.

Problem:

Offline Synchonization (using OData Offline Approach) is not working. The initial Offline DB opening is failing because of an error on the server.

Analysis:

The error message on the client is the first hint. It is saying that the error happened on the server, thus SMP3 should have some more information. Got o Management Cockpit and increase the log level of the corresponding component. In our case I increased the “Offline OData” component to log level “PATH”. After that I reproduced the problem and downloaded the ServerLog file.


2016 05 13 11:03:38#+0200#INFO#com.sap.odata.offline.scripts.ODataSyncHandler##BE82627#Thread-221##37666fcc-f5d7-4a5f-9070-4fd743ddf898#de.sap.mit.test#1bb21891-190b-11e6-8000-e7c7deaad8a4#RequestResponse#200#{SMPARCH-5015-otp-two-factor-authentication=false, SMPSRVRUN3-841-SAML-IdP-proxy=true, SMPARCH-4846-odp-cookie-store=true}##A new database is required for the client |
2016 05 13 11:03:38#+0200#ERROR#com.sap.odata.offline.scripts.ODataSyncHandler##BE82627#Thread-221##37666fcc-f5d7-4a5f-9070-4fd743ddf898#de.sap.mit.test#1bb21891-190b-11e6-8000-e7c7deaad8a4#RequestResponse#200#{SMPARCH-5015-otp-two-factor-authentication=false, SMPSRVRUN3-841-SAML-IdP-proxy=true, SMPARCH-4846-odp-cookie-store=true}##[-100000] An unexpected error occurred while converting the OData metadata to DB metadata: An exception occurred.
 Error caused by: An exception occurred.
 com.sap.odata.offline.util.MODataException: [-100000] An unexpected error occurred while converting the OData metadata to DB metadata: An exception occurred.
 Error caused by: An exception occurred.
  at com.sap.odata.offline.scripts.MetadataHasher.computeMetadataHash(MetadataHasher.java:126)
  at com.sap.odata.offline.scripts.ODataSyncHandler.processMetadata(ODataSyncHandler.java:625)
  at com.sap.odata.offline.scripts.ODataSyncHandler.doHandleDownloadData(ODataSyncHandler.java:280)
  at com.sap.odata.offline.scripts.ODataSyncHandler$2.call(ODataSyncHandler.java:258)
  at com.sap.mobile.platform.server.mobilink.MODataServiceSupport.executeWithContext(MODataServiceSupport.java:103)
  at com.sap.odata.offline.util.MODataServiceImpl.executeWithContext(MODataServiceImpl.java:87)
  at com.sap.odata.offline.scripts.ODataSyncHandler.handle_DownloadData(ODataSyncHandler.java:263)
  at sun.reflect.GeneratedMethodAccessor388.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at ianywhere.ml.script.MethodInfo.invoke(MethodInfo.java:12222)
Caused by: org.apache.olingo.odata2.api.edm.EdmException: An exception occurred.
  at org.apache.olingo.odata2.core.edm.provider.EdmNamedImplProv.getValidatedName(EdmNamedImplProv.java:55)
  at org.apache.olingo.odata2.core.edm.provider.EdmNamedImplProv.<init>(EdmNamedImplProv.java:42)
  at org.apache.olingo.odata2.core.edm.provider.EdmTypedImplProv.<init>(EdmTypedImplProv.java:41)
  at org.apache.olingo.odata2.core.edm.provider.EdmElementImplProv.<init>(EdmElementImplProv.java:38)
  at org.apache.olingo.odata2.core.edm.provider.EdmPropertyImplProv.<init>(EdmPropertyImplProv.java:36)
  at org.apache.olingo.odata2.core.edm.provider.EdmSimplePropertyImplProv.<init>(EdmSimplePropertyImplProv.java:31)
  at org.apache.olingo.odata2.core.edm.provider.EdmStructuralTypeImplProv.createProperty(EdmStructuralTypeImplProv.java:166)
  at org.apache.olingo.odata2.core.edm.provider.EdmStructuralTypeImplProv.getPropertyInternal(EdmStructuralTypeImplProv.java:152)
  at org.apache.olingo.odata2.core.edm.provider.EdmEntityTypeImplProv.getPropertyInternal(EdmEntityTypeImplProv.java:146)
  at org.apache.olingo.odata2.core.edm.provider.EdmStructuralTypeImplProv.getProperty(EdmStructuralTypeImplProv.java:108)
  at com.sap.odata.offline.scripts.MetadataHasher.addEntityTypeForHash(MetadataHasher.java:259)
  at com.sap.odata.offline.scripts.MetadataHasher.computeMetadataHash(MetadataHasher.java:67)
  ... 10 common frames omitted
|
2016 05 13 11:03:38#+0200#DEBUG#com.sap.odata.offline.scripts.ODataSyncHandler###Thread-221#########ML_SCRIPT Exit handle_DownloadData: remoteID=1bb21890-190b-11e6-8000-e7c7deaad8a4 |

Inside the server log you can see that SMP3 found out that a new client database is required for this client (makes sense because it was the initial data sync). SMP3 will then get the metadata document of the corresponding OData server. After that this metadata document will be parsed, and the OData model is used to create the structure of the local client database (e.g. entities will be represented as tables and entity attributes as columns). The MOData Exception telling us that the error occurred inside the Mobilink component which is mainly responsible for synchronization activities. The error: “An unexpected error occurred while converting the OData metadata to DB metadata” shows that the problem should be part of the OData metadata document, because SMP3 was not be able to use this metadata document to create a local db structure.

In our case the metadata document was quite large (more than 50 entities and lots of associations), so it would be good to narrow down the problem a bit. For this we have to have a closer look to the Java stacktrace. Usually especially the “Caused by” part of the stacktrace is interesting, because it will name the methods and classes where the exception got thrown. In our case the method getValidatedName threw the exception in class org.apache.olingo.odata2.core.edm.provider.EdmTypedImplProv. Olingo is the framework used internally to convert Mobilink data and OData. Because Apache Olingo is open source we can even have a look into the source code. Google will point you e.g. to following file: GC: EdmNamedImplProv – org.apache.olingo.odata2.core.edm.provider.EdmNamedImplProv (.java) – GrepCode Class Source . The getValidatedName method is verifying if a given string is fulfilling the following regex expression:


^[:A-Z_a-z\u00C0\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd\x10000-\xEFFFF][:A-Z_a-z\u00C0\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\udfff\uf900-\ufdcf\ufdf0-\ufffd\-\.0-9\u00b7\u0300-\u036f\u203f-\u2040]*\Z

So now let’s have a closer look on the metadata document which should cause our problem. We can assume that the problem is related to a malformed value or a value that is containing characters which are not allowed.

Inside one Entity definition we saw a German umlaut in the property’s name


<Property Name="Aktivität" Type="Edm.String" Nullable="false" MaxLength="1" sap:label="Aktivität" sap:creatable="false" sap:updatable="false" sap:sortable="false"/>
<Property Name="Notizen" Type="Edm.String" MaxLength="2048" sap:label="Notizen" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>

The sap:label can contain umlauts, but an OData property name must not contain special characters. We can make this sure by testing “Aktivität” against the regex.

after we identified the problem, we simply updated the metadata document in SAP Gateway so that no property value contains special characters. After that the inital client synchronization (=offline db creation) was successful.

This blog post should give you an example on how you can analyze and debug SMP3 server problems.

Process Steps:

1) Increase log level and reproduce problem

2) Carefully check the exception/error message which should be available in the server log

3) Try to understand the Java stacktrace, to identify problem related components, classes and methods

4) Use Google and SCN to find information to this problem

5) After problem identification, solve root cause!

If you still were not able to identify the problem, then open a question in SCN or create an SAP incident ticket. Inside the ticket mention your current server version, explain steps to reproduce the problem and attach the server log.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply