java.lang.NoClassDefFoundError: sun/misc/Unsafe

1,005 views
Skip to first unread message

Dainius Vaznys

unread,
Feb 5, 2015, 6:52:57 AM2/5/15
to go...@googlegroups.com
Hi,

now that go.cd plugins are supposed to be JSON-based it seems natural to use groovy for plugin development. However when using groovy to do JSON stuff I run into the following when starting go-server:
Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe
at groovy.json.internal.FastStringUtils.loadUnsafe(FastStringUtils.java:43)
at groovy.json.internal.FastStringUtils.<clinit>(FastStringUtils.java:53)
at groovy.json.internal.CharBuf.addJsonFieldName(CharBuf.java:543)
at groovy.json.JsonOutput.writeMap(JsonOutput.java:420)
at groovy.json.JsonOutput.writeObject(JsonOutput.java:264)
at groovy.json.JsonOutput.toJson(JsonOutput.java:184)
at groovy.json.JsonBuilder.toString(JsonBuilder.java:322)
at groovy.json.JsonBuilder$toString.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at com.ofg.goplugins.groovy.GroovyTaskPlugin.success(GroovyTaskPlugin.groovy:112)

ps ax|grep go-server
/usr/lib/jvm/java-8-oracle/jre/bin/java -server -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Duser.language=en -Dorg.mortbay.jetty.Request.maxFormContentSize=30000000 -Djruby.rack.request.size.threshold.bytes=30000000 -Duser.country=US -Dcruise.config.dir=/etc/go -Dcruise.config.file=/etc/go/cruise-config.xml -Dcruise.server.port=8153 -Dcruise.server.ssl.port=8154 -jar /usr/share/go-server/go.jar

Does anyone have ideas how to work around this?

srinivas upadhya

unread,
Feb 5, 2015, 7:17:53 AM2/5/15
to go...@googlegroups.com
I think this thread is talking about the same problem. Seems to be OSGI restriction.

Dainius Vaznys

unread,
Feb 5, 2015, 7:21:45 AM2/5/15
to go...@googlegroups.com
Thanks for the link. Looks like can't use groovy for JSON stuff which is a pitty.

Jakub Narloch

unread,
Sep 26, 2015, 10:48:44 AM9/26/15
to go-cd
Isn't there a way to pass any command line argument to Go Agent?

According to provided discussion it's suppose to be configurable by specifing the org.osgi.framework.bootdelegation=*. Aren't there a way to pass any JVM args to Apache Felix in Agent property files?

I've stomp opon the same problem, though I had done implementation of reactive http client in Project Reactor, but now I've got stuck because of sun.mics.Unsafe class is not being loaded.

Aravind SV

unread,
Sep 28, 2015, 8:19:24 AM9/28/15
to go...@googlegroups.com
The usual way is to set GO_AGENT_SYSTEM_PROPERTIES environment variable in /etc/default/go-agent. As you can see from the startup script, it's used for agent startup. Does that work for you?

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aravind SV

unread,
Sep 28, 2015, 8:29:56 AM9/28/15
to go...@googlegroups.com
I remembered that a customer of Go had recently written a really good document about their solution to a similar issue regarding plugins and OSGi. I've attached that document, in case it helps you. It's a slightly different approach to a similar problem.
Classloader_Solution_for_Go_SCM_Plugin.pdf
Reply all
Reply to author
Forward
0 new messages