Forum Discussion

ioannis's avatar
ioannis
New Contributor
13 years ago

Script Runner failing with ClassNotFoundException

Hello,

I have a a groovyscript that works fine under my IDE. When I feed it however to a ScriptRunner, it blows up with the following exception


(Wrapped) java.lang.reflect.InvocationTargetException
at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
at com.tangosol.util.Base.ensureRuntimeException(Base.java:269)
at com.tangosol.net.CacheFactory.getServiceConfig(CacheFactory.java:1355)
at com.tangosol.net.CacheFactory.getCacheFactoryBuilderConfig(CacheFactory.java:1231)
at com.tangosol.net.CacheFactory.getCacheFactoryBuilder(CacheFactory.java:593)
at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:657)
at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:640)
at com.tangosol.net.CacheFactory$getConfigurableCacheFactory.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at InsertAndApprove.main(Script3.groovy:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:704)
at InsertAndApprove.invokeMethod(Script3.groovy)
at org.codehaus.groovy.runtime.InvokerHelper$2.run(InvokerHelper.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:267)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at GroovycomeviwareScriptRunner$_run_closure4.doCall(GroovycomeviwareScriptRunner:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
at groovy.lang.Closure.call(Closure.java:412)
at com.eviware.loadui.util.groovy.GroovyEnvironment.invokeClosure(GroovyEnvironment.java:192)
at com.eviware.loadui.groovy.categories.GroovyRunner.sample(GroovyRunner.java:47)
at com.eviware.loadui.impl.component.categories.RunnerBase.doSample(RunnerBase.java:507)
at com.eviware.loadui.impl.component.categories.RunnerBase.access$700(RunnerBase.java:68)
at com.eviware.loadui.impl.component.categories.RunnerBase$Worker.run(RunnerBase.java:774)
at com.eviware.loadui.util.dispatch.CustomThreadPoolExecutor$Worker.run(CustomThreadPoolExecutor.java:198)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.tangosol.net.CacheFactory.getServiceConfig(CacheFactory.java:1350)
... 46 more
Caused by: java.lang.NoClassDefFoundError: sun/rmi/server/MarshalOutputStream
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:805)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.tangosol.util.ExternalizableHelper.<clinit>(ExternalizableHelper.java:4739)
at com.tangosol.run.xml.SimpleParser.instantiateDocument(SimpleParser.java:195)
at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:160)
at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:75)
at com.tangosol.run.xml.SimpleParser.parseXml(SimpleParser.java:144)
at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:136)
at com.tangosol.run.xml.XmlHelper.loadXml(XmlHelper.java:175)
at com.tangosol.run.xml.XmlHelper.loadResourceInternal(XmlHelper.java:320)
at com.tangosol.run.xml.XmlHelper.loadResource(XmlHelper.java:249)
at com.tangosol.coherence.component.application.console.Coherence.loadConfiguration(Coherence.CDB:19)
at com.tangosol.coherence.component.application.console.Coherence.getServiceConfig(Coherence.CDB:14)
at com.tangosol.coherence.component.application.console.Coherence.ensureRunningLogger(Coherence.CDB:10)
at com.tangosol.coherence.component.application.console.Coherence.getSafeCluster(Coherence.CDB:14)
at com.tangosol.coherence.component.application.console.Coherence.getServiceConfig(Coherence.CDB:8)
... 51 more
Caused by: java.lang.ClassNotFoundException: sun.rmi.server.MarshalOutputStream
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:696)
at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:805)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 78 more


Has anyone come across this before? It feels like it's a classloader limitation imposed by loadUI, but I'm not 100% certain.

1 Reply

  • ioannis's avatar
    ioannis
    New Contributor
    It looks like I was partially correct wrt to the classloading issues. Because Felix is used under the covers, it messes up with the com.sun.* packages. I have fixed this by changing the felix properties, but I now face another issue. I have some config files at the root of my jar which are not detected by the classloader. Is there any way I can convince the loadUI classloader to look from the root?