톰캣에 두개의 포트를 올리고 각 포트마다 ROOT를 다르게 하여 매핑하여 두개의 도메인을 올리는게 가능하다 다음은 해당 설정값이다.


두개의 서비스가 올라감
톰캣에 두개의 포트를 올리고 각 포트마다 ROOT를 다르게 하여 매핑하여 두개의 도메인을 올리는게 가능하다 다음은 해당 설정값이다.
두개의 서비스가 올라감
war로 패키징되는 메이븐 프로젝트를 생성한 뒤 아래 에러가 발생했다.
Exception java.lang.ExceptionInInitializerError:
Cannot access defaults field of Properties
[in thread "Worker-30: Building"]
에러가 표시되는 부분은 pom.xml의 첫줄 <project xmlns=...이다.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>in.wonj</groupId>
<artifactId>myArtifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
...(생략)...
</dependency>
...(생략)...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>18</release>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
- 해결
pom.xml에 maven-war-plugin플러그인을 추가한다.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
이 에러를 해결하는 방법은 크게 2가지 방법이 있습니다.
모두 pom.xml 을 수정해서 해결 할 수 있는데
한 가지는 dependency 를 추가해 주는 것이고
다른 한 가지는 plugin 을 추가해 주는 방식입니다.
우선 첫 번째 방법은 pom.xml 에 아래의 구문을 추가해 줍니다.
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>
위 구문을 추가한 후, pom.xml 파일을 저장한 후
@Resource를 삽입했던 곳으로 가보면 에러가 사라진 것을 확인 할 수 있습니다.