was 2008. 11. 25. 16:16

[JEUS5.0] Simple 개발환경 셋팅 및 이해


※사전정보
11월25일 현재  ECLIPSE3.2에서 플러그인등록해서 사용할수있다.
그 위에버전은 지원하지않은 플러그인버전 사용하고 싶으면 TMAX홈페이지에서 JMAKER라고 있으니
받고 라이센스 신청해서 사용하면된다.

WebToB 는 WebServer, JEUS는 WAS입니다.
다른버전은 모르겠으나 JEUS5.0버전을 설치하게되면 WebToB는 포함되어있습니다.

1. 우선적으로 JEUS를 설치하기전에 JDK1.4버전 이상이 설치되어있어야 한다.(5.0이상권장)
    반드시 그런것은 아니지만 JEUS부터 설치하게되면 번거롭게 수동으로 설정해줘야 하는 상황이 오기때문에
   JDK설치후 제우스를 설치하기 바란다.
   특별한것은 없고 설치중에 window service에 등록할건지 여부만 묻고 yes or no 아무거나 해도 상관없다.
   서비스 등록하면 내컴퓨터-관리-서비스에서 등록되어 제우스 구동여부를 쉽게 확인할수있다.


2. C:\TmaxSoft\JEUS5.0\webserver\config 에 wsconfig.m파일이 있는데 기본적으로 셋팅되는 정보를 담고 있다. 포트번호, Docroot,Webtob경로,등등 궁금하면 한번 가보면된다.
    특히 여기 Docroot를 변경하게되면 웹서비스되는 경로를 변경시킬수있다.
    설치완료후에 제우스 구동후 http://localhost:8080/ 치게되면 아래와같은 화면이 나오게되면 정상적으로 설치
    된것을 확인할수있다.

참고로 제우스 구동은 cmd창에서 jeus 치면 구동하게 된다.
환경설정은 필수!!
jdk의 환경변수 등록하듯이 똑같이 해주면된다.
CLASS패스에 JEUS_HOME  해주고 JEUS설치된 경로를 지정해주면된다.
EX>
JEUS_HOME
C:\TmaxSoft\JEUS5.0




기본적으로 WebToB를 사용할수 있지만 만약 정상적으로 실행이 되지 않는다면
제우스 홈 / webserver / config/ 안에 보면 2개 혹은 3개의 파일이 있을것이다.
만약 3개가 있으면 특별히 설정할필요는 없고 2개가 있는사람은 cmd창으로 통해서 위의 경로까지 가서
wscfl -i sample.m 을 통해서 컴파일을 하면된다.

그렇게 되면 아래와 같은 메세지와 함께 wsconfig.m 파일이 생성된다.

Current configuration:
                Number of client handler(HTH) = 1
                Supported maximum user per node = 973
                Supported maximum user per handler = 973
CFL is done successfully for node(SEOL(SEOL))

WebToB 부팅명령 : wsboot     종료 : wsdown
was 2008. 11. 25. 13:30

Cannot create JDBC driver of class '' for connect URL 'null'


server.xml

<GlobalNamingResources></GlobalNamingResources>안에 아래내용 추가

<Resource name="ResourceDB" type="javax.sql.DataSource"/>
  <ResourceParams name="ResourceDB1">
   <parameter>
    <name>validationQuery</name>
    <value>select * from emp</value>
   </parameter>
   <parameter>
    <name>maxWait</name>
    <value>5000</value>
   </parameter>
   <parameter>
    <name>maxActive</name>
    <value>4</value>
   </parameter>
   <parameter>
    <name>password</name>
    <value>tiger</value>
   </parameter>
   <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:@10.132.3.90:1521:ORCL</value>
   </parameter>
   <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
   </parameter>
   <parameter>
    <name>maxIdle</name>
    <value>2</value>
   </parameter>
   <parameter>
    <name>username</name>
    <value>scott</value>
   </parameter>
  </ResourceParams>


web.xml(톰켓의 web.xml)

 <resource-ref>
  <description>DB Connection</description>
  <res-ref-name>ResourceDB</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>

생성된 <context></context>안에 아래내용 추가
   <ResourceLink name="ResourceDB" global="ResourceDB1" type="javax.sql.DataSource"/>

was 2008. 11. 25. 09:39

Tomcat5.x버전에서 DBCP 설정

Tomcat5.x 버전에서 DBCP 설정하기



1. 톰캣이 설치된디렉토리 conf폴더의 server.xml 에 <host>태그 사이 추가
 
<Context path="/myapp" docBase="톰켓설치경로\webapps\ROOT"
        debug="5" reloadable="true" crossContext="true">

<Resource name="jdbc/ora" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@200.000.000.01:1521:XID"
              username="kkk" password="kkk" maxActive="15" maxIdle="10"
              maxWait="-1"/>
</Context>


Context - path : URL 호출시 사용될 이름
            - docBase : 실제 웹 어플리케이션이 위치한 폴더명
            - debug : 로그 작성 레벨
            - reloadable : 톰캣서버의 재시작 없이 수정된 내용을 불러오기 위한 옵션
            - crossContext : myapp이외의 Context에서도 사용 가능하도록 하는 옵션

Resource - name : Resource명칭(JNDI Lookup 시 사용할 명칭)
              - auth : Resource 관리자를 지정. 여기서는 톰캣컨테이너가 관리자임
              - type : Resource 의 형태 지정. 데이타소스 형태를 지정함
              - maxActive : 최대 연결 가능한 Connection 숫자를 지정함
              - maxIdle : Connection pool 유지를 위해 최대 대기 connection 숫자
              - maxWait : Connection 재 사용을 위해 대기해야 하는 최대 시간(단위:ms)
              - username : DB접속 계정
              - password : DB접속 암호
              - driverClassName : DB와 접속하기 위한 driver 클래스를 지정. 예에서는 MySql임
              - url : 접속한 DB가 위치한 서버명, 포트명, 사용할 데이타베이스명을 지정
* 주의 : WEB-INF/conf 디렉토리가 절대아님,  tomcat_server.xml 파일도 아님
 
2. WEB-INF/web.xml에 다음추가
 
 <resource-ref>
  <description>Oracle Datasource example</description>
  <res-ref-name>jdbc/myoracle</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>

 
//내용설명
resource-ref - description : 참조할 resource에 대한 설명
                  - res-ref-name : 참조할 resource의 명칭. Server.xml에 정의된 이름과 일치해야함
                  - res-type : 참조할 resource 형태로 여기서는 DataSource를 지정함
                  - res-auth : 참조할 resource를 관리할 주체로 톰캣컨테이너를 지정함
 
3. 아래와 같은 커넥션 테스트용 페이지를 만들어 테스트해본다.
 
<%@ page import="java.sql.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.sql.*" %>
<%
 Context initCtx = new InitialContext();
 Context envCtx = ( Context ) initCtx.lookup( "java:comp/env" );
 DataSource ds = ( DataSource ) envCtx.lookup( "jdbc/ora" );
 Connection conn = ds.getConnection();
 Statement stmt = conn.createStatement();
 String query = "select sysdate from dual";
        ResultSet rs = stmt.executeQuery( query );
        if( rs.next() ) {
                out.println( "DB Connection Success...!!!" );
  out.println( "JNDI Test Success!!!" );
        }
        rs.close();
        stmt.close();
        conn.close();
%>