블로그 이미지

김진리

,

현재 Spring maven 에 tomcat lib 를 추가하여 생기는 에러이다.

2가지 방법이 있다.


첫번째.

http://stackoverflow.com/questions/8487048/java-lang-linkageerror-javax-servlet-jsp-jspapplicationcontext-getexpressionfac  글 참고

That will happen when you include server-specific libraries of a different server make/version in the/WEB-INF/lib of your web application, such as jsp-api.jarel-api.jarservlet-api.jar, etc. You need to remove them all. The /WEB-INF/lib should not contain any server-specific libraries. They belongs in the specific server itself (Tomcat has them in its /lib folder already).


자신의 톰캣 서버의 lib를 사용하면 에러가 나지 않는다.

Project -> Properties -> JAVA Build Path -> Libraries -> Add Library -> Server Runtime

Server 추가 한다.



두번째.


pom.xml 에 


<dependency>

<groupId>org.apache.tomcat</groupId>

<artifactId>tomcat-coyote</artifactId>

<version>7.0.39</version>

<scope>provided</scope>

</dependency>



provided - 컴파일 할 때 필요하지만, 실제 런타임 때에는 컨테이너 같은 것에서 기본으로 제공되는 모듈임을 의미한다. 예를 들어, 서블릿이나 JSP API 등이 이에 해당한다. 배포시 제외된다.

 

실제 런타임때에는 컨테이너(JVM)에서 제공되는 api 를 사용해야 하기 때문에 provided 를 사용한다.

ex) tomcat 안에 있는 jar 파일들

'개발자 > Spring' 카테고리의 다른 글

Spring 에서 File Dowload 하는 예제 및 설정  (0) 2013.06.12
스프링 프레임웍 jar 파일  (1) 2013.03.05
Spring 에서 context부분...  (0) 2013.03.04
Spring 기본 환경설정 프로젝트  (0) 2013.03.04
applicationContext.xml  (0) 2013.03.04
블로그 이미지

김진리

,

http://dist.springframework.org/release/IDE


html - jstl 사용...

http://www.coderanch.com/t/530760/Struts/JSP-find-tag-library-descriptor


1. 스프링 프레임웍


spring - core.jar

용도 : 스프링 핵심 컨테이너와 유틸리티

의존대상 : 커먼스 로깅


spring - app.jar

용도 : 스프링 AOP 프레임워크 및 메타데이터 지원

의존대상 : spring-core.jar, AOP 연맹


spring - context.jar

용도 : 애플리케이션 컨텍스트, 유효성 검증 프레임워크, 템플릿 지원(벨로시티,프리마커)

리모팅(JAX-RPC,Hessian,Buriap),EJB지원,스케줄링

의존대상 : spring-core.jar


spring - dao.jar

용도 : JDBC 및 DAO 지원 , 트랜잭션 기반구조

의존대상 : spring-core.jar


spring - com.jar

용도 : 하이퍼네이트, JDO , Ibatis 를 포함한 ORM 프레임워크 지원

의존대상 : spring-core.jar


spring - web.jar

용도 : 웹 애플리케이션 컨텍스트 및 유틸리티, 멀티파트 파일 업로드 지원

의존대상 : spring-context.jar


spring - webmvc.jar

용도 : 스프링 MVC 프레임워크

의존대상 : spring-web.jar


spring.jar

용도 : 다른 JAR파일들을 포함한 스프링 프레임워크 전체

의존대상 : 위의 모든 사항들을 포함


블로그 이미지

김진리

,


String[] config = new String[] { "applicationContext.xml" };

config 에 applicationContext.xml을 넣고

ApplicationContext context = new ClassPathXmlApplicationContext(config);

ApplicationContext를 context 레퍼변수로 설정하여 config를 불러와서 config 안에 있는 모든 class객체를 생성 시킨다.

MemberService p = (MemberServiceImpl) context.getBean("service");

context에서 getBean으로 bean 중 id가 service인 beand을 불러와서

MeberService 에 저장 시킨다.

블로그 이미지

김진리

,

Member.zip

Spring 의 환경설정 되어 있는 프로젝트

블로그 이미지

김진리

,

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xmlns:p="http://www.springframework.org/schema/p"                

  p 태크를 사용하기 위해

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">



beans 들 중에 bean 하나씩 개인 설정을 하기 시작

<!-- dataSource 설정 -->

dataSource 라는 id 로 oracle DB를 접속하기 위한 property 와 value 를 저장 하여 설정

<bean id="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName">

<value>oracle.jdbc.driver.OracleDriver</value>

</property>

<property name="url">

<value>jdbc:oracle:thin:@localhost:1521:ORCL</value>

</property>

<property name="username">

<value>scott</value>

</property>

<property name="password">

<value>tiger</value>

</property>

</bean>

<!-- iba test -->

bean id 를 sqlMapClient 로 두며 class를 org.springframework.orm.ibatis.SqlMapClientFactoryBean 사용한다. p:dataSource-ref 는 p 태크는 메소드를 압축시킨 상대로써 dataSource메소드에 ref로 dataSource를 set한다.

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"

p:dataSource-ref="dataSource" p:configLocation="SqlMapConfig.xml" />


<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate"

p:sqlMapClient-ref="sqlMapClient" />


<bean id="ibaDao" class="mem.MemberDaoImpl"

p:sqlMapClientTemplate-ref="sqlMapClientTemplate" />

사용자의 class 부분이므로 만들어진 class에 dao 변수에 ibaDao 를 치환하여 저장 한다.

<bean id="service" class="mem.MemberServiceImpl">

<property name="dao"><ref bean="ibaDao"/></property>

</bean>

</beans>


블로그 이미지

김진리

,

초기 spring 이 필요한 IDE 를 설치하기위해

http://dist.springframework.org/release/IDE 에 있는 IDE (integrated development environment )들을 다운로드 합니다.


이거나


만약에 다운로드 하여도 안될시 Spring이 설치 되어 있는 eclipse 를 다운로드하는 방법을 사용합니다.

www.springsource.org 주소에 들어 가셔서 


자신에 맞는 다운을 합니다. 그럼 Spring 사용 Ok.

블로그 이미지

김진리

,