☆ Linux(8)☆ Linux(6)前へ


☆ Linux奮闘記 (7) Jrun(JSP)+java  JavaWebServer2.0 '99/9-'99/9 ☆



この連載も早い物で(7)に突入です。もう1年もしないうちに、Javaも主要なツ−ルととしての地位を確立出来ると思います。先月は遅ればせながらServlet(Java)もやってみましたが、かなり使えることが判明しました。これらを使用し(Web+DB+Java)、本格的なe-businessソリュ−ションを展開したいと思っています。JSPも一度体験したいと思っていた矢先に、いい本に出会えましたので 実験が出来ました。5号機(Linux server)の注文もいただき、今度もオンラインショツピングサイトで使用します。今回は、Prel(CGI)での開発になりそうです。当面DBとの連携はなさそうです。
Linux+NTの納品


Windows版、JDBC+JRunの実装
  • 99/8/30 Windows版、Jrun(JRE)のダウンロ−ド。20MB(約1時間かかる)

    99/8/31 その前に、JDK+JDBCのインスト−ルが必要。JDK1.1.7のインスト−ル。JDBCはOracleのホ−ムペ−ジから、Oracle7用を ダウンロ−ド。
    set path=d:\jdk1.1.7\bin
    set CLASSPATH=d:\orant\jdbc\lib\classes111.zip;d:\jdk1.1.7\lib\classes.zip これを忘れないように
    JDBCのテスト。とりあえず、JdbcApplet.javaの接続部分の修正。
    jdbc:oracle:thin:scott/tiger@dlsun511:1721:dbms733";
    自分の環境に併せて修正してください。
    コンパイルしてみます。
    D:\ORANT\jdbc\samples\thin>javac JdbcApplet.java
    Note: JdbcApplet.java uses a deprecated API. Recompile
    details.1 warning

    D:\ORANT\jdbc\samples\thin>dir
    classファイルが出来ています。
    それでは、Web経由で、Oracle+JDBCのテストをしてみましょう。classes111.zip,jdbcapplet.class,jdbcapplet.htmをIISのフオルダ−へコピ−。
    http://172.21.20.7/java/JdbcApplet
    Loading JDBC driver oracle.jdbc.driver.OracleDriver
    Connecting to jdbc:oracle:thin:scott/tiger@172.21.20.7:1521:ORCL
    Connected
    Executing query select 'Hello JDBC: ' || sysdate from dual
    Hello JDBC: 31-AUG-99
    done.

    やりました、成功です。久しぶりの成功で、嬉しいです。これで、Linux,NT共に、JDBCのテストは成功です。今後も「地味に先行、派手に展開」でやっていくしかありません。
    次に、JSDK2.0(Win版、servlet)の落とし込み。又、CLASSPATHへ、JSDK2.0のパスを追加です。servletも問題無し。
    いよいよ、本題のJRunのインスト−ルです。先日挑戦したのですが、DISK容量が少なくて、インスト−ル出来ませんでした。不要なデ−タを削除して、再度挑戦。
    Jrun232setup.exeの実行。問題なく10分程度で、導入完了。
    JRunの動作確認、Application Modeでスタ−ト。
    接続の確認。http://localhost:8000/で、Jrunの画面が出て、Servletのテストが問題なく終了。
    JRunへJDBCの組み込み。

    99/9/1 D:\JRun\servlets>javac JdbcServlet.java
    classが出来ましたので、テストしてみましょう。http://localhost:8000/jdbctest.html
    sql = select sysdate from dual
    pass = tiger
    port = 1521
    hadr = 172.21.20.7
    sid = orcl
    id = scott

    SYSDATE
    1999-09-01 14:24:37.0
    sql = select * from emp
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369 SMITH CLERK 7902 1980-12-17 00:00:00.0 800 null 20
    7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00.0 1600 300 30
    7521 WARD SALESMAN 7698 1981-02-22 00:00:00.0 1250 500 30
    7566 JONES MANAGER 7839 1981-04-02 00:00:00.0 2975 null 20
    7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00.0 1250 1400 30
    7698 BLAKE MANAGER 7839 1981-05-01 00:00:00.0 2850 null 30
    7782 CLARK MANAGER 7839 1981-06-09 00:00:00.0 2450 null 10
    7788 SCOTT ANALYST 7566 1987-04-19 00:00:00.0 3000 null 20
    7839 KING PRESIDENT null 1981-11-17 00:00:00.0 5000 null 10
    7844 TURNER SALESMAN 7698 1981-09-08 00:00:00.0 1500 0 30
    7876 ADAMS CLERK 7788 1987-05-23 00:00:00.0 1100 null 20
    7900 JAMES CLERK 7698 1981-12-03 00:00:00.0 950 null 30
    7902 FORD ANALYST 7566 1981-12-03 00:00:00.0 3000 null 20
    7934 MILLER CLERK 7782 1982-01-23 00:00:00.0 1300 null 10
    問題なく立ち上がりました。JRunまでとりあえず、成功。この環境、この勢いで、一気にJSPへ挑戦。





