-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-3969 | Add. Bahmni Embedded Tomcat v10 (#140)
* [Rahul] | BAH-3969 | Add. Bahmni Embedded Tomcat v10 * [Rahul] | BAH-3969 | Add. Main Class Exceptions
- Loading branch information
1 parent
6c13579
commit 95ca141
Showing
4 changed files
with
191 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.bahmni.deployment.launch</groupId> | ||
<artifactId>bahmni-embedded-tomcat-10</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<name>Bahmni Embedded Tomcat 10</name> | ||
<url>https://github.com/Bahmni/bahmni-package.git</url> | ||
<description>Embedded Tomcat v10 For Bahmni Services</description> | ||
<licenses> | ||
<license> | ||
<name>GNU AFFERO GENERAL PUBLIC LICENSE</name> | ||
<url>https://www.gnu.org/licenses/agpl-3.0.txt</url> | ||
</license> | ||
</licenses> | ||
<developers> | ||
<developer> | ||
<name>Bahmni</name> | ||
<email>[email protected]</email> | ||
<organization>Bahmni</organization> | ||
<organizationUrl>https://github.com/Bahmni</organizationUrl> | ||
</developer> | ||
</developers> | ||
<scm> | ||
<connection>scm:git:[email protected]:Bahmni/bahmni-package.git</connection> | ||
<developerConnection>scm:git:[email protected]:Bahmni/bahmni-package.git</developerConnection> | ||
<url>https://github.com/Bahmni/bahmni-package/tree/master/bahmni-embedded-tomcat-10/</url> | ||
</scm> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<tomcatVersion>10.1.24</tomcatVersion> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.tomcat.embed</groupId> | ||
<artifactId>tomcat-embed-core</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-juli</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat.embed</groupId> | ||
<artifactId>tomcat-embed-jasper</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-jasper</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-jasper-el</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-jsp-api</artifactId> | ||
<version>${tomcatVersion}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>17</source> | ||
<target>17</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<configuration> | ||
<mainClass>org.bahmni.deployment.launch.Main</mainClass> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
bahmni-embedded-tomcat-10/src/main/java/org/bahmni/deployment/launch/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.bahmni.deployment.launch; | ||
|
||
import jakarta.servlet.ServletException; | ||
import org.apache.catalina.Context; | ||
import org.apache.catalina.LifecycleException; | ||
import org.apache.catalina.startup.Tomcat; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
|
||
import static java.lang.System.getenv; | ||
|
||
public class Main { | ||
public static void main(String[] args) throws NumberFormatException, NullPointerException, IllegalArgumentException, ServletException, LifecycleException, IllegalStateException, FileNotFoundException, IOException{ | ||
Tomcat tomcat = new Tomcat(); | ||
tomcat.setPort(Integer.parseInt(getenv("SERVER_PORT"))); | ||
tomcat.setBaseDir(getenv("BASE_DIR")); | ||
|
||
Context context = tomcat.addWebapp(getenv("CONTEXT_PATH"), new File(getenv("WAR_DIRECTORY")).getAbsolutePath()); | ||
context.setSessionTimeout(120); | ||
context.setUseHttpOnly(false); | ||
|
||
tomcat.start(); | ||
tomcat.getServer().await(); | ||
} | ||
} |