Stage 2

Running Tuscany SCA from Android

Running the existing version of calculator-android fires the following error in the android Logcat:

05-31 06:12:43.478: ERROR/dalvikvm(1261): Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain
.createDeploymentComposite
05-31 06:12:43.498: ERROR/AndroidRuntime(1261): Uncaught handler: thread main exiting due to uncaught exception
05-31 06:12:43.528: ERROR/AndroidRuntime(1261): java.lang.VerifyError: org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at org.apache.tuscany.sca.host.embedded.SCADomain
.createNewInstance(SCADomain.java:183)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at org.apache.tuscany.sca.host.embedded.SCADomain
.newInstance(SCADomain.java:63)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at calculator.android.CalculatorClient.onCreate(CalculatorClient.
java:183)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.
java:1123)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.
java:2231)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.os.Looper.loop(Looper.java:123)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at android.app.ActivityThread.main(ActivityThread.java:3948)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at java.lang.reflect.Method.invokeNative(Native Method)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at java.lang.reflect.Method.invoke(Method.java:521)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-31 06:12:43.528: ERROR/AndroidRuntime(1261):     at dalvik.system.NativeStart.main(Native Method)

Regarding my experience with Abdera, the tweakings i performed with the calculator-android, and the openness of android, i suggest these:

  • Creating an eclipse workspace for tuscany’s projects on which the calculator-android depends on;
  • Replacing their references to the JRE library by another reference but to Android Library (android.jar)
  • Replacing all references to external jars by relevant projects source code. I first thought that checking out those projects in the workspace will be ok but as they include android’s native packages namespace (ex: javax.xml), they’ll surely for security reason will be rejected at launch by android (java.lang.verifyError exceptions). I guess the solution now will be to rebuild the android.jar with the sources of these projects.
  • I’ve listed projects that should be included in the calculator-android build path, and create a new workspace with’em and the calculator-android project.

        tuscany-assembly
        tuscany-assembly-xml
        tuscany-assembly-xsd
        tuscany-binding-sca
        tuscany-binding-sca-xml
        tuscany-contribution
        tuscany-contribution-impl
        tuscany-contribution-java
        tuscany-contribution-namespace
        tuscany-contribution-xml
        tuscany-core
        tuscany-core-databinding
        tuscany-core-spi
        tuscany-databinding
        tuscany-databinding-jaxb
        tuscany-definitions
        tuscany-definitions-xml
        tuscany-endpoint
        tuscany-extensibility
        tuscany-host-android(embedded)
        tuscany-implementation-java
        tuscany-implementation-java-runtime
        tuscany-implementation-java-xml
        tuscany-implementation-node
        tuscany-interface
        tuscany-interface-java
        tuscany-interface-java-jaxws
        tuscany-interface-java-xml
        tuscany-monitor
        tuscany-node-api
        tuscany-node-impl
        tuscany-policy
        tuscany-policy-xml
        tuscany-policy-xml-ws
        tuscany-sca-api
        tuscany-sca-api-extensions
        tuscany-workspace
        tuscany-workspace-impl
        tuscany-workspace-xml
        tuscany-xsd

    I then build a list of the needed jars, and have started downloading their source code. Here are the concerned projects:

            easymock-2.4                                 --ok
            axiom-api-1.2.7                              --ok
            axiom-impl-1.2.7                             --ok
            commons-logging-1.1.1                        --ok
            geronimo-activation_1.1_spec-1.0.1           --ok
            geronimo-javamail_1.4_spec-1.2               --ok
            geronimo-stax-api_1.0_spec-1.0.1             --ok
            jaxen-1.1.1                                  --ok
            junit-4.5                                    --ok
            neethi-2.0.4                                 --ok
            stax-api-1.0-2                               --ok
            wstx-asl-3.2.4                               --ok
            activation-1.1                               --ok
            cglib-nodep-2.2                              --ok
            jaxb-api-2.1                                 --ok
            jaxws-api-2.1                                --ok
            XmlSchema-1.4.2                              --ok
            jaxb-impl-2.1.7                              --ok
            asm-all-3.1                                  --ok
            groovy-all-minimal-1.5.4                     --ok
            jsr-181-api-1.0                              
            jsr250-api-1.0                               
            jdk tools (com.sun...)

    Projects for which i already have sources (svn, cvs, zip & jnlp download), are marked “ok”.

    It just dawned on me that these projects may also have references to some jars files. It’s going to be harder then i think. Uploading all these projects into my workspace and resolving their dependencies by getting their sources too won’t be easy at all.
    Later i’ll add those projects sources to android sources and perform a “make sdk”. I hope to have then an “Tuscanily” operational android.jar.

    Questions:

    • Can anyone give help on how to have the jsr listed above implementation sources?
    • In which directory exactly and how should i organize those source files in android sources directory to get them built in the new android.jar?
    • Is there anyway rebuilding android.jar, using some jar files? Some may say that i’m lazy ;.) but!!!!!