cancel
Showing results for 
Search instead for 
Did you mean: 

How To... On-board users with SMP 3.0 SP08 OData SDK (Android)

Former Member
0 Kudos

Using the SMP OData 3.0 SDK to onboard users gives developers more control and freedom over the look and feel of the logon screen. The goal of this exercise is to show the key pieces of code and information needed to onboard users with the SMP 3.0 OData SDK using basic authentication.

This is my code.

package com.example.maflogon;

import com.sap.maf.tools.logon.core.LogonCore;

import com.sap.maf.tools.logon.core.LogonCore.UserCreationPolicy;

import com.sap.maf.tools.logon.core.LogonCoreContext;

import com.sap.maf.tools.logon.core.LogonCoreException;

import com.sap.maf.tools.logon.core.LogonCoreListener;

import com.sybase.persistence.DataVault.DVPasswordPolicy;

import android.os.Bundle;

import android.app.Activity;

import android.util.Log;

public class LogonActivity2 extends Activity implements LogonCoreListener {

  private static final String TAG = "timothy";

  private boolean isHttpsEnabled = false;

  private String appConnId;

  private LogonCore logonCore;

  @Override

  protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  this.initLogonCore();

  registerDevice();

  }

  private void initLogonCore() {

  logonCore = LogonCore.getInstance();

  logonCore.init(this, "com.crv.mv");

  logonCore.setLogonCoreListener(this);

  }

  private void registerDevice() {

  Log.i(TAG, "appConnId:" + appConnId);

  LogonCoreContext logonCoreContext = logonCore.getLogonContext();

  logonCoreContext.setHost("10.0.97.52"); // please input the correct

  // IP address here

  int port = 8080;

  logonCoreContext.setPort(port);

  logonCoreContext.setHttps(isHttpsEnabled);

  UserCreationPolicy ucPolicy = UserCreationPolicy.automatic;

  logonCoreContext.setUserCreationPolicy(ucPolicy);

  logonCoreContext.setSecurtityConfig("default");

  logonCoreContext.setDomain("default");

  // logonCoreContext.getConnId()

  try {

  logonCoreContext.setBackendUser("smpAdmin"); // please note: here we

  // input SMP cockpit

  // logon username,

  // NOT backend

  // username

  logonCoreContext.setBackendPassword("s345in"); // please note:

  // here we input

  // SMP cockpit

  // logon pwd,

  // NOT backend

  // pwd

  } catch (LogonCoreException e) {

  Log.e(TAG, "error entering user credentials", e);

  }

  logonCore.register(logonCoreContext);

  Log.i(TAG, "after register");

  }

  @Override

  public void applicationSettingsUpdated() {

  }

  @Override

  public void backendPasswordChanged(boolean arg0) {

  }

  @Override

  public void deregistrationFinished(boolean arg0) {

  }

  @Override

  public void registrationFinished(boolean success, String message, int errorCode, DVPasswordPolicy arg3) {

  Log.i(TAG, "registrationFinished, success? " + success); // If you get

  // “success”

  // in

  // console

  // output,

  // go to

  // cockpit/applictions/click

  // on your

  // application

  // id, you

  // will see

  // if a new

  // registration

  // already

  // created!

  Log.i(TAG, "registrationFinished, message= " + message);

  Log.i(TAG, "registrationFinished, errorCode= " + errorCode);

  String Id = logonCore.getApplicationId();

  try {

  String AppConnectionID = logonCore.getObjectFromStore("appcid");

  } catch (LogonCoreException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  }

  }

  @Override

  public void traceUploaded() {

  }

}

but exception is  java.lang.NoClassDefFoundError: com.sybase.mo.MessagingClientException ,who can help me ?

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

Hi Tang,

There is a how to guide available on this: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30304722-614d-3210-65a6-faf86a032...

You could also find a sample project in this how to guide:

You could find all other guides here:

Before testing it from your mobile app I would suggest you to use a rest client to register your app to make sure that the app configurations you made are correct. You could follow this blog:

Regards,Midhun

SAP Technology RIG

Former Member
0 Kudos

Dear Midhun VP

I use sp08,but new  Exception find.

07-23 11:21:46.870: I/CachedDir(9474): dir=/data/skin(9474,-1225729044)