Oracle Web-DB(WinNT)への挑戦
  • 99/9/2 NT版、Oracle Web-DBを手に入れましたので、インスト−ルをしています。インスト−ル時は、Oracleを停止。第二ステ−ジになったところで、Oracle Start,Web-DBのパッケ−ジの選択が来ました。(8i,8.0.5,7.3.4) インスト−ル開始、導入に2時間もかかりました(WinNT4.0+P2-300MHZ,MM96MB)。途中、停止しているかと思いましたが、裏でガリガリSQLが流れていました。 本当は、Linux版をインスト−ルしたいのですが、かなり難しそうなので、Win版で慣れてから、挑戦したいと思います。
    http://xxxxx:80/WebDB/
    http://xxxxx:80/admin_/gateway.htm
    http://xxxxx:80/admin_/listener.htm
    それでは、使用してみます。http://oracle-sv:80/WebDB/で、開始の画面が出る。Webから、すべての事が簡単に、出来ます。すばらしいです。
    実は、インスト−ルするときのポ−トを80にしていましたが、これが間違いの元でした。今まで使っていた、ホ−ムペ−ジが見れなくなってしまいました。よく考えたら、8080で インスト−ルしておかなければなりませんでした。大失敗でした。しかたなく、IISのポ−トを8080に変更しました。
    話は変わりますが、Windows2000 b3を導入しました。外観はほとんど変化はありません。これから色々、遊んでみたいと思っています。一番気になる、安定度はどうでしょうか。
    99/9/6 \orant\bin\wdblsnr.exeを使用して、ポ−トの変更。wdblsnr.exe -remove,wdblsnr.exe host-name port、うまく動きました。O社宮原さん、本当にありがとうございました。




JSP(java server page)への挑戦
  • 99/9/2 いよいよ、JSPへの挑戦です。DBへアクセス出来る、xxx.jsp、HTMLファイルの記述です。
    何回か、JSPのプログラムミスで、サ−バエラ−が発生。JDBCよりレスポンスが相当早い。初めて体験しました。もちろん、ASPよりも数段早い。
    後は、これをIISもしくは、Apacheへ組み込めれば、最高ですね。又、勉強していきます。
    SCOTT/TIGERのEMP表の出力結果。
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369 SMITH CLERK 7902 1980-12-17 00:00:00.0 800 null 20
    7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00.0 1600 300 30
    7521 WARD SALESMAN 7698 1981-02-22 00:00:00.0 1250 500 30
    7566 JONES MANAGER 7839 1981-04-02 00:00:00.0 2975 null 20
    7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00.0 1250 1400 30
    7698 BLAKE MANAGER 7839 1981-05-01 00:00:00.0 2850 null 30
    7782 CLARK MANAGER 7839 1981-06-09 00:00:00.0 2450 null 10
    7788 SCOTT ANALYST 7566 1982-12-09 00:00:00.0 3000 null 20
    7839 KING PRESIDENT null 1981-11-17 00:00:00.0 5000 null 10
    7844 TURNER SALESMAN 7698 1981-09-08 00:00:00.0 1500 0 30
    7876 ADAMS CLERK 7788 1983-01-12 00:00:00.0 1100 null 20
    7900 JAMES CLERK 7698 1981-12-03 00:00:00.0 950 null 30
    7902 FORD ANALYST 7566 1981-12-03 00:00:00.0 3000 null 20
    7934 MILLER CLERK 7782 1982-01-23 00:00:00.0 1300 null 10




