-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedTest.java
More file actions
49 lines (44 loc) · 1.66 KB
/
EmbeddedTest.java
File metadata and controls
49 lines (44 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.io.BufferedReader;
import java.io.IOException;
import org.glassfish.embeddable.*;
import java.io.*;
public class EmbeddedTest {
static GlassFishRuntime glassfishRuntime =null;
static GlassFishProperties glassfishProperties =null;
static GlassFish glassfish =null;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
File configFile = new File
("//home//dave//payaralatest//Payara//appserver//distributions//payara//target//stage//payara41//glassfish//domains//domain1//config//domain.xml");
File war = new File("//home//dave//cargotracker~svn//trunk//target//cargo-tracker.war");
try {
glassfishRuntime = GlassFishRuntime.bootstrap();
glassfishProperties = new GlassFishProperties();
glassfishProperties.setConfigFileURI(configFile.toURI().toString());
glassfishProperties.setConfigFileReadOnly(false);
glassfish = glassfishRuntime.newGlassFish(glassfishProperties);
glassfish.start();
Deployer deployer = glassfish.getDeployer();
deployer.deploy(war, "--force=true");
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("Press Enter to stop server");
// wait for Enter
try {
new BufferedReader(new java.io.InputStreamReader(System.in)).readLine();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
glassfish.dispose();
glassfishRuntime.shutdown();
}
catch (Exception e) {
e.printStackTrace();
}
}
}