07-23 11:21:46.870: I/CachedDir(9474): dir=/data/skin_ps(9474,-1225729044)

07-23 11:21:46.900: V/ActivityThread(9474): ActivityRecord{e2ab909 token=android.os.BinderProxy@3287b70e {com.example.maflogon/com.example.maflogon.LogonActivity2}}: app=android.app.Application@63652f, appName=com.example.maflogon, pkg=com.example.maflogon, comp={com.example.maflogon/com.example.maflogon.LogonActivity2}, dir=/data/app/com.example.maflogon-1/base.apk

07-23 11:21:46.905: V/HwPolicyFactory(9474): : success to get AllImpl object and return....

07-23 11:21:46.910: V/HwWidgetFactory(9474): : successes to get AllImpl object and return....

07-23 11:21:46.910: I/CachedDir(9474): folder created!

07-23 11:21:46.915: I/CachedDir(9474): file changed, refill cache - 1

07-23 11:21:46.915: V/ActivityThread(9474): ActivityThread,callActivityOnCreate

07-23 11:21:46.935: D/CubicBezierInterpolator(9474): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:21:46.935: D/CubicBezierInterpolator(9474): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:21:46.935: D/CubicBezierInterpolator(9474): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:21:46.940: D/CubicBezierInterpolator(9474): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:21:47.005: I/CachedDir(9474): file changed, refill cache - 1357

07-23 11:21:47.100: W/ResourceType(9474): No package identifier when getting value for resource number 0x00000000

07-23 11:21:47.100: I/ClientHub(9474): Properties file not configured

07-23 11:21:47.105: I/ClientHub(9474): ClientHub application not installed on this device

07-23 11:21:47.105: D/SeedDataAPI.retrieveSeedData()(9474): PackageName: com.example.maflogon

07-23 11:21:47.110: E/ActivityThread(9474): Failed to find provider info for com.Android.provider.Afaria

07-23 11:21:47.110: I/timothy(9474): appConnId:null

07-23 11:21:47.120: D/AndroidRuntime(9474): Shutting down VM

07-23 11:21:47.120: E/AndroidRuntime(9474): FATAL EXCEPTION: main

07-23 11:21:47.120: E/AndroidRuntime(9474): Process: com.example.maflogon, PID: 9474

07-23 11:21:47.120: E/AndroidRuntime(9474): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sap/smd/e2e/trace/bustrans/BusTransXmlWriter;

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.mobile.lib.request.RequestManager.makeRequest(RequestManager.java:245)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.ChannelSelector.makeServerRequest(ChannelSelector.java:141)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.ChannelSelector.access$700(ChannelSelector.java:33)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.ChannelSelector$PingRequest.ping(ChannelSelector.java:242)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.ChannelSelector$PingRequest.access$000(ChannelSelector.java:218)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.ChannelSelector.selectChannel(ChannelSelector.java:72)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.reg.RegistrationManager.register(RegistrationManager.java:54)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.sap.maf.tools.logon.core.LogonCore.register(LogonCore.java:433)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.example.maflogon.LogonActivity2.registerDevice(LogonActivity2.java:63)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.example.maflogon.LogonActivity2.onCreate(LogonActivity2.java:25)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.Activity.performCreate(Activity.java:6100)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.ActivityThread.access$1200(ActivityThread.java:163)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.os.Handler.dispatchMessage(Handler.java:102)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.os.Looper.loop(Looper.java:135)

07-23 11:21:47.120: E/AndroidRuntime(9474): at android.app.ActivityThread.main(ActivityThread.java:5595)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.reflect.Method.invoke(Native Method)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.reflect.Method.invoke(Method.java:372)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)

07-23 11:21:47.120: E/AndroidRuntime(9474): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

07-23 11:21:47.120: E/AndroidRuntime(9474): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sap.smd.e2e.trace.bustrans.BusTransXmlWriter" on path: DexPathList[[zip file "/data/app/com.example.maflogon-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

07-23 11:21:47.120: E/AndroidRuntime(9474): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

07-23 11:21:47.120: E/AndroidRuntime(9474): ... 23 more

07-23 11:21:47.120: E/AndroidRuntime(9474): Suppressed: java.lang.ClassNotFoundException: com.sap.smd.e2e.trace.bustrans.BusTransXmlWriter

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.Class.classForName(Native Method)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

