Scenario:

AWS에서 EC2에 Ubuntu Tomcat7 웹 프로젝트를 올려서 배포를 하려고 했다.

Window 환경에서 배포를 했을때는 잘 돌아갔는데

Ubuntu 환경으로 변하니 오류가 해결이 안되는 것이었다.

Tomcat7 로그를 확인해보니 다음같은 오류가 계속났다.

Error initializing mybatis. Cause:org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.datasource.DataSourceException: There was an error configuring JndiDataSourceTransactionPool. 

Cause: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]



Solutions

Mybatis 쪽에서 오류가 나는건가 하고 내 코드를 열심히 뒤져봤지만,

문제는 

The cause is a issue in the Ubuntu build/package process for Tomcat7. If I understand the issue correctly, Apache builds tomcat-dbcp.jar from binary files, while Ubuntu builds packages only from source. The Ubuntu project ends up needing to change the Java package name, which tends to break things for us poor users. The gory details may be found at the Ubuntu issues list.

The solution I found is to name the data source factory when I define the resource. In one case, I have a META-INF/context.xml file that contains:

이런 이유에서 나는 것 이었다.




factory="org.apache.commons.dbcp.BasicDataSourceFactory" 

단순히 이 한 줄을 context.xml 파일내 Resource에  추가하니 해결 되었다.

이것때문에 몇날을 고생했는지.. ㅠㅠ 

심지어 윈도우로 EC2를 다시구성해야되나 고민했엇다.



+ Recent posts