groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Wood <daw...@us.ibm.com>
Subject Embedded groovy 2.4.6 on Android given NPE
Date Thu, 31 Mar 2016 00:55:50 GMT
Hi,

We are starting a new project in which we're trying to embed a groovy 
script interpreter in an Android AsyncTask.  When we try to instantiate 
the app, somewhere along the line we get the stack trace below.  Its 
failing in loading one of the plugins at the following:

            Class[] pluginDGMs = VMPluginFactory.getPlugin
().getPluginDefaultGroovyMethods();

I would assume it is getPlugin() that is returning null, which would mean 
that all the following are failing:

    static {
        plugin = createPlugin(JDK7_CLASSNAME_CHECK, JDK7_PLUGIN_NAME);
        if (plugin == null) {
            // v6 plugin is the same as v5 but with some scripting stuff
            // so check below is good enough for now (can be true for JVM 
5)
            plugin = createPlugin(JDK6_CLASSNAME_CHECK, JDK6_PLUGIN_NAME);
        }
        if (plugin == null) {
            plugin = createPlugin(JDK5_CLASSNAME_CHECK, JDK5_PLUGIN_NAME);
        }
    }

We included the groovy-all-2.4.6 jar in the APK like any other jar.  I've 
searched the web but have seen no one with this problem.  I have seen the 
groovy gradle plugin.  Is that required?  Any help is much appreciated. 
Thanks.


03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime: FATAL 
EXCEPTION: AsyncTask #1
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime: 
Process: com.ibm.watson.edge, PID: 7802
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime: 
java.lang.RuntimeException: An error occured while executing 
doInBackground()
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$3.done(AsyncTask.java:300)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.FutureTask.setException(FutureTask.java:222)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.FutureTask.run(FutureTask.java:242)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.lang.Thread.run(Thread.java:841)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:  Caused 
by: java.lang.ExceptionInInitializerError
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:65)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:34)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.Binding.<init>(Binding.java:35)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.GroovyShell.<init>(GroovyShell.java:62)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.mesos.slave.groovy.GroovyService.<init>(GroovyService.java:8)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.mesos.slave.groovy.GroovyAgent.<init>(GroovyAgent.java:17)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.AsyncAndroidAgent.doInBackground(AsyncAndroidAgent.java:39)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.AsyncAndroidAgent.doInBackground(AsyncAndroidAgent.java:19)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$2.call(AsyncTask.java:288)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.lang.Thread.run(Thread.java:841) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:  Caused 
by: java.lang.NullPointerException
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:101)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:65) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:34) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.Binding.<init>(Binding.java:35) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
groovy.lang.GroovyShell.<init>(GroovyShell.java:62) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.mesos.slave.groovy.GroovyService.<init>(GroovyService.java:8) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.mesos.slave.groovy.GroovyAgent.<init>(GroovyAgent.java:17) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.AsyncAndroidAgent.doInBackground(AsyncAndroidAgent.java:39) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
com.ibm.watson.edge.AsyncAndroidAgent.doInBackground(AsyncAndroidAgent.java:19) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$2.call(AsyncTask.java:288) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.FutureTask.run(FutureTask.java:237) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 

03-30 15:45:28.442 7802-7824/com.ibm.watson.edge E/AndroidRuntime:     at 
java.lang.Thread.run(Thread.java:841) 
03-30 15:45:28.467 7802-7824/? I/Process: Sending signal. PID: 7802 SIG: 9

David Wood 
Computing Systems for Wireless Networks
IBM TJ Watson Research Center
dawood@us.ibm.com
914-945-4923 (office), 914-396-6515 (mobile)

Mime
View raw message