07-23 11:21:47.120: E/AndroidRuntime(9474): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

07-23 11:21:47.120: E/AndroidRuntime(9474): ... 24 more

07-23 11:21:47.120: E/AndroidRuntime(9474): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I need the jar ,But I can't find com.sap.smd.e2e.trace.bustrans.BusTransXmlWriter.

midhun_vp
Active Contributor
0 Kudos

Hi Tang,

You could follow this help documentation to import all the libraries needed for your project:http://help.sap.com/saphelp_smp309sdk/helpdata/en/10/2cb0c9c5ac45ca98e324ee07886946/content.htm?fram...

It has information on android studio and ADT.

Regards,Midhun

SAP Technology RIG

Former Member
0 Kudos

dear midhun,

    Thanks you.

Former Member
0 Kudos

Hi Midhun, Kindly help. I have a major issue.

My devices are Android OS version 5.1

While my SMP server is in SP07. Hence I had opted for SMP SP07  SDK.

However, I am stuck with this error,

Did not find class, com.Sybase.mo.MessagingException.

Now I am not sure if it incompatibility between Android 5.1 and SMP SP07 and whether I should move to SP09?

How can I find supported Android OS for SP versions. The release notes does not give supported OS versions for Individual SP versions.

oliver_kaluscha3
Participant
0 Kudos

Hello Midhun,

it would be vary kind if you could try to help us, too.

We followed the instructions provided in the link that you've given in your response to original question, but the How-To seems to be outdated. There are talking about *.apklib files but we only found *.aar files in the folder /NativeSDK/MAFReuse/Android/libraries.

We included all *.jar libs from /NativeSDK/ODataFramework/Android/libraries

into our project and imported the *.aar files found /NativeSDK/MAFReuse/Android/libraries as modules.

So our project structure looks like this:

And the dependencies in the gradle file are defined as the following:

When we try to init the LogonCore be running the code:

final LogonCore logonCore = LogonCore.getInstance();

logonCore.init(context,applicationID);

We get the following exception:

java.lang.NoClassDefFoundError: com.sybase.mo.MessagingClientException

                                                                          at libcore.reflect.InternalNames.getClass(InternalNames.java:55)

                                                                          at java.lang.Class.getDexCacheType(Class.java:479)

                                                                          at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:705)

                                                                          at libcore.reflect.AnnotationAccess.decodeValue(AnnotationAccess.java:676)

                                                                          at libcore.reflect.AnnotationAccess.getExceptions(AnnotationAccess.java:463)

                                                                          at java.lang.reflect.Method.getExceptionTypes(Method.java:160)

                                                                          at java.lang.reflect.AbstractMethod.getMethodOrConstructorGenericInfo(AbstractMethod.java:236)

                                                                          at java.lang.reflect.Method.getGenericParameterTypes(Method.java:247)

                                                                          at com.sap.maf.tools.logon.core.reg.IMOChannelReflection.initializeMethodCache(IMOChannelReflection.java:39)

                                                                          at com.sap.maf.tools.logon.core.reg.IMOChannelReflection.<init>(IMOChannelReflection.java:30)

                                                                          at com.sap.maf.tools.logon.core.reg.RegistrationManager.init(RegistrationManager.java:168)

                                                                          at com.sap.maf.tools.logon.core.LogonCore.init(LogonCore.java:405)

We are using SMP SDK 3.0 SP 10 and out test device is a Samsung Galaxay S5 running on Android 5.0.

Do you have any idea what we could do to prevent that issue?

Thanks in advance.

oliver_kaluscha3
Participant
0 Kudos

Update:

We've found the documentation for SMP 30 SDK SP 11 here: Setting Up Android Studio for Native SDK Development - Application Development in SAP Mobile Platfor... and adopted the way we include the *.arr files into our project accordingly.

But we still get the java.lang.NoClassDefFoundError: com.sybase.mo.MessagingClientException when we try to initialize the LogonContext.

I've looked into every *.jar and every *.arr file but could neither find the desired class nor even the package com.sybase.*. All packages start with com.sap.*.

Any help is very welcome....

Answers (1)

Answers (1)

