private void setGlassFishProperties(GlassFishProperties props, EmbeddedFileSystem fs) { props.setProperty("-type", "EMBEDDED"); props.setProperty("org.glassfish.persistence.embedded.weaving.enabled", "false"); if (fs != null) { String instanceRoot = fs.instanceRoot != null ? fs.instanceRoot.getAbsolutePath() : null; if (instanceRoot != null) { props.setInstanceRoot(fs.instanceRoot.getAbsolutePath()); } if (fs.configFile != null) { props.setConfigFileURI(fs.configFile.toURI().toString()); } if (fs.autoDelete) { props.setProperty("org.glassfish.embeddable.autoDelete", "true"); } } // TODO :: Support modification of jmxPort }
private void setGlassFishProperties(GlassFishProperties props, EmbeddedFileSystem fs) { props.setProperty("-type", "EMBEDDED"); props.setProperty("org.glassfish.persistence.embedded.weaving.enabled", "false"); if (fs != null) { String instanceRoot = fs.instanceRoot != null ? fs.instanceRoot.getAbsolutePath() : null; if (instanceRoot != null) { props.setInstanceRoot(fs.instanceRoot.getAbsolutePath()); } if (fs.configFile != null) { props.setConfigFileURI(fs.configFile.toURI().toString()); } if (fs.autoDelete) { props.setProperty("org.glassfish.embeddable.autoDelete", "true"); } } // TODO :: Support modification of jmxPort }
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); } } }
private LauncherMain(String[] args) { try { new CmdLineParser(this).parseArgument(args); } catch (CmdLineException ex) { throw new IllegalArgumentException(ex); } if (inputWar == null) { throw new IllegalArgumentException("No --deploy is given."); } if (configFile != null) { glassfishProperties.setConfigFileReadOnly(true); if (outputJar == null) { glassfishProperties.setConfigFileURI(new File(configFile).toURI().normalize().toString()); } } else { glassfishProperties.setConfigFileReadOnly(false); glassfishProperties.setPort("http-listener", httpListener); glassfishProperties.setPort("https-listener", httpsListener); } if (contextRoot != null) { deployProperties.setContextRoot(contextRoot); } if (libraries != null) { deployProperties.setLibraries(libraries); } }
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); } }
/** * 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); } }
} else if (l.domain_file != null) { _logger.info("[EJBContainerProviderImpl] Using config file location: " + l.domain_file.toURI().toString()); glassFishProperties.setConfigFileURI(l.domain_file.toURI().toString());
glassFishProperties.setConfigFileURI(l.domain_file.toURI().toString());
serverProps.setConfigFileURI(configuration.getConfigurationXml()); shouldSetPort = false;