Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Info

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:

{toc:minLevel=3|maxLevel=3}

Panel
Wiki Markup
Table of Contents
maxLevel3
minLevel3
h3. *Converting an OC4J WAR application to a Tomcat 7 WAR application* {warning} 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.* {warning} # 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: {code}
  1. Run Eclipse and open the Maven project that you want to convert to a Tomcat 7 application.
  2. 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:

Panel

Converting an OC4J WAR application to a Tomcat 7 WAR application

Warning

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.

Panel
Wiki Markup
Code Block
  1. <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>
    
{code}
  1. In

  1. each

  1. of

  1. the

  1. <pattern>

  1. tags,

  1. remove

  1. the

  1. leading

*
  1. /*

\
  1. *

\*
  1. so

  1. that

  1. the

  1. above

  1. now

  1. looks

  1. similar

  1. to

  1. the

  1. following:

{
  1. Code Block
}
  1. <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>
    
{code}
  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Open

  1. your

  1. project's

  1. applicationContext

  1. xml

  1. that

  1. contains

  1. the

*
  1. mitsisDataSource

  1. bean

*.&nbsp;&nbsp;The *mitsisDataSource bean* should look similar to: {code}
  1. .  The mitsisDataSource beanshould look similar to:

    Code Block
    <bean id="mitsisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="jdbc/MitsisDS" />
    </bean>
    
{code}
  1. Remember

  1. the

  1. value

  1. of

  1. the

*
  1. name

*
  1. property.

&nbsp;&nbsp;In this example the value is *
  1.   In this example the value is jdbc/MitsisDS

*
  1. (the

  1. default

  1. for

  1. most

  1. ES

  1. web

  1. apps).

&nbsp;&nbsp;This value will be the *Resource Definition name* used throughout the remainder of this page. Add a new property, *resourceRef*,to the bean definition: {code}
  1.   This value will be the Resource Definition name used throughout the remainder of this page.
    Add a new property, resourceRef,to the bean definition:

    Code Block
    <bean id="mitsisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName" value="jdbc/MitsisDS" />
       <property name="resourceRef" value="true" />
    </bean>
    
{code}
  1. Don't

  1. forget

  1. to

  1. use

  1. your

*
  1. Resource

  1. Definition

  1. name

*
  1. in

  1. place

  1. of

*
  1. jdbc/MitsisDS

*
  1. .


  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Open

  1. your

  1. project's

*
  1. log4j.xml

*
  1. for

  1. editing

  1. and

  1. find

  1. the

  1. 2

  1. lines

  1. similar

  1. to

  1. the

  1. following

  1. (

*
  1. att

*
  1. is

  1. the

  1. project's

  1. application

  1. context

  1. root):

{
  1. Code Block
}
  1. <param name="File" value="log/att.log" />
    <param name="File" value="log/hbn-att.log" />
    
{code}
  1. and

  1. change

  1. them

  1. to:

{
  1. Code Block
}
  1. <param name="File" value="${logs.dir}/att/att.log" />
    <param name="File" value="${logs.dir}/att/hbn-att.log" />
    
{code}
  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Open

  1. your

  1. project's

  1. web.xml

  1. for

  1. editing

  1. and

  1. add

  1. the

  1. following

  1. after

  1. the

  1. <servlet-mapping>

  1. tags

  1. and

  1. before

  1. the

  1. <welcome-file-list>

  1. tag.

{
  1. Code Block
}
  1. <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>
    
{code}
  1. Don't

  1. forget

  1. to

  1. use

  1. your

*
  1. Resource

  1. Definition

  1. name

*
  1. in

  1. place

  1. of

*
  1. jdbc/MitsisDS

*
  1. .


  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Open

  1. your

  1. Tomcat

  1. 7

  1. server's

  1. context.xml,

  1. located

  1. at

  1. $

\
  1. {CATALINA_HOME}/conf/context.xml,

  1. and

  1. verify

  1. that

  1. a

*
  1. Resource

  1. Definition

*
  1. for

  1. your

  1. application

  1. exists.


  1. If

  1. the

  1. Resource

  1. Definition

  1. does

  1. not

  1. exits,

  1. add

  1. the

  1. following

  1. anywhere

  1. between

  1. the

  1. <context>

  1. and

  1. </context>

  1. tags:

{
  1. Code Block
}
  1. <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"/>
    
{code}
  1. Don't

  1. forget

  1. to

  1. use

  1. your

*
  1. Resource

  1. Definition

  1. name

*
  1. in

  1. place

  1. of

*
  1. jdbc/MitsisDS

*
  1. .


  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Open

  1. the

  1. project's

  1. pom.xml

  1. and

  1. delete

  1. the

  1. following

  1. dependency:

{
  1. Code Block
}
  1. <dependency>
        <groupId>oracle</groupId>
        <artifactId>ojdbc</artifactId>
        <version>1.4</version>
        <scope>test</scope>
    </dependency>
    
{code}
  1. and

  1. add

  1. the

  1. following

  1. dependency:

{
  1. Code Block
}
  1. <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3</version>
        <scope>test</scope>
    </dependency>
    
{code}
  1. When

  1. you

  1. are

  1. satisfied

  1. that

  1. everything

  1. is

  1. correct,

*
  1. save

*
  1. the

  1. changes.

#
  1. Search
  1. both
  1. Project
  1. Jar
  1. Dependencies
  1. and
  1. Project
  1. Test
  1. Jar
  1. Dependencies
  1. for
  1. any
  1. ojdbc-1.4.jar
  1. dependency
  1. and
  1. exclude
  1. the
  1. dependency.

  1. In
  1. Eclipse,
  1. this
  1. can
  1. be
  1. done
  1. by
  1. doing
  1. the
  1. following:
##
    1. Open
    1. a
*
    1. Project
    1. Explorer
    1. View
*
    1. ,
    1. right
    1. click
    1. on
    1. your
    1. project
    1. and
    1. select
*
    1. Maven
    1. >
    1. Update
    1. Dependencies...
* ## Expand *Maven Dependencies* and scroll through the dependencies until you find the
    1. Expand Maven Dependencies and scroll through the dependencies until you find the ojdbc-1.4.jar.
##
    1. Right
    1. click
    1. on
    1. the
    1. ojdbc-1.4.jar
    1. and
    1. select
*
    1. Maven
    1. >
    1. Exlude
    1. Maven
Artifact...*
    1. Artifact...
  1. Update APPLICATION_NAME.properties (following is for assignsupervisor property file located at:  /private/var/local/etc/assignsupervisor/assignsupervisor.properties)
    supervasgn.url=https://registration-qa-mit-edu.ezproxyberklee.flo.org/advisorasgn
    supervasgn.view.on.websis.date=06/09/2011
    pdf.baseUrl=http://registration.mit.edu.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}
  2. 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>

  3. 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;

     

        };