apigee/trireme — pull request #34 by huntc (2013-12-23 23:03:43+00:00)
Title: Failing with UnsupportedCharsetExceptions

Hi there,

We're looking to use Trireme within our forthcoming [js-engine](https://github.com/typesafehub/js-engine#javascript-engine) based projects. Trireme looks great, and I've managed to get things working to a point.

When running a test within my IDE all is well. However if I run the test from the sbt shell i.e. outside of the IDE then I see:

Caused by: java.nio.charset.UnsupportedCharsetException: Node-Base64
at java.nio.charset.Charset.forName(Charset.java:543)
at io.apigee.trireme.core.internal.Charsets.(Charsets.java:39)

Here's how I'm calling Trireme (Scala/Akka code):

val env = NodeEngine.nodePathEnv(userModulePaths)
val nodeEnv = new NodeEnvironment()
val sandbox = new Sandbox()
sandbox.setStdin(stdinIs)
sandbox.setStdout(stdoutOs)
sandbox.setStderr(stderrOs)

def receive = {
case Execute =>

if (log.isDebugEnabled) {
log.debug("Invoking Trireme with {}", scriptArgs)
}

val script = nodeEnv.createScript(source.getName, source, scriptArgs)
script.setSandbox(sandbox)
script.setEnvironment(env.asJava)

val senderSel = sender.path
val senderSys = context.system
val ec = script.execute().setListener(new ScriptStatusListener {
def onComplete(script: NodeScript, status: ScriptStatus): Unit = {
stdoutOs.close()
stderrOs.close()
senderSys.actorSelection(senderSel) ! status.getExitCode
}
})
}

trireme-core is my one and only dependency.

Any quick fixes?