반응형

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
반응형

새 spring project 를 생성 하려는데 자꾸 아래와 같은 에러 메시지가 뜬다.

내용은

Message : Server returned HTTP response code: 400 for URL: http://start.spring.io

Exception Strack Trace : java.io.IOException: Server returned HTTP response code: 400 for URL: http://start.spring.io

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizardModel.parseJsonFrom(NewSpringBootWizardModel.java:477)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizardModel.discoverOptions(NewSpringBootWizardModel.java:371)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizardModel.<init>(NewSpringBootWizardModel.java:150)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizardModel.<init>(NewSpringBootWizardModel.java:137)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizardModel.<init>(NewSpringBootWizardModel.java:132)

at org.springframework.ide.eclipse.wizard.gettingstarted.boot.NewSpringBootWizard.init(NewSpringBootWizard.java:65)

at org.eclipse.ui.internal.actions.NewWizardShortcutAction.run(NewWizardShortcutAction.java:119)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)

at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)

at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)


이리 저리 검색해보니 뭐 ini 파일에 메모리 설정값을 만져봐라, 방화벽 확인해봐라 이런것들이 있었지만

내 경우 피들러를 끄니 해결 ㅂㄷㅂㄷ

반응형

+ Recent posts