If you want your application to run on Glassfish (on Heroku), you need to use the built-in Glassfish. Do you know that?
<dependency> <groupId>org.glassfish.extras</groupId> <artifactId>glassfish-embedded-all</artifactId> <version>3.1.1</version> </dependency>
You can use as procfile, for example:
web: java $JAVA_OPTS -cp target/classes:target/dependency/* com.example.Main
In your main body, you start your glass fish as follows:
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);
source share