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 6 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 explain how to configure AppFuse so that the applications it generates will work with an Oracle database.
At line 3 changed 11 lines.
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: -
{{{
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 the Oracle Database schema account that will hold the default application tables. This can be done by your Oracle DBA. (You can choose a different user (schema) name and password, just modify the subsequent instructions accordingly.)
At line 15 changed 1 line.
-------------------------------
CREATE USER APPFUSE IDENTIFIED BY APPFUSE;
GRANT CONNECT TO APPFUSE;
GRANT RESOURCE TO APPFUSE;
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.
__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.
At line 21 changed 1 line.
2. You could make sure users set up %CATALINA_HOME% in their system env.
# In your {AppFuse home}/lib directory, add an "oracle" directory and place the ojdbc14.jar in it.
At line 23 changed 2 lines.
3. You could tell users to use JDK 1.4.1 (or is every one there
already?!?)
# Next, the build.properties file needs to be updated to switch from a MySQL to an Oracle database. This can be done in two ways:
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.
## If most of your work is in Oracle, update the build.properties file in the
AppFuse distribution. Most of its values will carry over to the build.properties
file created within each app generated by AppFuse, so only a minor amount of editing
of that second file will be necessary.
At line 28 changed 1 line.
5. I ran "ant test-ejb -Dtestcase=UserDaoTest". There's good & bad news.
## If most of your work is not in Oracle, you can ignore the build.properties file
in the AppFuse distribution, and just edit the build.properties in the directory of the
web app generated by AppFuse.
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.
Whether you edit one or both files, 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 changed 1 line.
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!!
{{
database.jar=${lib.dir}/oracle/ojdbc14.jar
database.type=oracle
database.name=appfuse
database.host=localhost
#database URL for creating other databases (doesn't work with pgsql)
#database.admin.url=jdbc:${database.type}://${database.host}/template1
database.admin.username=appfuse
database.admin.password=appfuse
At line 34 changed 16 lines.
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: -
{{{
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"));
}
}}}
This is changed because 'savedUser' seem to be null after the previous test method has completed :)
hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
database.driver_class=oracle.jdbc.driver.OracleDriver
database.url=jdbc:oracle:thin:@localhost:1521:myDB
database.username=appfuse
database.password=appfuse
}}
At line 51 changed 1 line.
Unknown Exception (when one run for the first time at one goal) : -
__NOTE__: In the listings above, database.host should refer to the machine the Oracle database is running on. Also, database.url's "myDB" at the end should refer to the SERVICE_NAME within the tnsnames.ora database file
on the database server machine.
At line 53 changed 3 lines.
{{{
[junit] ERROR [main] JDBCExceptionReporter.logExceptions(44) | ORA-00001:
unique constraint (SEE.SYS_C005336) violated
# Run "ant new -Dapp.name=myappname -Ddb.name=appfuse" as normal to generate your new web application directory.
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
# Reconfigure the build.properties file in the new "myappname" directory, following the instructions above. You will either need to update a few of the elements or all of them, depending on whether or not you decided to modify the main build.properties in the AppFuse distribution.
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)}}}
# Run "ant setup" within your new web app directory to compile and deploy your new application on Tomcat.
At line 86 changed 1 line.
''-- Simon See''
# Start tomcat and bring up the application: http://localhost:8080/myappname
__Note__ The Oracle database server may be configured to occupy port 8080 with its own servlet container. This may cause port conflicts if you are running Tomcat on the same machine. It is very difficult to turn off the Oracle container (I was not successful in doing so.) If you run into this problem, best to shut off the Oracle instance, start Tomcat (so it will occupy port 8080), and then restart the Oracle database.
# 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 "appfuse" user 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.