Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
AppFuseSupport
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh
IntegratingJBPMIntoA...
StrutsResumeSupport




JSPWiki v2.2.33

[RSS]


Hide Menu

RunningOnOracle


Difference between version 50 and version 5:

At line 1 changed 1 line.
More attempts....and it seems the Oracle DB related portion is completed with success.
The following instructions describe the steps needed to configure AppFuse so that the applications it generates will work with an Oracle database.
At line 3 changed 1 line.
Do remember to change your classes12.zip to classes12.jar. Just do a rename at TOMCAT/common/lib folder. Else you would get similar exception upon Tomcat startup: -
!Table of Contents
* [1] Create Database Schema
* [2] Setup JDBC Driver
* [3] Edit build.properties in the main AppFuse Directory
* [4] Generate Application
* [5] Deploy Application
* [6] Test Database Access
!!Create Database Schema [#1]
Create the Oracle Database schema account that will hold your application's tables. This value should correspond to the {{-Ddb.name}} you use when running the __ant new__ task.
At line 5 changed 8 lines.
WARN [main] JDBCExceptionReporter.logExceptions(36) | SQL Error: 0, SQLState: null
ERROR [main] JDBCExceptionReporter.logExceptions(44) | Cannot load JDBC driver class 'null'
WARN [main] SessionFactoryImpl.<init>(169) | Could not obtain connection metadata
java.sql.SQLException: Cannot load JDBC driver class 'null'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(
DatasourceConnectionProvider.java:59)
CREATE USER <database-schema-owner> IDENTIFIED BY <password>;
GRANT CONNECT TO <database-schema-owner>;
GRANT RESOURCE TO <database-schema-owner>;
At line 15 changed 1 line.
-------------------------------
!!Setup JDBC Driver [#2]
At line 17 changed 1 line.
Here is some build feedback for 0.7 struts-resume.
Obtain the [Oracle JDBC driver|http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html] appropriate for your database and JDK version. (Oracle's license agreement will be shown just be downloading, make sure you read and understand it.)
At line 19 changed 1 line.
1. I think it's best you recommend user to configure %J2EE_HOME% as by placing the jar alone in your lib folder causes exceptions. For some reason, it tries to access %J2EE_HOME%/config/*.properties files.
<div class="note" style="margin: 10px">__NOTE:__ According to the [Oracle JDBC Driver README | http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_readme9201.html], classes12.jar is for JDK1.2 & 1.3, ojdbc14.jar is for JDK 1.4. The instructions here assume you will be using ojdbc14.jar, modify the instructions below accordingly if otherwise.</div>
At line 21 changed 1 line.
2. You could make sure users set up %CATALINA_HOME% in their system env.
Next, in your {AppFuse home}/lib directory, add an "oracle" directory and place the ojdbc14.jar in it.
At line 23 removed 2 lines.
3. You could tell users to use JDK 1.4.1 (or is every one there
already?!?)
At line 26 changed 1 line.
4. It seems my Ant 1.5.3-1 is not able to run our target "new". It complains about some regular expression exceptions, etc. I've to comment that target out.
!!Edit build.properties in the main AppFuse Directory [#3]
At line 28 changed 1 line.
5. I ran "ant test-ejb -Dtestcase=UserDaoTest". There's good & bad news.
Next, the build.properties file needs to be updated to use an Oracle (instead of the default MySQL) database.
At line 30 changed 1 line.
The good news is, if I run method by method instead of running all the test methods at one goal, the build passes.
Here is a idea of what the database entries should look like for Oracle (modify the various fields as appropriate for your system):
At line 32 removed 3 lines.
However, if I run all the test methods at one goal (after re-executing "ant setup-db"), I've got the following exceptions below. Not sure why. If I re-run them again, the build passes!!
On reviewing your test methods, it seems the test methods has slight dependency on each other. And for some, it seems to be never going to pass like for example the test method: -
At line 36 changed 12 lines.
public void testAddUser() throws Exception {
// Deleted by Simon
//user = savedUser;
//Modified by Simon
user = dao.getUser(ses, "mraible");
user.setPostalCode("123");
user = dao.saveUser(ses, user);
user = dao.getUser(ses, "mraible");
assertTrue(user.getId() != null &&
user.getPostalCode().equals("123"));
}
database.jar=${lib.dir}/oracle/ojdbc14.jar
database.type=oracle
database.host=localhost
#use the database schema owner and password created in step #1 above here
database.username=username
database.password=password
database.schema=schemaname (case sensitive using 10g)
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
database.driver_class=oracle.jdbc.driver.OracleDriver
database.url=jdbc:oracle:thin:@localhost:1521:mySID
At line 49 removed 1 line.
This is changed because 'savedUser' seem to be null after the previous test method has completed :)
At line 51 changed 1 line.
Unknown Exception (when one run for the first time at one goal) : -
You'll also need to add the "database.schema" property to build.xml - in the &lt;dbunit&gt; tasks. For example:
At line 54 changed 2 lines.
[junit] ERROR [main] JDBCExceptionReporter.logExceptions(44) | ORA-00001:
unique constraint (SEE.SYS_C005336) violated
<dbunit driver="${database.driver_class}" schema="${database.schema}"
supportBatchStatement="false" url="${database.url}"
userid="${database.username}" password="${database.password}">
}}}
At line 57 changed 3 lines.
[junit] ERROR [main] JDBCException.<init>(36) | Could not synchronize
database state with session [junit] java.sql.BatchUpdateException: ORA-00001:
unique constraint (SEE.SYS_C005336) violated
<div class="note" style="margin: 10px; background-color: #fcc">__WARNING:__ Avoid the use of "appfuse" as values for any of the parameters here. They may end up getting modified when you run the "ant new" task below.</div>
At line 61 changed 24 lines.
[junit] at
oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
[junit] at
oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedState
ment.java:3907)
[junit] at
net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:5
0)
[junit] at
net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:81)
[junit] at
net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:1936)
[junit] at
net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:1905)
[junit] at
net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:1849)
[junit] at
org.appfuse.persistence.BaseDaoHibernate.storeObject(BaseDAOHibernate.java:
122)
[junit] at
org.appfuse.persistence.UserDAOHibernate.addResume(UserDAOHibernate.java:10
2)
[junit] at
org.appfuse.persistence.UserDaoTest.testAddResume(UserDAOTest.java:109)}}}
<div class="note" style="margin: 10px">__NOTE:__ In the listings above, {{database.host}} should refer to the machine the Oracle database is running on. Also, the "mySID" at the end of the {{database.url}} value should refer to the SERVICE_NAME within the tnsnames.ora database file on the database server machine.</div>
At line 86 changed 1 line.
''-- Simon See''
<div class="note" style="margin: 10px">__NOTE:__ There is also a {{database.name}} parameter available, but you should only add it to {{build.properties}} if you want to use a different database name than provided in the {{-Ddb.name}} parameter when you ran the __ant new__ task.</div>
!!Generate Application [#4]
Run __ant new -Dapp.name={{myappname}} -Ddb.name={{mydbname}}__ as usual to generate the new web application directory.
For {{mydbname}}, use the schema owner name you created in Step #1 above.
!!Deploy Application [#5]
Run "ant setup" within your new web app directory to compile and deploy your new application on Tomcat.
Next, Start Tomcat and bring up the application: http://localhost:8080/myappname
<div class="note" style="margin: 10px">
__NOTE:__ The Oracle database server may be configured to occupy port 8080 with its own servlet container, which you may find very difficult to disable. This can cause port conflicts if you are running Tomcat on the same machine. If this problem occurs, it may be easiest to shut down the Oracle database, start Tomcat (so it will occupy port 8080), and then restart Oracle.
</div>
!!Test Database Access [#6]
To test that database accesses are working properly, edit one of the profiles within the sample application and change the country listed. Then, within Oracle SQL*Plus, log in as the schema owner and issue this command:
{{{
select username, country from app_user;
}}}
If everything is working correctly, you should see that the country value has changed for the profile that you edited.

Back to RunningOnOracle, or to the Page History.