dev@glassfish.java.net

Default network config with GlassFish embedded

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Mon, 27 Jul 2009 16:07:35 -0700

The jruby uses of GlassFish embedded API bases on
glassfish-embedded-nucleus, which is pretty much nucleus distribution
with hk2 and grizzly.

The server starts up fine however there is no default network
configuration, so during grizzly adapter registration I am getting an
NPE. Am I supposed to add a NetworkConfigu element on the Config myself?
I would guess it is provided as part of default embedded implementation.
Here is the exception thrown:

SEVERE: Exception while loading the app
java.lang.NullPointerException
    at
com.sun.enterprise.v3.services.impl.GrizzlyService.getPortsFromVirtualServers(GrizzlyService.java:614)
    at
com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:527)
    at
com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:512)
    at
com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:490)
    at
org.glassfish.scripting.jruby.JRubyApplication.start(JRubyApplication.java:214)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:217)
    at
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:193)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:304)


This is how I am starting the server:

        Server.Builder builder = new Server.Builder("ruby");
        Server server = builder.build();
        server.addContainer(new JRubyContainerBuilder());
        server.createPort(3000);
        DeployCommandParameters params = new DeployCommandParameters();
        params.name = "depot";
        Properties props = new Properties();
        props.put("jruby.home", jrubyInstalDir);
        params.property = props;
        EmbeddedDeployer dep = server.getDeployer();
        dep.deploy(new File(appDir), params);

-vivek.