반응형

Issue

Maven 으로 build Spring boot war 파일을 tomcat 에서 실행시 아래와 같은 에러 발생

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
50
51
52
53
54
55
56
57
01-Jul-2019 11:28:09.100 정보 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
01-Jul-2019 11:28:09.126 정보 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [{tomcat}/webapps/module.war]
01-Jul-2019 11:28:09.271 심각 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/module]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@e5ca407]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
        at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4995)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@6a8a7487]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:113)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
        at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:724)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 13 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file
        at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        ... 16 more
Caused by: java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:225)
        at java.util.zip.ZipFile.<init>(ZipFile.java:155)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:103)
        at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:110)
        ... 17 more
 
01-Jul-2019 11:28:09.272 심각 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [{tomcat}/webapps/module.war]
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/module]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
 
01-Jul-2019 11:28:09.274 정보 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [{tomcat}/webapps/module.war] has finished in [148] ms
01-Jul-2019 11:28:09.276 정보 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-12200"]
01-Jul-2019 11:28:09.384 정보 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-12202"]
01-Jul-2019 11:28:09.386 정보 [main] org.apache.catalina.startup.Catalina.start Server startup in 307 ms
cs

 

원인

여러가지 원인이 있겠지만 일단 public respository 에서 받아온 jar 가 아닌 프로젝트 폴더내에 추가한 jar 파일을 war 로 빌드시 잘못들어간 것으로 보임.

원본 jar 와 war를 압축해제 하여 안에있는 jar 파일의 크기를 비교하니 다름.

pom.xml 에 아래와 같이 작성해서 빌드를 한것이 문제.

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
<project>
    ...
    <build>
        <finalName>module</finalName>
        <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>${project.basedir}/libs/${build.os}</directory>
                            <targetPath>WEB-INF/lib</targetPath>
                            <filtering>true</filtering>
                            <includes>
                                <include>*.*</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
cs

war 빌드시 특정 파일을 include 하는 방법을 무작정 검색해서 복붙한 결과.....

위 xml 에서 filtering, include 태그를 잘못 사용하고 있었다.

자세한 내용은 : https://maven.apache.org/plugins-archives/maven-war-plugin-2.5/examples/adding-filtering-webresources.html

 

Apache Maven WAR Plugin - Adding and Filtering External Web Resources

Adding and Filtering External Web Resources The default resource directory for all Maven projects is src/main/resources which will end up in target/classes and in WEB-INF/classes in the WAR. The directory structure will be preserved in the process. The WAR

maven.apache.org

pom.xml 을 아래와 같이 수정 후 원본 jar 와 용량체크를 한뒤 배포 하니 잘 구동된다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<project>
    ...
    <build>
        <finalName>module</finalName>
        <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>${project.basedir}/libs/${build.os}</directory>
                            <targetPath>WEB-INF/lib</targetPath>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
cs
반응형

'IT > 언어' 카테고리의 다른 글

spring boot embedded tomcat letsencrypt ssl 적용  (0) 2019.02.08
import os  (0) 2015.11.25
[c#] 파일 출력  (0) 2014.08.19
페이징 처리용 소스(예제?)  (0) 2014.07.08
POI Excel 파일 쓰기  (0) 2014.06.26
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
java.util.ServiceConfigurationError: org.asciidoctor.Asciidoctor: Provider org.asciidoctor.jruby.internal.JRubyAsciidoctor could not be instantiated
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)
    at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:475)
    at org.asciidoc.intellij.AsciiDoc.initWithExtensions(AsciiDoc.java:123)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:285)
    at org.asciidoc.intellij.AsciiDoc.render(AsciiDoc.java:280)
    at org.asciidoc.intellij.editor.AsciiDocPreviewEditor$2.run(AsciiDocPreviewEditor.java:124)
    at org.asciidoc.intellij.editor.LazyApplicationPoolExecutor$1.run(LazyApplicationPoolExecutor.java:59)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
.....
unknown encoding name - MS949
cs

IDE 에러 이벤트 로그에 다음과 같은 Exception 로그와 

"unknown encoding name - MS949"

메시지가 출력 되며 asciidoc plugin 이 작동하지 않는 경우.

"C:\Program Files\JetBrains\IntelliJ IDEA 2019.1\bin\idea64.exe.vmoptions"

파일을 열어 마지막 줄에 다음 내용을 추가 한뒤 IDE 를 재시작 하면 된다.

"-Dfile.encoding=UTF-8"

반응형

+ Recent posts