天天看点

OpenJPA - 筆記

1. 相關介紹

在Java EE 環境下開發部署OpenJPA 運用

OpenJPA成為Apache頂級項目

2. 官方網站

Apache OpenJPA

Apache Geronimo

3. 安裝Geronimo Server在上Eclipse上 (Geronimo 入門 )

有兩種方式,一是使用Update Site的方式,一種是在Server的地方Download,我是用第二種方式。

4. tutorial

在建立專案之前不要先行建立 Geronimo server runtime,而是在建立專案時再一並建立!

Open JPA Basic Sample and tutorial

5. 啟動server

在Geronimo server安裝目錄/bin下執行指令

start-server      

6. 進入管理畫面

在Browser進入http://localhost:8080/console ,預設的管理帳號為system/manager

Error:

按著Open JPA Basic Sample and tutorial到最後卻發生了不明的錯誤

org.apache.jasper.JasperException: <openjpa-1.2.2-r422266:898935 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-1.2.2-r422266:898935 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "org.apache.derby.jdbc.ClientDriver" and URL "jdbc:derby://localhost:1527/StoreSystem".  You may have specified an invalid URL.

看起來應該是classpath缺少了derby的jar檔設定,後來在

https://cwiki.apache.org/GMOxDOC22/migrating-from-tomcat-to-geronimo.html#MigratingfromTomcattoGeronimo-TomcatandApacheDerby

看到

For Tomcat to work with Apache Derby you must download Apache Derby and configure environment variables like DERBY_INSTALL, and make sure that the following jars are in the classpath:

    lib/derby.jar

    lib/derbytools.jar

    lib/derbynet.jar

    lib/derbyclient.jar

    To execute a sql command you have to use ij scipt which comes packaged with Apache Derby.

===============================================================

Spring3(MVC)+OpenJPA2構建及發佈