<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tomcat &#8211; Naver Ending Study</title>
	<atom:link href="https://nangchang.nes.or.kr/tag/tomcat/feed/" rel="self" type="application/rss+xml" />
	<link>https://nangchang.nes.or.kr</link>
	<description></description>
	<lastBuildDate>Mon, 04 Jun 2012 14:18:35 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.6</generator>
	<item>
		<title>Spring + Mybatis + tomcat 사용 중 &#8220;심각: Error listenerStar&#8221; 오류</title>
		<link>https://nangchang.nes.or.kr/error/</link>
					<comments>https://nangchang.nes.or.kr/error/#comments</comments>
		
		<dc:creator><![CDATA[낭창]]></dc:creator>
		<pubDate>Mon, 04 Jun 2012 14:18:35 +0000</pubDate>
				<category><![CDATA[프로그래밍 이야기]]></category>
		<category><![CDATA[mybatis]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[tomcat]]></category>
		<guid isPermaLink="false">http://nangchang.nes.or.kr/?p=481</guid>

					<description><![CDATA[아아 삽질의 연속 ㅠ.ㅜ JDK 7, Spring 3.1, Mybatis, 3.1, tomcat 7, Ubuntu 12.04 사용 중이다.로컬에서 Eclipse+tomcat 으로 개발 하던 어플리케이션을 서버에 배치해서 테스트 하려고 작업을 했다.서버 설치도 다 됐고, 서버에 war 파일 올렸는데, 어플리케이션 시작이 안된다=_=tomcat 로그에 찍히는 에러 메시지는 다음과 같이 달랑 한줄;; 2012. 6. 4 오후 11:06:18 org.apache.catalina.startup.HostConfig deployWAR정보: Deploying web application [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>아아 삽질의 연속 ㅠ.ㅜ </p>
<p>JDK 7, Spring 3.1, Mybatis, 3.1, tomcat 7, Ubuntu 12.04 사용 중이다.<br />로컬에서 Eclipse+tomcat 으로 개발 하던 어플리케이션을 서버에 배치해서 테스트 하려고 작업을 했다.<br />서버 설치도 다 됐고, 서버에 war 파일 올렸는데, 어플리케이션 시작이 안된다=_=<br />tomcat 로그에 찍히는 에러 메시지는 다음과 같이 달랑 한줄;;</p>
<blockquote><p>2012. 6. 4 오후 11:06:18 org.apache.catalina.startup.HostConfig deployWAR<br />정보: Deploying web application archive /var/lib/tomcat7/webapps/app.war<br />2012. 6. 4 오후 11:06:20 org.apache.catalina.core.StandardContext startInternal<br /><strong>심각: Error listenerStart</strong><br />2012. 6. 4 오후 11:06:20 org.apache.catalina.core.StandardContext startInternal<br />심각: Context [/app] startup failed due to previous errors<br />2012. 6. 4 오후 11:06:20 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc</p></blockquote>
<p>도저히 이유를 알 수 없는 난감한 상황인데.. 구글신께 물어보니 spring 설정이 잘 못된 경우 저 에러가<br />날 수 있단다. 로컬에서는 잘됐는데 설정이 이상할리가.. 라고 생각했지만&#8230; <br />결국 설정을 하나씩 지워가며 테스트 했는데, mybatis 쪽 설정 의심되는 상황.<br />정확한 오류를 알 수 없어 전전긍긍하면서, 로그도 제대로 안 찍어 주는 tomcat를 원망하다 문득 깨달았다.<br />spring mvc template으로 프로젝트를 생성하면 log4j 설정이 console 로 로그를 출력하도록 한다는걸=_=<br />그래서 즉시 파일로 출력하도록 설정을 수정했다.</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;</p>
<p>&lt;!DOCTYPE log4j:configuration PUBLIC &#8220;-//APACHE//DTD LOG4J 1.2//EN&#8221; &#8220;log4j.dtd&#8221;&gt;<br />&lt;log4j:configuration xmlns:log4j=&#8221;http://jakarta.apache.org/log4j/&#8221;&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; Appenders &#8211;&gt;<br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &lt;appender name=&#8221;fileLog&#8221; class=&#8221;org.apache.log4j.DailyRollingFileAppender&#8221;&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param name=&#8221;File&#8221; value=&#8221;/var/lib/tomcat7/webapps/app/log/app.log&#8221; /&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param name=&#8221;Append&#8221; value=&#8221;true&#8221; /&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;layout class=&#8221;org.apache.log4j.PatternLayout&#8221;&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;param name=&#8221;ConversionPattern&#8221; value=&#8221;%-5p: %c &#8211; %m%n&#8221; /&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/layout&gt;</strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/appender&gt;</strong></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; Application Loggers &#8211;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;logger name=&#8221;z.y.x&#8221;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;level value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/logger&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; 3rdparty Loggers &#8211;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;logger name=&#8221;org.springframework.core&#8221;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;level value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/logger&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;logger name=&#8221;org.springframework.beans&#8221;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;level value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/logger&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;logger name=&#8221;org.springframework.context&#8221;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;level value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/logger&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;logger name=&#8221;org.springframework.web&#8221;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;level value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/logger&gt;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &lt;!&#8211; Root Logger &#8211;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;root&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;priority value=&#8221;debug&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;appender-ref ref=&#8221;fileLog&#8221; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/root&gt;</p>
<p>&lt;/log4j:configuration&gt;</p></blockquote>
<p>엉엉.. 로그가 정말 잘 찍힌다ㅜ.ㅜ</p>
<blockquote><p>ERROR: org.springframework.web.context.ContextLoader &#8211; Context initialization failed<br />org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [z.y.x.service.UserServiceImpl] for bean with name &#8216;userServiceImpl&#8217; defined in file [/var/lib/tomcat7/webapps/hadpan_web/WEB-INF/classes/z/y/x/service/UserServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: z/y/x/service/UserServiceImpl : <strong>Unsupported major.minor version 51.0 </strong>(unable to load class z.y.x.service.UserServiceImpl)<br />&nbsp; &nbsp; &nbsp; &nbsp; at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1265)</p></blockquote>
<p>음.. 예상과 달리 직접적으로 mybatis 관련된쪽은 아닌데&#8230; Unspported major.minor version 어쩌고 하는 메시지가 보인다.<br />또 구글신께 물어 봤지. 자바 버전 차이에 의해 발생할 수 있는 에러란다.<br />아.. 어플리케이션을 자바7으로 빌드했는데, tomcat7은 JRE6 에서 돌아가고 있었던 거다.</p>
<p>사용 중인 Ubuntu 서버의 tomcat7 실행 스크립트를 보니 다음과 같은 부분이 있다.</p>
<p></p>
<ul>
<li>/etc/init.d/tomcat7</li>
</ul>
<blockquote><p>JDK_DIRS=&#8221;<strong>/usr/lib/jvm/default-java</strong> ${OPENJDKS} /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun&#8221;</p>
<p># Look for the right JVM to use<br />for jdir in $JDK_DIRS; do<br />&nbsp; &nbsp; if [ -r &#8220;$jdir/bin/java&#8221; -a -z &#8220;${JAVA_HOME}&#8221; ]; then<br />&nbsp; &nbsp; &nbsp; &nbsp; JAVA_HOME=&#8221;$jdir&#8221;<br />&nbsp; &nbsp; fi<br />done<br />export JAVA_HOME</p></blockquote>
<p>/usr/lib/jvm/default-java 라는 디렉토리가 있으면 젤 먼저 거기를 JAVA_HOME으로 지정하게 되어있다.<br />해당 파일을 확인해 보니 역시나 버전이 6이다.</p>
<blockquote><p>$ ls -l default-java<br />lrwxrwxrwx 1 root root 23 &nbsp;6월 &nbsp;4 23:10 default-java -&gt; java-1.6.0-openjdk-i386</p></blockquote>
<p>버전 7를 사용하도록 심볼릭 링크를 바꿔줬다.</p>
<blockquote><p>$ rm default-java<br />$ ln -s java-1.7.0-openjdk-i386 default-java</p></blockquote>
<p>그리고 tomcat 재실행.</p>
<blockquote><p>$ service tomcat7 restart </p></blockquote>
<p>멀쩡하게 실행이 되는 구나 ㅜ.ㅠ</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nangchang.nes.or.kr/error/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