Java web Server2.0の実装
  • 99/9/10 Java Web server2.0をダウンロ−ドし、解凍。http://www.sun.com/software/jwebserver/index.html
    tar zxvf jwsr2_0-solsparc-xx.tar.Z
    JavaWebServer2.0/jre/lib/font.properties.ja
    JavaWebServer2.0/jre/lib/font.properties.ko
    JavaWebServer2.0/jre/lib/font.properties.zh_EUC_CN
    JavaWebServer2.0/jre/lib/font.properties.zh_GBK
    JavaWebServer2.0/jre/lib/font.properties.zh_TW_EUC_TW
    JavaWebServer2.0/jre/lib/font.properties.zh_TW_Big5
    JavaWebServer2.0/jre/lib/font.properties.cs
    JavaWebServer2.0/jre/lib/font.properties.el
    JavaWebServer2.0/jre/lib/font.properties.hu
    JavaWebServer2.0/jre/lib/font.properties.lt
    JavaWebServer2.0/jre/lib/font.properties.lv
    JavaWebServer2.0/jre/lib/font.properties.pl
    JavaWebServer2.0/jre/lib/font.properties.ru
    JavaWebServer2.0/jre/lib/font.properties.tr
    JavaWebServer2.0/jre/lib/font.properties.ISO8859_15_FDIS
    JavaWebServer2.0/jre/lib/psfont.properties.ja
    JavaWebServer2.0/jre/lib/javac.jar
    JDK1.1.7はすでに存在。
    jdk117_v1a/lib/psfont.properties.ja
    jdk117_v1a/lib/appletviewer.properties
    jdk117_v1a/lib/serialver.properties
    jdk117_v1a/lib/classes.zip
    jdk117_v1a/README.linux
    jdk117_v1a/README.linux.src
    jdk117_v1a/LICENSE
    jdk117_v1a/src.zip
    jdk117_v1a/COPYRIGHT
    jdk117_v1a/README
    jdk117_v1a/CHANGES
    jdk117_v1a/index.html
    Java web Serverの実行
    JavaWebServer2.0/etc/java-server.startupの修正
    JSERV_HOME
    JAVA_HOME=/tmp/jdk117_v1a/bin

    root@soho etc]# ./java-server.startup start
    /tmp/JavaWebServer2.0/etc/java-server.startup: /usr/bin/ps: No such file or directory
    /tmp/JavaWebServer2.0/etc/java-server.startup: /usr/bin/grep: No such file or directory
    /tmp/JavaWebServer2.0/etc/java-server.startup: /usr/bin/grep: No such file or directory
    /tmp/JavaWebServer2.0/etc/java-server.startup: /usr/bin/grep: No such file or directory
    /tmp/JavaWebServer2.0/etc/java-server.startup: /usr/bin/grep: No such file or directory
    [root@soho /tmp]# bin/jserv: /bin/dirname: No such file or directory
    jserv: Cannot find default for JSERV_HOME.

    Usage: jserv [-jre|-nojre] [-javahome ] [-javacmd ]
    [-cp ] [-vmargs ] [-ssl] [-passfile]
    [-nopassfile] [-Dsystem_property=value]... [-verbose] [-help]
    なにやら、エラ−になりました。/usr/bin/ps---->/bin/ps
    再度実行
    root@soho etc]# ./java-server.startup start
    ./java-server.startup: Cannot find JavaWebServer in JSERV_HOME (JavaWebServer2.0/bin).
    何が、悪いのだろうか。

    99/9/12 JSERV_HOMEをセットしても動作不可。完全に、いきずまりました。

    99/9/20 [fujii@soho bin]$ export JAVA_HOME=/tmp/jdk117_v1a
    [fujii@soho bin]$ ./httpd.nojre
    ulimit: bad non-numeric arg `file'
    Can't find class com.sun.server.ServerProcess

    [root@soho bin]# ./httpd
    ulimit: bad non-numeric arg `file'
    /tmp/JavaWebServer2.0/jre/bin/jre: /tmp/JavaWebServer2.0/jre/bin/jre[34]: /usr/bin/ls: not found
    /usr/bin/expr: warning: unportable BRE: `^.*-> \(.*\)$': using `^' as the firstcharacter
    of the basic regular expression is not portable; it is being ignored
    /usr/bin/expr: warning: unportable BRE: `^/': using `^' as the first character
    of the basic regular expression is not portable; it is being ignored
    /tmp/JavaWebServer2.0/jre/bin/jre: /tmp/JavaWebServer2.0/jre/bin/jre[79]: /usr/bin/uname: not found
    jre was not found in ./../bin//native_threads/jre これも、なんかエラ−ぽいですね。

    99/9/21 [root@soho bin]# export JAVA_HOME=/tmp/jdk117_v1a
    [root@soho bin]# export JSERV_HOME=/tmp/JavaWebServer2.0
    [root@soho bin]# ./httpd.nojre
    ulimit: bad non-numeric arg `file'
    libserver.so: cannot open shared object file: No such file or directory (libserver.so)
    This version of the Java Web Server (2.0) will expire on
    Wed Oct 20 20:27:22 JST 1999. Please send feedback about this
    release to java-server-feedback@java.sun.com. Visit the Java Web
    Server site at http://www.sun.com/software/jwebserver/
    for more information about this product.
    javawebserver: libserver.so: cannot open shared object file: No such file or directory (libserver.so)
    javawebserver: ulimit: bad non-numeric arg `file'
    javawebserver: This version of the Java Web Server (2.0) will expire on
    javawebserver: Wed Oct 20 20:27:22 JST 1999. Please send feedback about this
    javawebserver: release to java-server-feedback@java.sun.com. Visit the Java Web
    javawebserver: Server site at http://www.sun.com/software/jwebserver/
    javawebserver: for more information about this product.
    NSPで、http://172.21.20.13:9090/とすると、なんと認証画面が出てきました。これって動いているのかな。 ps -ax
    26247 p0 S 0:00 sh ./httpd.nojre
    26251 p0 S 0:00 sh bin/jserv -nojre
    26360 p0 S 0:02 /tmp/jdk117_v1a/bin/i686/green_threads/java -Dnojre=true -Dj
    26411 p0 S 0:04 /tmp/jdk117_v1a/bin/i686/green_threads/java -Dnojre=true -Dj
    26570 ? S 0:00 ./usr/local/sbin/sshd1
    なんか、動いてますね。
    SSLを起動してみました。
    javawebserver: libjssl.so: cannot open shared object file: No such file or directory (libjssl.so)
    javawebserver: Java Web Server ERROR: Cannot start Secure Service: No keys file
    こちらのエラ−は当然ですね。




