JBossIDEを使ってEJB 3.0のお勉強
Eclipse 3.1.1にプラグインJBossIDE 1.5RC1を入れてhttp://trailblazer.demo.jboss.com/IDETrail/ejb3/index.htmlでEJB3.0プロジェクトを作成しようとするが、
"The selected configuration does not contain the expected EJB3 libraries. Please install JBoss with EJB3 enabled, or try another configuration".
のエラーが出てしまう。いろいろ検索した結果Welcome |JBoss DeveloperのようにJBoss 4.0.3でEJB3.0をインストールする為にはインストーラーを使用してEJB3.0を明示してインストールするしかないようである。
{EJB] JBossのDBをPostgreSQL 8.0へ変更する。
1. JBOSS_HOME/serversにpostgresディレクトリを作成
2. JBOSS_HOME/servers/defaultの内容をコピーする。
3. JBOSS_HOME/servers/postgres/conf/standardjaws.xmlを編集する。
<datasource>java:/DefaultDS</datasource> <type-mapping>Hypersonic SQL</type-mapping> <debug>false</debug> の部分を <datasource>java:/DefaultDS</datasource> <type-mapping>PostgreSQL 8.0</type-mapping> <debug>false</debug> と、する。
4. JBOSS_HOME/servers/postgres/deploy/hsqldb-ds.xmlを削除する。
5. JBOSS_HOME/docs/examples/jca/postgres-ds.xmlをJBOSS_HOME/servers/postgres/deployへコピーする。
6. コピーしたpostgres-ds.xmlを編集する。
<local-tx-datasource> <jndi-name>PostgresDS</jndi-name> <connection-url>jdbc:postgresql://[servername]:[port]/[databasename] </connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>x</user-name> <password>y</password> を <local-tx-datasource> <jndi-name>DefaultDS</jndi-name><===ここと <connection-url>jdbc:postgresql://[servername]:[port]/[databasename] </connection-url><==ここ <driver-class>org.postgresql.Driver</driver-class> <user-name>x</uer-name> <password>y</password> に変更する 接続URLとuser名とpassも忘れずに変更する。 <metadata> <type-mapping>PostgreSQL 7.2</type-mapping><==ここを </metadata> <metadata> <type-mapping>PostgreSQL 8.0</type-mapping><==こちらに </metadata>
7. JBOSS_HOME/servers/postgres/deploy/jms/hspldb-jdbc2-service.xml
8. JBOSS_HOME/servers/postgres/deploy/jms/hspldb-jdbc-state-service.xmを削除する。
9. JBOSS_HOME/doc/examples/jms/postgres-jdbc3-service.xmlをJBOSS_HOME/servers/postgres/deploy/jms/へコピーする。
<mbean code="org.jboss.mq.pm.jdbc3.PersistenceManager" name="jboss.mq:service=PersistenceManager"> <dependsoptional-attribute-name="ConnectionManager"> jboss.jca:service=DataSourceBinding,name=PostgresDS</depends><==ここ <dependsoptional-attribute-name="ConnectionManager"> jboss.jca:service=DataSourceBinding,name=DefaultDS</depends><==これに
10. JBOSS_HOME/servers/postgres/libにJDBCドライバーをコピーしhsqldb.jaを削除する。
で、PostgreSQL側に以下のテーブルが作成されました。
ejbtest=> \dt
List of relations
Schema | Name | Type | Owner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
public | hilosequences | table | tester1
public | jms_message_log | table | tester1
public | jms_reference_log | table | tester1
public | jms_transaction_log | table | tester1
public | timers | table | tester1
(5 rows)
追記EJB3.0をインストールした場合
JBoss 4.0.3 SP1をEJB3.0を使用する為にインストーラを用いてインストールした場合、上記を行ったあとは hilodequencesテーブルは作成されてませんでした。
postgres-jdbc3-service.xmlにはCreate Table文が4つしかなかったので問題ないと思います。
追記SQL方言の指定
HibernateでSQL方言を吸収しているようで、Create Table文でエラーになったのでJBOSS_HOME/server/postgres/deploy/ejb3.deployer/META-INF/persistence.propertiesの下記部分を修正
hibernate.dialect=org.hibernate.dialect.HSQLDialect <==ここを
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect <==に変更
■
私に対して非常にタイムリーな記事がありました。
IBM Developer 日本語版 : 大変申し訳ありません。このページは無効です。
Sun Certified Programmer for Java2
VancouverでJava関連の仕事に就く為とハクをつける為にSCJPを受験してみようと決意した。Oracle and Sun Microsystems | Strategic Acquisitions | Oracleを見て Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 (CX-310-055) - New!を目指すことにする。今まではEclipceでウィザードがクラスのスケルトンを書いてくれたり、文法的に間違いがあると指摘してくれていたので、細かい文法などのトリッキーな問題が出るとダメだし、以下のコードの結果は-正解はコンパイルエラー(こんなんはコンパイル前にEclipceに指摘される)とかが出ると太刀打ち出来そうもないので、試験対策用の書籍を注文しておいたのが届いたので試験対策勉強を記録することにする(でないと続きそうにない)。
注文した書籍は(CX-310-055)対策は未だ出版されていなかったので
- 作者: Katherine Sierra,Bert Bates
- 出版社/メーカー: McGraw-Hill Osborne Media
- 発売日: 2002/12/11
- メディア: ペーパーバック
- この商品を含むブログ (1件) を見る
しかし、MS関連やOracle関連の資格もそうだけど、受験料高いな〜。$150(USD)だそうです。
EJB 3.0のお勉強
JBoss4.0.3sp1をインストールしたのでEJB 3.0のお勉強を始める。
参考:
- id:taediumさんのEJB入門記 ほぼ2ヶ月遅れで始めました。
- http://trailblazer.demo.jboss.com/EJB3Trail/
PostgreSQL 8のインストール
PostgreSQLをインストールする。Debianだとstableは未だに7.4なのでFreeBSDに8.0.4をインストールすることにする。Debianでもソース持って来てコンパイルするなり自前でパッケージを作れば良いのだろうが、自前でパッケージ作るよりもportsでconfigureしての方が楽過ぎる。
いつものように
tmkbsd# cd /usr/ports/databases/postgresql80-server tmkbsd# make install clean --snip-- ====================================================================== For procedural languages and postgresql functions, please note that you might have to update them when updating the server. If you have many tables and many clients running, consider raising kern.maxfiles using sysctl(8), or reconfigure your kernel appropriately. You should vacuum and backup your database regularly. There is a periodic script, ${LOCALBASE}/etc/periodic/daily/502.pgsql, that you may find useful. Per default, it perfoms vacuum on all databases nightly. See the script for instructions. To allow many simultaneous connections to your PostgreSQL server, you should raise the SystemV shared memory limits in your kernel. Here are example values for allowing up to 180 clients (configurations in postgresql.conf also needed, of course): options SYSVSHM options SYSVSEM options SYSVMSG options SHMMAXPGS=65536 options SEMMNI=40 options SEMMNS=240 options SEMUME=40 options SEMMNU=120 If you plan to access your PostgreSQL server using ODBC, please consider running the SQL script /usr/local/share/postgresql/odbc.sql to get the functions required for ODBC compliance. ====================================================================== To initialize the database, run /usr/local/etc/rc.d/010.pgsql.sh initdb You can then start PostgreSQL by running: /usr/local/etc/rc.d/010.pgsql.sh start For postmaster settings, see ~pgsql/data/postgresql.conf NB. FreeBSD's PostgreSQL port now by default logs to syslog See ~pgsql/data/postgresql.conf for more info ====================================================================== To run PostgreSQL at startup, add 'postgresql_enable="YES"' to /etc/rc.conf ====================================================================== ===> Registering installation for postgresql-server-8.0.4
${LOCALBASE}/etc/periodic/daily/502.pgsqlとあるので見てみると、なんとvacuumとbackupのスクリプトが....これはportsだから????
今までは、postgreSQLのML(だったと思うけど)で見た、
#/bin/sh # PostgreSQL database backup script # Version 1.1 [Apr. 17, 2002] Add routine: deleting exipired files. # Version 1.0 [Sep. 10, 2002] First release. # Saito Hiroaki <example@example.com> # * Feature # Dump to DATABASE_NAME_YYMMDD.pgdmp. # Delete expired pgdmp file. # Output log. # Setting PATH="$PATH":/usr/lib/postgresql/bin PG=/usr/lib/postgresql export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":$PG/lib export PGLIB=$PG/lib export PGDATA=/var/lib/postgres/data # Get all DB name #TARGET_DB=`psql -l -P format=unaligned -P fieldsep=, -P tuples_only |perl -F, -lane "if (@F[0] ne 'template0') {print @F[0]}"` DIR=/var/lib/postgres/backup LOG=$DIR/pgdump.log BACKUPDIR=$DIR/dbbackup EXPIRE_DAY=3 # Main routine echo "pg_dump start." `date` >>$LOG date=`date +%Y%m%d` for db_name in $TARGET_DB do DUMP_FILE_PATH=$BACKUPDIR/${db_name}_${date}.pgdmp /usr/lib/postgresql/bin/pg_dump $db_name -Fc > $DUMP_FILE_PATH 2>>$LOG echo "Database $db_name backup complete." `date` >>$LOG done echo "pg_dump complete." `date` >>$LOG echo "Delete expired pgdmp file start." `date` >>$LOG find $BACKUPDIR -type f -daystart -mtime +$EXPIRE_DAY |xargs /bin/rm -f echo "Delete expired pgdmp file complete." `date` >>$LOG echo "Vacuum database $db_name start." `date` >>$LOG /usr/lib/postgresql/bin/vacuumdb $db_name -f -z echo "Vacuum database $db_name complete."`date` >> $LOG
/etc/rc.confにpostgresql_enable="YES"を追加する。
tmkbsd# /usr/local/etc/rc.d/010.pgsql.sh initdb The files belonging to this database system will be owned by user "pgsql". This user must also own the server process. The database cluster will be initialized with locale C. creating directory /usr/local/pgsql/data ... ok creating directory /usr/local/pgsql/data/global ... ok creating directory /usr/local/pgsql/data/pg_xlog ... ok creating directory /usr/local/pgsql/data/pg_xlog/archive_status ... ok creating directory /usr/local/pgsql/data/pg_clog ... ok creating directory /usr/local/pgsql/data/pg_subtrans ... ok creating directory /usr/local/pgsql/data/base ... ok creating directory /usr/local/pgsql/data/base/1 ... ok creating directory /usr/local/pgsql/data/pg_tblspc ... ok selecting default max_connections ... 40 selecting default shared_buffers ... 1000 creating configuration files ... ok creating template1 database in /usr/local/pgsql/data/base/1 ... ok initializing pg_shadow ... ok enabling unlimited row size for system tables ... ok initializing pg_depend ... ok creating system views ... ok loading pg_description ... ok creating conversions ... ok setting privileges on built-in objects ... ok creating information schema ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the -A option the next time you run initdb. Success. You can now start the database server using: /usr/local/bin/postmaster -D /usr/local/pgsql/data or /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
でインストールは完了。
Vancouverで職探し
1月一杯で現在のクライアントとの契約が切れてしまうので職探しの開始。
とりあえず
- http://www.workopolis.com/index.htmlと
- Find Jobs. Build a Better Career. Find Your Calling | Monster.ca | Monster.caには登録し、monster.caにはResumeを登録。
- http://www.jobbank.gc.ca/Search_en.aspと
- http://www.bcjobs.ca/index.cfmもチェック。
誰か仕事下さい。