Help is available by sending an email to csf-support@mit.edu
Have any suggestion on how improve this wiki? Please give us your feedback at csf-support@mit.edu
Quick Links to:
Converting an OC4J WAR application to a Tomcat 7 WAR application
Any Maven project who's artifact is a JAR is Tomcat 7 compatible and no conversion is required.
The following instructions are for Maven project who's artifact is a WAR. These instructions should make a web application run either in Tomcat 7 or OC4J.
- Run Eclipse and open the Maven project that you want to convert to a Tomcat 7 application.
Open your project's decorators.xml file for editing. The decorators.xml file is located in your project's WEB-INF directory.
Your decorator.xml should look similar to the following:<decorators defaultdir="/WEB-INF/decorators"> <decorator name="ajax" page="ajax.jsp"> <pattern>/**/ajax/*</pattern> </decorator> <decorator name="ssb" page="ssb.jsp"> <pattern>/**/*</pattern> </decorator> </decorators>
In each of the <pattern> tags, remove the leading /** so that the above now looks similar to the following:
<decorators defaultdir="/WEB-INF/decorators"> <decorator name="ajax" page="ajax.jsp"> <pattern>/*ajax*</pattern> </decorator> <decorator name="ssb" page="ssb.jsp"> <pattern>/*</pattern> </decorator> </decorators>
When you are satisfied that everything is correct, save the changes.
Open your project's applicationContext xml that contains the mitsisDataSource bean. The mitsisDataSource beanshould look similar to:
<bean id="mitsisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/MitsisDS" /> </bean>
Remember the value of the name property. In this example the value is jdbc/MitsisDS (the default for most ES web apps). This value will be the Resource Definition name used throughout the remainder of this page.
Add a new property, resourceRef,to the bean definition:<bean id="mitsisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/MitsisDS" /> <property name="resourceRef" value="true" /> </bean>
Don't forget to use your Resource Definition name in place of jdbc/MitsisDS.
When you are satisfied that everything is correct, save the changes.Open your project's log4j.xml for editing and find the 2 lines similar to the following (attis the project's application context root):
<param name="File" value="log/att.log" /> <param name="File" value="log/hbn-att.log" />
and change them to:
<param name="File" value="${logs.dir}/att/att.log" /> <param name="File" value="${logs.dir}/att/hbn-att.log" />
When you are satisfied that everything is correct, save the changes.
Open your project's web.xml for editing and add the following after the <servlet-mapping> tags and before the <welcome-file-list> tag.
<resource-ref> <description>Oracle Datasource</description> <res-ref-name>jdbc/MitsisDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Don't forget to use your Resource Definition name in place of jdbc/MitsisDS.
When you are satisfied that everything is correct, save the changes.Open your Tomcat 7 server's context.xml, located at ${CATALINA_HOME}/conf/context.xml, and verify that a Resource Definition for your application exists.
If the Resource Definition does not exits, add the following anywhere between the <context> and </context> tags:<Resource name="jdbc/MitsisDS" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@//earth-vault-2.mit.edu:1523/sundev11" username="XXXXXXXX" password="YYYYYYYY" maxActive="20" maxIdle="10" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="30" logAbandoned="true" /> <ResourceLink global="jdbc/MitsisDS" name="jdbc/MitsisDS" type="javax.sql.DataSource"/>
Don't forget to use your Resource Definition name in place of jdbc/MitsisDS.
When you are satisfied that everything is correct, save the changes.Open the project's pom.xml and delete the following dependency:
<dependency> <groupId>oracle</groupId> <artifactId>ojdbc</artifactId> <version>1.4</version> <scope>test</scope> </dependency>
and add the following dependency:
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.3</version> <scope>test</scope> </dependency>
When you are satisfied that everything is correct, save the changes.
- Search both Project Jar Dependencies and Project Test Jar Dependencies for any ojdbc-1.4.jar dependency and exclude the dependency.
In Eclipse, this can be done by doing the following:- Open a Project Explorer View, right click on your project and select Maven > Update Dependencies...
- Expand Maven Dependencies and scroll through the dependencies until you find the ojdbc-1.4.jar.
- Right click on the ojdbc-1.4.jar and select Maven > Exlude Maven Artifact...
- Update APPLICATION_NAME.properties (following is for assignsupervisor property file located at: /private/var/local/etc/assignsupervisor/assignsupervisor.properties)
supervasgn.url=https://mv-ezproxy-com.ezproxyberklee.flo.org/advisorasgn
supervasgn.view.on.websis.date=06/09/2011
pdf.baseUrl=http://mv.ezproxy.com.ezproxyberklee.flo.org/advisorasgn/
websis.url=student.mit.edu
###############
email.address.from=youremail@mit.edu
email.address.test.to=youremail@mit.edu
email.production.mode=false
###############
roles.function.category=REG
local.authentication=true
local.user.password=password
local.user.name=avsingh
local.mitroles=ADVISOR_ASSIGN
local.mitroles=ADVISOR_ASSIGN_REGISTRAR
local.mitroles=ADVISOR_ASSIGN_SUPERUSER
local.mitroles.domain=REG
import.upload.dir=${user.home} - Add highlighted tomcat plugin in pom.xml of maven project.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>${oc4j.j2eeHome}${file.separator}admin_client.jar</argument>
<argument>${oc4j.connectionUri}</argument>
<argument>${oc4j.username}</argument>
<argument>${oc4j.password}</argument>
<argument>-deploy</argument>
<argument>-file</argument>
<argument>${project.build.directory}${file.separator}${project.artifactId}-${project.version}.${project.packaging}</argument>
<argument>-deploymentName</argument>
<argument>${project.artifactId}</argument>
<argument>-bindAllWebApps</argument>
<argument>default-web-site</argument>
<argument>-contextRoot</argument>
<argument>${project.artifactId}</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<update>true</update>
<server>tomcatServer</server>
<username>${tomcat.username}</username>
<password>${tomcat.password}</password>
<url>${tomcat.url}</url>
<path>${tomcat.contextPath}</path>
</configuration>
</plugin>
<!-- java compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
TOMCAT CONFIGURATION FOR AUTHENTICATION
A) Update server.xml and tomcat-users.xml in <tomcat home>/conf/server.xml
Add the realm inside
<Realm className="org.apache.catalina.realm.LockOutRealm">.<Realm className="org.apache.catalina.realm.JAASRealm" appName="Tomcat"
userClassNames="javax.security.auth.kerberos.KerberosPrincipal" roleClassNames="javax.security.auth.kerberos.KerberosPrincipal" useContextClassLoader="true" debug="99"/>
B) In <tomcat home>/tomcat-users.xml
Add the role and user details under <tomcat-users>
<role rolename="users"/>
<user username="mayajose" password="password" roles="users"/>
C) Create a new file "jaas.config" in in <tomcat home>/conf folder with the below contents.
Tomcat {
com.sun.security.auth.module.Krb5LoginModule required;
};