Apache Tomcat, release 5.5.23 running on Java SDK version 6.
A solution to use EJBs in the J2EE Public Service is to use OpenEJB. It is a project developed by the Apache Software Foundation which allows to use EJBs with Tomcat server (Tomcat 5 or 6 ). For more information, please visit the project website OpenEJB.
- Make sure you have a JDK 6 installed on your PC; if you don't, then download it from here(click "download JDK 6" ) and install it.
- Make sure that JAVA_HOME environment variable points to your JDK 6 installation.
- Download the container from here: jps-tomcat-5.5.23-oracle-jdbc-10.2.0.3.zip.
- Unzip it to a folder of your choice, this folder will be referred to as $CATALINA_HOME.
- Use:
$CATALINA_HOME\bin\catalina.bat start -security
or (depending on your operating system):
$CATALINA_HOME\bin\catalina.sh start -security
to start tomcat - Simply copy your web application archive (.war) file to $CATALINA_HOME/webapps directory to deploy your application
- Make sure you have a JDK 6 installed on your PC; if you don't, then download it from here(click "download JDK 6" ) and install it.
- Make sure that JAVA_HOME environment variable points to your JDK 6 installation.
- Download the container from here: apache-tomcat-6.0.18-oracle-jdbc-10.2.0.3.zip.
- Unzip it to a folder of your choice, this folder will be referred to as $CATALINA_HOME.
- Use:
$CATALINA_HOME\bin\catalina.bat start -security
or (depending on your operating system):
$CATALINA_HOME\bin\catalina.sh start -security
to start tomcat - Simply copy your web application archive (.war) file to $CATALINA_HOME/webapps directory to deploy your application
java.io.File tempFile = java.io.File.createTempFile("test",".tmp"); tempFile.deleteOnExit();
If you have any further doubts, consult the API.
- Basic runtime classes provided by the Java Virtual Machine, version 6
- Libraries which come with Apache Tomcat, release 5.5.23:
- commons-el.jar - Jakarta commons el, implementing the expression language used by Jasper.
- jasper-compiler.jar - The JSP 2.0 compiler.
- jasper-compiler-jdt.jar - The Eclipse JDT Java compiler.
- jasper-runtime.jar - The JSP 2.0 runtime.
- jsp-api.jar - The JSP 2.0 API.
- naming-factory.jar - The JNDI implementation used by Tomcat 5 to resolve references to enterprise resources (EJB, connection pools).
- naming-factory-dbcp.jar - Jakarta commons DBCP, providing a JDBC connection pool to web applications. The classes have been moved out of their default org.apache.commons package.
- naming-resources.jar - The specialized JNDI naming context implementation used to represent the static resources of a web application. This is not related to the support of the J2EE ENC, and cannot be removed.
- servlet-api.jar - The Servlet 2.4 API. servlet-api.jar
- Oracle drivers, version 10.2.0.3:
- ojdbc14.jar
- orai18n.jar
- You're not closing your Connection objects.
- You're not closing your ResultSet, Statement, PreparedStatement or CallableStatement objects.
- The connection in the pool gets broken.
Number 1 will block your application, as you reach the maximum number of connections. Therefore, i'ts very important to close the Connection objects, because only then are they returned to the pool and can be reused by your application.
Number 2 makes cursors stay on the database side, which will block the entire database, when the cursor limit is hit.
There are two useful tools that let you investigate the problems on the database side:http://service-oracle.web.cern.ch/service-oracle/help/session-manager.php and ViewDB. Use them to get a hint of a forgotten Connection/Statement/Resultset and/or review your code to fix the problem.
You can also use the following DBCP parameters to make let DBCP recover these abandoned connections (see below for more on DBCP parameters):
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
Number 3 is more tricky, as there can be many reasons for the connection to be broken. The symptoms are the following: you sometimes get a database error, but when you click "refresh" the error is gone.
The solution here is to configure connection pool in such a way that it checks the connection before it's used. We're recommending use of Apache Jakarta Commons DBCP, as explainedhere. Normally, setting the following DBCP parameters fixes the problem:
testOnBorrow="true"
validationQuery="select sysdate from dual"
If these settings are not optimal for you, please check DBCP parameter documentation to choose best settings for your scenario.
We provide you two solutions depending on your requirements:
1._ DFS library: On demand (J2EE Public Service Support), we provide you a library that uses WebDAV to connect the Distributed File System (DFS). The limitation of this solution is that the source code of your java webapplication will have to be modified in order to use use this library.
2._ AFS repository: An AFS repository will be assigned to your webapplication. This AFS repository is a directory where you can store your data files and configure your webapplication to access to it as part of the file system. For more information, consult Using AFS as permanent storage solution .
No comments:
Post a Comment