low level programmer

« EJB3 - Session bean | Main | Seam - 簡單使用Seam的EL »
星期三 七月 09, 2008

Seam - 用Seam gen建立環境

description

電腦從Vista換成XP, Seam的環境沒了, 順便紀錄一下Seam是怎麼把環境建起來的. 這很簡單.

reference

Seam in Action - CH2

steps

  • 下載JBoss Application Server
  • 下載JBoss Seam
  • 解壓縮JBoss AS到C:/JBoss/jboss-4.2.0.GA (任意資料夾吧)
  • 解壓縮JBoss Seam到另一個資料夾
  • 因為我用derby, 所以把derbyclient.jar複製到JBoss Seam資料夾的/lib下
  • 用cmd到JBoss Seam的資料夾下
  • 執行 seam setup, 這個動作產生build file讓你以後能起始在這設定的專案
    C:\Isaac\projects\lib\jboss-seam-2.0.2.SP1>seam setup
    Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.6.0_06\lib\tools.jar
    Buildfile: C:\Isaac\projects\lib\jboss-seam-2.0.2.SP1\seam-gen\build.xml
    
    init:
    
    setup:
         [echo] Welcome to seam-gen :-)
        [input] Enter your Java project workspace (the directory that contains your Seam projects) [C:/Projects] [C:/Projects]
    C:/Isaac/projects
        [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.2.GA] [C:/Program Files/jboss-4.2.2.GA]
    C:\JBoss\jboss-4.2.0.GA
        [input] Enter the project name [myproject] [myproject]
    TestSeam
         [echo] Accepted project name as: TestSeam
        [input] Do you want to use ICEFaces instead of RichFaces [n] (y, [n])
    
        [input] skipping input as property icefaces.home.new has already been set.
        [input] Select a RichFaces skin [blueSky] ([blueSky], classic, ruby, wine, deepMarine, emeraldTown, sakura, DEFAULT)
    
        [input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support) [ear] ([ear], war)
    war
        [input] Enter the Java package name for your session beans [com.mydomain.TestSeam] [com.mydomain.TestSeam]
    
        [input] Enter the Java package name for your entity beans [com.mydomain.TestSeam] [com.mydomain.TestSeam]
    
        [input] Enter the Java package name for your test cases [com.mydomain.TestSeam.test] [com.mydomain.TestSeam.test]
    
        [input] What kind of database are you using? [hsql] ([hsql], mysql, oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
    enterprisedb 
        [input] Enter the Hibernate dialect for your database [org.hibernate.dialect.PostgreSQLDialect] [org.hibernate.dialect.PostgreSQLDialect]
    org.hibernate.dialect.DerbyDialect
        [input] Enter the filesystem path to the JDBC driver jar [../lib/hsqldb.jar] [../lib/hsqldb.jar]
    ../lib/derbyclient.jar
        [input] Enter JDBC driver class for your database [com.edb.Driver] [com.edb.Driver]
    org.apache.derby.jdbc.ClientDriver
        [input] Enter the JDBC URL for your database [jdbc:edb://localhost:5444/edb] [jdbc:edb://localhost:5444/edb]
    jdbc:derby://localhost:1527/testseam
        [input] Enter database username [sa] [sa]
    testseam
        [input] Enter database password [] []
    testseam
        [input] Enter the database schema name (it is OK to leave this blank) [] []
    
        [input] Enter the database catalog name (it is OK to leave this blank) [] []
    
        [input] Are you working with tables that already exist in the database? [n] (y, [n])
    
        [input] Do you want to drop and recreate the database tables and data in import.sql each time you deploy? [n] (y, [n])
    
    [propertyfile] Creating new property file: C:\Isaac\projects\lib\jboss-seam-2.0.2.SP1\seam-gen\build.properties
         [echo] Installing JDBC driver jar to JBoss server
         [copy] Copying 1 file to C:\JBoss\jboss-4.2.0.GA\server\default\lib
         [echo] Type 'seam create-project' to create the new project
    
    BUILD SUCCESSFUL
    Total time: 2 minutes 32 seconds    
        
  • 執行 seam create-project, 這個動作會建立一個專案在剛指定的專案目錄下並複製剛指定的driver jar檔到JBoss AS.
  • 這樣專案就建完了, 你可以在JBoss Seam資料夾下執行 seam explode 或到你的專案下執行 ant explode 把Seam專案部署到JBoss.
  • 到JBoss AS的bin資料夾下執行run, 再用http://localhost:8080/TestSeam就可以看到Seam專案的畫面, Seam環境就算部署完了,
  • 迴響:

    發表迴響:
    • HTML 語法: 關閉