@Override public void start() throws GlassFishException { decoratedGf.start(); }
@Override public void start() throws GlassFishException { decoratedGf.start(); }
private void launch() { try { GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(glassfishProperties); glassfish.start(); glassfish.getDeployer().deploy(new File(inputWar), deployProperties.getDeployOptions()); } catch (Throwable th) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Server was stopped.", th); System.exit(1); } }
/** * Starts the embedded server, opening ports, and running the startup * services. * * @throws LifecycleException if the server cannot be started propertly */ public synchronized void start() throws LifecycleException { if(glassfish != null) { try { if (glassfish.getStatus() != GlassFish.Status.STARTED) { glassfish.start(); } } catch (GlassFishException e) { throw new LifecycleException(e); // TODO(Sahoo): Proper Exception Handling } logger.finer("GlassFish has been started"); } }
String port = System.getenv("PORT"); GlassFishProperties gfProps = new GlassFishProperties(); gfProps.setPort("http-listener", Integer.parseInt(port)); GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(gfProps); glassfish.start(); Deployer deployer = glassfish.getDeployer(); File file = new File("YourSimpleMavenWebapplication.war"); deployer.deploy(file);
/** * Starts the embedded server, opening ports, and running the startup * services. * * @throws LifecycleException if the server cannot be started propertly */ public synchronized void start() throws LifecycleException { if(glassfish != null) { try { if (glassfish.getStatus() != GlassFish.Status.STARTED) { glassfish.start(); } } catch (GlassFishException e) { throw new LifecycleException(e); // TODO(Sahoo): Proper Exception Handling } logger.finer("GlassFish has been started"); } }
//Start GF GlassFishRuntime gfRuntime = GlassFishRuntime.bootstrap(); GlassFish gf = gfRuntime.newGlassFish(); gf.start(); //Deploy application with EJBs Deployer deployer = gf.getService(Deployer.class); String deployedApp = deployer.deploy(new File(...), "--force=true"); //Create InitialContext Properties props = new Properties(); props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory"); props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming"); props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"); props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); InitialContext ic = new InitialContext(props); //Lookup EJBs ic.lookup(...) //Stop GF gf.stop(); gfRuntime.shutdown(); //CORBA stuck thread, have to kill it manually System.exit(0);
private void start() { try ( InputStream gpis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_glassfish.properties"); InputStream dpis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_deploy.properties"); InputStream wis = this.getClass().getClassLoader().getResourceAsStream("uber-jar_application.war")) { GlassFishProperties glassfishProperties = new GlassFishProperties(); glassfishProperties.getProperties().load(gpis); URL url = this.getClass().getClassLoader().getResource("uber-jar_domain.xml"); if (url != null) { glassfishProperties.setConfigFileURI(url.toURI().toString()); } DeployProperties deployProperties = new DeployProperties(); deployProperties.load(dpis); GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(glassfishProperties); glassfish.start(); glassfish.getDeployer().deploy(wis, deployProperties.getDeployOptions()); } catch (Throwable th) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Server was stopped.", th); System.exit(1); } } }
public void start(BundleContext context) throws Exception { nonEmbedded = context.getProperty(Constants.BUILDER_NAME_PROPERTY) != null; if (nonEmbedded) { GlassFishRuntime embeddedGfr = new EmbeddedOSGiGlassFishRuntime(context); context.registerService(GlassFishRuntime.class.getName(), embeddedGfr, null); System.out.println("Registered " + embeddedGfr + " in service registry."); } else { Properties properties = prepareStartupContext(context); final BootstrapProperties bsProperties = new BootstrapProperties(properties); System.out.println(GlassFishRuntime.class + " is loaded by [" + GlassFishRuntime.class.getClassLoader() + "]"); GlassFishRuntime existingGfr = lookupGfr(context); if (existingGfr == null) { System.out.println("Bootstrapping a new GlassFishRuntime"); // Should we do the following in a separate thread? gfr = GlassFishRuntime.bootstrap(bsProperties, getClass().getClassLoader()); existingGfr = gfr; } else { System.out.println("Using existing GlassFishRuntime: [" + existingGfr + "]"); } gf = existingGfr.newGlassFish(new GlassFishProperties(properties)); gf.start(); } }
/** * Construct new EJBContainerImpl instance */ EJBContainerImpl(GlassFish server) throws GlassFishException { this.server = server; this.server.start(); this.habitat = server.getService(ServiceLocator.class); deployer = server.getDeployer(); state = RUNNING; cleanup = new Cleanup(this); }
/** * Construct new EJBContainerImpl instance */ EJBContainerImpl(GlassFish server) throws GlassFishException { this.server = server; this.server.start(); this.habitat = server.getService(Habitat.class); deployer = server.getDeployer(); state = RUNNING; cleanup = new Cleanup(this); }
public void start(BundleContext context) throws Exception { nonEmbedded = context.getProperty(Constants.BUILDER_NAME_PROPERTY) != null; if (nonEmbedded) { GlassFishRuntime embeddedGfr = new EmbeddedOSGiGlassFishRuntime(context); context.registerService(GlassFishRuntime.class.getName(), embeddedGfr, null); System.out.println("Registered " + embeddedGfr + " in service registry."); } else { Properties properties = prepareStartupContext(context); final BootstrapProperties bsProperties = new BootstrapProperties(properties); System.out.println(GlassFishRuntime.class + " is loaded by [" + GlassFishRuntime.class.getClassLoader() + "]"); GlassFishRuntime existingGfr = lookupGfr(context); if (existingGfr == null) { System.out.println("Bootstrapping a new GlassFishRuntime"); // Should we do the following in a separate thread? gfr = GlassFishRuntime.bootstrap(bsProperties, getClass().getClassLoader()); existingGfr = gfr; } else { System.out.println("Using existing GlassFishRuntime: [" + existingGfr + "]"); } gf = existingGfr.newGlassFish(new GlassFishProperties(properties)); gf.start(); } }
public void launch(Properties ctx) throws Exception { addShutdownHook(); gfr = GlassFishRuntime.bootstrap(new BootstrapProperties(ctx), getClass().getClassLoader()); gf = gfr.newGlassFish(new GlassFishProperties(ctx)); if (Boolean.valueOf(Util.getPropertyOrSystemProperty(ctx, "GlassFish_Interactive", "false"))) { startConsole(); } else { gf.start(); } }
public void launch(Properties ctx) throws Exception { addShutdownHook(); gfr = GlassFishRuntime.bootstrap(new BootstrapProperties(ctx), getClass().getClassLoader()); gf = gfr.newGlassFish(new GlassFishProperties(ctx)); if (Boolean.valueOf(Util.getPropertyOrSystemProperty(ctx, "GlassFish_Interactive", "false"))) { startConsole(); } else { gf.start(); } }
public synchronized void launch() { if (glassFish != null) { return; } /* * Running under "Run as JUnit test" from Eclipse in a separate process, we do not get * notified when Eclipse is finished running the test suite. The shutdown hook is just * to be on the safe side. */ addShutdownHook(); File domainConfig = getConfiguration(); if (!domainConfig.exists()) { throw new IllegalArgumentException(domainConfig + " not found"); } GlassFishProperties gfProps = new GlassFishProperties(); if (domainConfig.exists()) { gfProps.setConfigFileURI(domainConfig.toURI().toString()); } try { glassFish = GlassFishRuntime.bootstrap().newGlassFish(gfProps); glassFish.start(); } catch (GlassFishException exc) { throw new RuntimeException(exc); } }
public void start() { try { if (gfr == null) { gfr = GlassFishRuntime.bootstrap(); } if (gf == null) { gf = gfr.newGlassFish(configurator.getProps()); gf.start(); } glassfishFuture.setGlassFish(gf); log.info("Executing {} startup commands.", startupCommands.size()); for (AbstractAdminObject command : startupCommands) { try { log.info("Executing command: {}", command); command.execute(ctx); } catch (Exception e) { log.error("Startup failed. ", e); fail(); } } } catch (GlassFishException e) { log.error("Startup failed", e); fail(); } }
public void start() throws LifecycleException { try { glassfish.start(); if (!shouldSetPort) { readBindingHttpPort(); } bindCommandRunner(); } catch (Exception e) { throw new LifecycleException("Could not start GlassFish Embedded", e); } // Server needs to be started before we can deploy resources for (String resource : configuration.getResourcesXml()) { try { executeCommand(COMMAND_ADD_RESOURCES, resource); } catch (Throwable e) { throw new RuntimeException("Could not deploy sun-reosurces file: " + resource, e); } } }
/** * Starts the GlassFish container. */ @Override public void start() { System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url"); ConfigurationManager cm = new ConfigurationManager(); configDirName = cm.getProperty(GLASSFISH_CONFIG_DIR_KEY, "src/test/resources/glassfish-config"); File domainConfig = new File(configDirName, "domain.xml"); GlassFishProperties gfProps = new GlassFishProperties(); if (domainConfig.exists()) { gfProps.setConfigFileURI(domainConfig.toURI().toString()); } try { glassFish = GlassFishRuntime.bootstrap().newGlassFish(gfProps); glassFish.start(); // set access point in test directory String portNumber = getPortNumber(domainConfig); testDirectory.setAccessPoint(new URI("http://localhost:" + portNumber + "/Pax-Exam-Probe/")); deployModules(); } catch (GlassFishException e) { throw new TestContainerException("Problem starting test container.", e); } catch (URISyntaxException e) { throw new TestContainerException("Problem starting test container.", e); } }
setGlassFishProperties(gfProps, fs); glassfish = glassfishRuntime.newGlassFish(gfProps); glassfish.start();
BootstrapProperties bootstrapProperties = new BootstrapProperties(); bootstrapProperties.setInstallRoot("C:\\applicationserverdir"); GlassFishRuntime glassfishRuntime = GlassFishRuntime.bootstrap(bootstrapProperties); GlassFishProperties glassfishProperties = new GlassFishProperties(); glassfishProperties.setInstanceRoot("C:\\applicationserverdir\\domains\\myJavaFXAppDomain"); glassfishProperties.setPort("http-listener", 8080); glassfishProperties.setPort("https-listener", 8181); GlassFish glassfish = glassfishRuntime.newGlassFish(glassfishProperties); glassfish.start();