nmap tcpdumpの実装
  • 99/9/9 nmap2.12をダウンロ−ドし、解凍、Install,make。ネットワ−クの弱いところを検査。nmap 192.168.1.1/32 なかなか興味深い結果が表示される。
    99/9/10 tcpdumpのインスト−ル。
    [root@soho /tmp]# tar xvfz libpcap-0_4_tar.Z
    libpcap-0.4/CHANGES
    libpcap-0.4/FILES
    ibpcap-0.4/pcap-pf.h
    libpcap-0.4/pcap-snit.c
    libpcap-0.4/pcap-snoop.c
    libpcap-0.4/pcap.3
    libpcap-0.4/pcap.c
    libpcap-0.4/pcap.h
    libpcap-0.4/ppp.h
    libpcap-0.4/savefile.c
    libpcap-0.4/scanner.l

    ./configure
    checking for ranlib... ranlib
    checking if sockaddr struct has sa_len member... no
    checking if unaligned accesses fail... no
    checking for a BSD compatible install... /usr/bin/install -c
    updating cache ./config.cache
    creating ./config.status
    creating Makefile

    make
    ar rc libpcap.a pcap-linux.o pcap.o inet.o gencode.o optimize.o nametoaddr.o eth
    erent.o savefile.o bpf_filter.o bpf_image.o scanner.o grammar.o version.o
    ranlib libpcap.a

    [root@soho libpcap-0.4]# make install
    /usr/bin/install -c -m 444 -o bin -g bin libpcap.a /usr/local/lib/libpcap.a
    ranlib /usr/local/lib/libpcap.a

    tcpdump のinstall
    tcpdump-3.4/setsignal.h
    tcpdump-3.4/stime.awk
    tcpdump-3.4/strcasecmp.c
    tcpdump-3.4/tcpdump.1
    tcpdump-3.4/tcpdump.c
    tcpdump-3.4/util.c
    tcpdump-3.4/vfprintf.c

    ./configure
    hecking if ether_arp uses erp_xsha member... no
    checking if unaligned accesses fail... no
    checking for a BSD compatible install... /usr/bin/install -c
    updating cache ./config.cache
    creating ./config.status
    creating Makefile

    make
    -wb.o addrtoname.o bpf_dump.o gmt2local.o machdep.o parsenfsfh.o util.o savestr. o setsignal.o version.o ../libpcap-0.4/libpcap.a

    root@soho tcpdump-3.4]# make install
    /usr/bin/install -c -m 550 -o bin -g wheel tcpdump \
    /usr/local/sbin/tcpdump
    これらの、ツ−ルは使用方法によっては、大変危険なツ−ルとなりますので、使用に際しましては個人の責任において十分気を付けて使用してください。




