Wednesday Nov 20, 2013

How-To: Deploy CMSDK on Tomcat

Although there are ways to run CMSDK 9.0.4.6 in a standalone JVM, when you need to use the WebDAV protocol to access documents in the CMSDK repository you can’t avoid deploying it into at least a web container.

WebLogic Server or GlassFish Server are one choice, but even Tomcat can be used to host the CMSDK Node that provides the CMSDK protocol servers along with other processes.

When you need to set up a data source on Tomcat the official documentation gives an example like this:


<Resource name="jdbc/OracleDS" auth="Container"
  type="javax.sql.DataSource"  
  driverClassName="oracle.jdbc.OracleDriver"
  url="jdbc:oracle:thin:@myhost.oracle.com:1521:orcl"
  username="cmsdk" password="****" maxActive="20" maxIdle="10"
  maxWait="-1"/>

Unfortunately, when using this data source definition you will see the following exception and the Node won’t come up.

java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.DelegatingCallableStatement cannot be cast to oracle.jdbc.OracleCallableStatement

Whereas in other container configurations (such as in WLS and GlassFish) we can specifically disable the JDBC data type wrapping, this isn’t the case in Tomcat. In Tomcat we need to change the definition of the data source to this, to get the Node started and the defaults overwritten:

<Resource name="jdbc/OracleDS" auth="Container"
  type="oracle.jdbc.pool.OracleDataSource"
  factory="oracle.jdbc.pool.OracleDataSourceFactory"
  connectionCachingEnabled="true"
  user="cmsdk" password="****"
  driverClassName="oracle.jdbc.OracleDriver"
  url="jdbc:oracle:thin:@myhost.oracle.com:1521:orcl"
  removeAbandoned="true"
  removeAbandonedTimeout="30"
  maxActive="20"
  maxIdle="10" maxwait="-1"/>


In addition to the above, you need to change the data source name attribute in the web.xml of the cmsdk.ear file, as Tomcat places all configured entries and resources in the java:comp/env portion of the JNDI namespace which is different from what most other containers are doing.
The modified data source name in the CMSDK web.xml for Tomcat should look like this:


<context-param>
  <description>The name of the DataSource for the CMSDK repository</description>
  <param-name>IFS.NODE.DataSourceName</param-name>
  <param-value>java:/comp/env/jdbc/OracleDS</param-value>
</context-param>


About

My name is Frank Closheim. I lead Development for CMSDK at Oracle and want to share the latest news, best practices, examples and product updates about CMSDK with the Blogsphere.

Search

Archives
« November 2013 »
SunMonTueWedThuFriSat
     
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
29
30
       
Today