2008/4/23 水曜日

hiernate ハマリ道 @Table書き忘れ。

このエントリをはてなブックマークに追加hiernate @Table吾綽のはてなブックマーク被リンク数
Filed under: java — akky @ 16:24:43

Criteria.list()のタイミングで結果を取得できない。第2弾

hibernate.cfg.xmlにmappingのエンティティクラスの名前を書いたけど、エンティティのソースに

@Entity
@Table(name = “テーブル名”)

を書いていなかった。

log4jを使っている場合に、hibernateのログをやったら出して、下のログが出ていればマッピング情報が作られている。

Bind entity エンティティクラス名 on table テーブル名

マッピングの状態を

hiernate ハマリ道 hibernate.xfg.xmlを入れ忘れ

このエントリをはてなブックマークに追加hiernate hibernate.xfg.xmlャ綽のはてなブックマーク被リンク数
Filed under: java — akky @ 11:22:58

hibernate3でannotationを使ってコーディングを実施。org.hibernate.Criteria#list()を何度実行しても、空のリストが帰ってくる。DB側のログを見ると接続してはいるが、SQLを実行している形跡がない。テーブルを変えてみても駄目。

それで、別プロジェクトで作られた同じやり方をしているソースコード見ても特段の違いを感じられない。もう、こうなったらということで、一通りのソースを見ていると、hibernate.xfg.xmlを発見。これが無いからだorz。半日無駄にしてしまった。

2008/4/14 月曜日

php.iniの設定を.htaccessで上書きできない

このエントリをはてなブックマークに追加php.ini荐絎.htaccessт吾сのはてなブックマーク被リンク数
Filed under: PHP — akky @ 17:18:30

レンタルサーバーを使っていてphp.iniの上書きをしたいときに、レンタルサーバのマニュアルに従って.htaccessを編集しても、phpinfo()で見ると設置値が反映されていない場合の対応。

display_errorsのマニュアルを見ていて知った。ini_set関数を使うことで、解決できる場合もある。

注意: display_errors は実行時にも設定可能(ini_set() 関数を用いて)ですが、スクリプトが致命的(fatal)なエラーを発生した場合は その設定は反映されません。なぜなら、要求されたアクションは 実行されなかったからです。

ということで、文法エラー系には効かないと解釈したのだが、requireしているファイルの文法エラーはメッセージを出してくれた。set_ini()を記述しているファイルでなければ問題ないということなのだろうか。

例えばdisplay_errors を有効にしたい場合の記述はこれ。

ini_set("display_errors","On");

エラーの原因がわからないために、1日つぶしてしまった。ちなみに、PEAR.phpが無いのが原因だった。

2008/4/3 木曜日

webalizer-2.01-10をインストール

このエントリをはてなブックマークに追加webalizer-2.01-10ゃ潟鴻若のはてなブックマーク被リンク数
Filed under: linux — akky @ 17:32:49

Fedra6にwebalizer-2.01-10をインストールした顛末です。

You must have a V1.85 compatable DB libraryっていわれる

ホスト名を逆引きしたいので

./configure  --with-language=japanese --enable-dns

とすると

[root@vesalius webalizer-2.01-10]# ./configure  --with-language=japanese --e
nable-dns
loading cache ./config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking whether ln -s works... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking how to run the C preprocessor... (cached) gcc -E
checking whether char is unsigned... (cached) no
checking for dbopen... (cached) no
checking for library containing dbopen... (cached) no
configure: warning: You must have a V1.85 compatable DB library!
configure: warning: DNS lookup code will be disabled...
checking for socket... (cached) yes
checking for sys/socket.h... (cached) yes
checking for main in -lnsl... (cached) yes
checking for main in -l44bsd... (cached) no
checking for main in -lm... (cached) yes
checking for main in -lz... (cached) yes
checking for gzrewind in -lz... (cached) yes
checking for main in -lpng... (cached) yes
checking for gdImagePng in -lgd... (cached) yes
checking for gd.h... (cached) /usr/include
checking for getopt.h... (cached) yes
checking for math.h... (cached) yes
checking default config dir... (cached) /etc
checking for language file... yes - japanese
creating ./config.status
creating Makefile
linking ./lang/webalizer_lang.japanese to webalizer_lang.h
[root@vesalius webalizer-2.01-10]#

ってなる。コンパイルもでき、実行もできるのだけど、DNSCacheDNSChildrenの設定をしてあると

Warning: Invalid keyword 'DNSCache' (/etc/webalizer.conf)
Warning: Invalid keyword 'DNSChildren' (/etc/webalizer.conf)

っていわれてしまい、逆引きもできていない。configure時の

configure: warning: You must have a V1.85 compatable DB library!
configure: warning: DNS lookup code will be disabled...

の警告に起因しているみたいだ。Berkeley DBの1.85を用意せよとおっしゃる。なので、rpmから

  • db4-devel-4.3.29-9.fc6
  • db4-4.3.29-9.fc6

を入れておく

Berkeley DBを使ってコンパイル

rpmから入れたBerkeleyDBを使うように

./configure  --with-language=japanese --enable-dns --with-dblib=/usr/lib -with-db=/usr/include

とすると、configure時の警告は消えるが、今後は、コンパイルが通らない

dns_resolv.c: In function `resolve_dns':
dns_resolv.c:149: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:149: error: too few arguments to function
dns_resolv.c: In function `dns_resolver':
dns_resolv.c:218: warning: implicit declaration of function `dbopen'
dns_resolv.c:218: warning: assignment makes pointer from integer without a cast
dns_resolv.c:228: error: too few arguments to function
dns_resolv.c:235: error: too few arguments to function
dns_resolv.c:275: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:275: error: too few arguments to function
dns_resolv.c:329: error: too few arguments to function
dns_resolv.c:359: error: too few arguments to function
dns_resolv.c: In function `db_put':
dns_resolv.c:745: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:745: error: too few arguments to function
dns_resolv.c: In function `open_cache':
dns_resolv.c:793: warning: assignment makes pointer from integer without a cast
dns_resolv.c:801: error: too few arguments to function
dns_resolv.c:807: error: too few arguments to function
dns_resolv.c: In function `close_cache':
dns_resolv.c:829: error: too few arguments to function
make: *** [dns_resolv.o] Error 1

引数の数が違うとな。/usr/include/db.hdns_resolv.cを見比べるとやっぱり、引数数が合わない。むむむと、dns_resolv.cと睨めっこしていると

ifdef HAVE_DB_185_H
#include <db_185.h>                            /* on my RH6.0 system ?!?   */
#else
#include <db.h>                                /* DB header ****************/
#endif /* HAVE_DB_185_H */

という記述を発見。db_185.hがあるとな。最初の警告にあるV1.85と符合する。db_185.hを探すと/usr/include/db4/にヘッダファイルを発見。これを読ませればいいんだな。ということで、

CFLAGS='-DHAVE_DB_185_H' ./configure  --with-language=japanese --enable-dns --with-dblib=/usr/lib --with-db=/usr/include

としてコンパイル。これでコンパイル時の問題と実行時の問題が無事解決です。

次のページ »