SSH-1.2.27の実装
  • 99/9/13 tar zxvf ssh-1_2_27_tar.gzのインスト−ル。
    ssh-1.2.27/zlib-1.0.4/uncompr.c
    ssh-1.2.27/zlib-1.0.4/zconf.h
    ssh-1.2.27/zlib-1.0.4/zlib.h
    ssh-1.2.27/zlib-1.0.4/zlib.rc
    ssh-1.2.27/zlib-1.0.4/zutil.c
    ssh-1.2.27/zlib-1.0.4/zutil.h
    ssh-1.2.27/zlib-1.0.4/Makefile
    ./configure
    creating Makefile
    creating demos/Makefile
    creating mpbsd/Makefile
    creating mpf/Makefile
    creating mpf/tests/Makefile
    creating mpn/Makefile
    creating mpn/tests/Makefile
    creating mpq/Makefile
    creating mpq/tests/Makefile
    creating mpz/Makefile
    creating mpz/tests/Makefile
    make
    gcc -pipe -o ssh-askpass ssh-askpass.o xmalloc.o -L/usr/X11R6/lib -lSM -lICE -l X11 -lnsl -lbsd -lcrypt -L/usr/local/lib -lutil
    make install
    クライアント側の秘密鍵と公開鍵の2つのカギを作ります。

    [root@soho ssh-1.2.27]# ssh-keygen1
    Initializing random number generator...
    Generating p: ............++ (distance 220)
    Generating q: ....++ (distance 76)
    Computing the keys...
    Testing the keys...
    Key generation complete.
    Enter file in which to save the key (/root/.ssh/identity):
    Enter passphrase:xxxxxx
    Enter the same passphrase again:xxxxxx
    Your identification has been saved in /root/.ssh/identity.
    Your public key is:
    1024 37 116799982299784415583006326523944169847408788664400156561699317402110634
    04267398640031908131788959431783071327395364011010953309661131701130965529714776
    69301989941687542500327932910393665323395265484494991705844508403527285358970751
    25551613203156556726199672483198672672756961435457349204028586273794428658783 root@soho
    Your public key has been saved in /root/.ssh/identity.pub
    公開鍵をクライアントに置きます。

    99/9/14 /etc/sshd_confの修正。セキュリテイを高めるのでしたら、permitrootlogin no,permitemptypasswords noにしておくと良いでしょう。後、allowshosts,dennyhostsも接続ホストが限定出来るのでしたら、設定しておく方が良いでしょう。
    後は、クライアント側のTeraTermをSSH化すれば、出来上がりです。これでSSL同様、比較的安全な通信が、確保出来ます。Teratermでssh通信をしているときは、左上のマ−クが変わります。




NTのSSLの実装
  • 99/9/ 先日は、Apache版のSSLの実装のテストを行いましたが、今回は本当の証明書をいただいて実装します。




Linux関連のリンク集

I-O DATA・・・I-O DATA Linux関係。

Java jspのペ−ジ・・・Java jsp関係、他もろもろ。

Java Web Serverのペ−ジ・・・Java Web server関係、他もろもろ。

Linux RPMのペ−ジ・・・Linux RPM関係、他もろもろ。

KondaraMnu Linuxのペ−ジ・・・KondaraMnu Linux関係、他もろもろ。

APOPのペ−ジ・・・qpopper2.53K関係。

Gnu jspのペ−ジ・・・GNUJSP関係、他もろもろ。

SIS chipのペ−ジ・・・SIS XFree86関係、他もろもろ。



このホ−ムペ−ジの画像の無断転載はかたくお断りします。Linuxメーリングリストの皆さん、Oracle,PostgreSQLメーリングリストの皆さん、ならびに私を支援していただいた多くの方々に、 この場をお借りして、厚くお礼申し上げます。
ritsuo@mxy.mesh.ne.jp


前へ戻る

Copyright(C) 1999 by Ritsuo Fujii