Former Member
0 Kudos

07-23 11:11:08.975: V/HwWidgetFactory(5594): : successes to get AllImpl object and return....

07-23 11:11:08.975: I/CachedDir(5594): folder created!

07-23 11:11:08.975: I/CachedDir(5594): file changed, refill cache - 1

07-23 11:11:08.980: V/ActivityThread(5594): ActivityThread,callActivityOnCreate

07-23 11:11:08.995: D/CubicBezierInterpolator(5594): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:11:09.000: D/CubicBezierInterpolator(5594): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:11:09.000: D/CubicBezierInterpolator(5594): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:11:09.000: D/CubicBezierInterpolator(5594): CubicBezierInterpolator  mControlPoint1x = 0.2, mControlPoint1y = 0.65, mControlPoint2x = 0.28, mControlPoint2y = 0.97

07-23 11:11:09.060: I/CachedDir(5594): file changed, refill cache - 1357

07-23 11:11:09.200: W/ResourceType(5594): No package identifier when getting value for resource number 0x00000000

07-23 11:11:09.200: I/ClientHub(5594): Properties file not configured

07-23 11:11:09.210: I/ClientHub(5594): ClientHub application not installed on this device

07-23 11:11:09.220: D/SeedDataAPI.retrieveSeedData()(5594): PackageName: com.example.maflogon

07-23 11:11:09.225: E/ActivityThread(5594): Failed to find provider info for com.Android.provider.Afaria

07-23 11:11:09.225: I/timothy(5594): appConnId:null

07-23 11:11:09.245: D/AndroidRuntime(5594): Shutting down VM

07-23 11:11:09.250: E/AndroidRuntime(5594): FATAL EXCEPTION: main

07-23 11:11:09.250: E/AndroidRuntime(5594): Process: com.example.maflogon, PID: 5594

07-23 11:11:09.250: E/AndroidRuntime(5594): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sap/smd/e2e/trace/bustrans/BusTransXmlWriter;

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.mobile.lib.request.RequestManager.makeRequest(RequestManager.java:245)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.ChannelSelector.makeServerRequest(ChannelSelector.java:141)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.ChannelSelector.access$700(ChannelSelector.java:33)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.ChannelSelector$PingRequest.ping(ChannelSelector.java:242)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.ChannelSelector$PingRequest.access$000(ChannelSelector.java:218)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.ChannelSelector.selectChannel(ChannelSelector.java:72)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.reg.RegistrationManager.register(RegistrationManager.java:54)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.sap.maf.tools.logon.core.LogonCore.register(LogonCore.java:433)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.example.maflogon.LogonActivity2.registerDevice(LogonActivity2.java:63)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.example.maflogon.LogonActivity2.onCreate(LogonActivity2.java:25)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.Activity.performCreate(Activity.java:6100)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1109)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.ActivityThread.access$1200(ActivityThread.java:163)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1371)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.os.Handler.dispatchMessage(Handler.java:102)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.os.Looper.loop(Looper.java:135)

07-23 11:11:09.250: E/AndroidRuntime(5594): at android.app.ActivityThread.main(ActivityThread.java:5595)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.reflect.Method.invoke(Native Method)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.reflect.Method.invoke(Method.java:372)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)

07-23 11:11:09.250: E/AndroidRuntime(5594): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

07-23 11:11:09.250: E/AndroidRuntime(5594): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sap.smd.e2e.trace.bustrans.BusTransXmlWriter" on path: DexPathList[[zip file "/data/app/com.example.maflogon-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

07-23 11:11:09.250: E/AndroidRuntime(5594): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

07-23 11:11:09.250: E/AndroidRuntime(5594): ... 23 more

07-23 11:11:09.250: E/AndroidRuntime(5594): Suppressed: java.lang.ClassNotFoundException: com.sap.smd.e2e.trace.bustrans.BusTransXmlWriter

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.Class.classForName(Native Method)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

07-23 11:11:09.250: E/AndroidRuntime(5594): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

07-23 11:11:09.250: E/AndroidRuntime(5594): ... 24 more

07-23 11:11:09.250: E/AndroidRuntime(5594): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

07-23 11:11:09.565: I/Process(5594): Sending signal. PID: 5594 SIG: 9