IMPORTANT PRE-REQUISITES
1. Set up environment to compile and run the sample application
The following script must be run for each of the terminal session:
Windows: > quickstart/ttquickstartenv.bat Unix/Linux: $ . quickstart/ttquickstartenv.sh OR
$ source quickstart/ttquickstartenv.csh2. Set up sample database, user accounts and the TPTBM table
The following command should be run once to set up the sample database, user accounts and the TPTBM table.
Windows or Unix/Linux: > cd quickstart/sample_code/j2ee_orm
> ttIsql -connStr "DSN=sampledb_1122" -f tptbm.sql3. If necessary, install the Apache Ant build tool.
For each application server, an Ant build script is provided to configure, build and execute the application based on the properties of the applicaton server installation. The Apache Ant build tool has to be installed if not present.
After installation, make sure the Operating System environment variable PATH includes the path to the 'ant' executable.
The Ant build scripts have been tested with Apache Ant version 1.9.2.
CONFIGURE AND RUN
1. install WebLogic application server and configure build.properties
Install Oracle WebLogic Server 12.1 and then set the following properties in file quickstart/sample_code/j2ee_orm/build.properties:
weblogic.home.dir -- set this to the root installation directory of the local WebLogic server installation weblogic.domain.dir -- the location of the domain directory for the server hosting the TptbmAS application weblogic.deploy.dir -- the directory where application archives can be copied and auto deployed to the server weblogic.host -- the host name of the machine where the server is installed weblogic.port -- the RMI port number used by external clients to communicate with the server, the default port number is 7001Each Ant build script reads values from file quickstart/sample_code/j2ee_orm/build.properties. This file specifies the locations of build dependencies including the location of the application server installation. This file also specifies the common benchmark execution parameters.2. CLASSPATH
The server will require access to the TimesTen JDBC driver jar file. This can be done by setting the CLASSPATH environment variable to the location of the TimesTen JDBC driver jar file in the environment where the server starts. Alternatively, the WebLogic domain environment configuration script located at ${weblogic.domain.dir}/bin/setDomainEnv.sh (or setDomainEnv.cmd on Windows) can be used to set the CLASSPATH for the server.
3. LD_LIBRARY_PATH
The server will also need access to the TimesTen shared libraries. On Unix platforms this can be done by setting the LD_LIBRARY_PATH environment variable (or the equivalent variable for your OS) to the location of the TimesTen installation's lib directory. On Windows platforms the PATH environment variable should be set to the location of the installation's bin directory where TimesTen DLLs are located. Alternatively, the WebLogic domain environment configuration script located at ${weblogic.home.dir}/common/bin/setDomainEnv.sh (or setDomainEnv.cmd on Windows) can be used to set these variables for the server.
4. TimesTen Data Source
Before the demo can be deployed or executed, a TimesTen data source with the JNDI name of jdbc/TbtbmDS must be configured on the server. A sample data source configuration file is provided by the sample application at quickstart/sample_code/j2ee_orm/config/weblogic12/TptbmDS-jdbc.xml. This file can be copied to the ${weblogic.domain.dir}/config/jdbc directory. In order for the data source configuration to be read by the server the following section must be copied into the
section of the ${weblogic.domain.dir}/config/config.xml file: <jdbc-system-resource> <name>TptbmDS</name> <target>AdminServer</target> <descriptor-file-name>jdbc/TptbmDS-jdbc.xml</descriptor-file-name> </jdbc-system-resource>Note that 'AdminServer' should be replaced with the name of the target server in the configuration above.
The server should be restarted after these changes. The server will read the new configuration when it starts up and then add the data source to its JNDI tree.
5. build, deploy and run the sample application
After the server has been configured to use the jdbc/TbtbmDS data source and restarted, the application can be built, deployed, and executed, through Ant script build-weblogic12.xml, with this sequence of Ant tasks under directory quickstart/sample_code/j2ee_orm:
ant -f build-weblogic12.xml clean ant -f build-weblogic12.xml package ant -f build-weblogic12.xml deploy ant -f build-weblogic12.xml run
Note that this application has been tested with WebLogic 12.1.
TROUBLESHOOTING
- Make sure the TimesTen binary bit version (32-bit or 64-bit) is the same as the bit version of the Java binary used to start WebLogic Server. Otherwise you may get a similar error as the following:
"Problems with loading native library/missing methods: D:\TimesTen\tt1122_32\bin\ttJdbc1122.dll : Can't find dependent libraries"
- If the following error pops up in the step of "ant -f build-weblogic12.xml run",
[java] Exception Description: Cannot acquire data source [jdbc/TptbmDS].
Internal Exception: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.TptbmDS' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/TptbmDS'; nested exception is: javax.persistence.PersistenceExceptionfollow the steps below to solve the error:
- Manually uninstall the application from WebLogic Server by deleting the EJB jar file at ${weblogic.deploy.dir}/tptbmas-ejb3.jar
- Restart the WebLogic Server
- Deploy and run the application following step No.5 above (build, deploy and run the sample application)
For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.