• How to install the portal for development purposes

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

...

Quick

...

guide

...

to

...

getting

...

started

...

with

...

Java

...

portal

...

development

Basic outline of the steps

  1. Install Maven 2.0.6

...

  1. +
  2. Configure personal settings for Maven 2
  3. Install Eclipse and tools for Eclipse
  4. Install Tomcat 5.5+
  5. Configure personal settings for Tomcat
  6. Install Ant 1.7+
  7. Check out the source code from the code repository
  8. Install the Maven 2 dependencies into the local repository
  9. Create and initialize a working database
  10. Configure Tomcat server to run within Eclipse
  11. Basic commands for working with Tomcat running in Eclipse
  12. Basic commands for working with maven and tomcat from the command line
  13. Viewing the portal with the browser
  14. Useful debugging techniques
  15. Problems/solutions encountered while installing the platform
    Note
    titleImportant

    Please refer to Pas Portal programming practices for details about the coding standards that the project would like to practice in order to achieve a consistent and high quality code base.


Anchor
Step1

Install Maven 2.0.6+

Warning
titleWarning

We are not using the Eclipse plug-in for Maven due to problems experienced with other projects using this plug-in. Recommend that you use maven via the command line.


  1. Download Maven 2 from http://maven.apache.org/download.html

...

  1. .

...

  1. Unpack

...

  1. the

...

  1. downloaded

...

  1. distribution.

...

  1. Define

...

  1. a

...

  1. M2_HOME

...

  1. system

...

  1. variable.

...

  1. Add M2_HOME/bin

...

  1. to

...

  1. the

...

  1. system

...

  1. path.

...

:= }
Info
title
Mac
tip

For

Mac,

paste

this

into

your

~/.profile

file:

{

Code Block
:
xml
|
title
=
~/.profile
}

export M2_HOME="/Users/telsbot/apache-maven-2.2.1"  # change this to match your setting
export PATH=$M2_HOME/bin:$PATH
{code}

Then

run

source

command

to

read

in

the

changes

in

the

.profile:

{

Code Block
}

$ source ~/.profile
{code} {info} Here is a more detailed guide from the Maven 2 website [

Here is a more detailed guide from the Maven 2 website http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

...

.

...

Anchor

...

Step2

Configure personal settings for Maven 2

  1. Below is an example of some custom settings for Maven 2 specifically for my environment. This customization is done by adding a settings.xml file under the .m2 folder. In Unix like operating systems, .m2 is under your home folder. If you do not have the '.m2' directory you must create it using the following 2 commands:
  2. cd ~ // this command will change your directory to your home directory
  3. mkdir .m2 // this command will create the .m2 directory for you.
  4. These settings must match to your particular environment.
  5. Under the <server> element, you must specify the same <username> and <password> for your tomcat manager (which is detailed in a later step, pick something you wish to use).
    Warning
    titleWarning

    Do not change the value of the <id> element, it must be myserver.

    Anchor
    jdbc_file
  6. Under the <jdbc.url> element, you must specify a file path where your sail database file will reside. In the example, it is set to my home_folder/tomcat/db/

...

  1. directory

...

  1. and

...

  1. sail_database

...

  1. as

...

  1. the

...

  1. filename.

...

  1. We

...

  1. are

...

  1. currently

...

  1. using

...

  1. a

...

  1. Java

...

  1. database

...

  1. HSQLDB

...

  1. which

...

  1. uses

...

  1. a

...

  1. file

...

  1. storage

...

  1. mechanism

...

  1. for

...

  1. the

...

  1. database.

...

:=}
Note
title
Important

You

don't

normally

need

to

change

the

{

Code Block
}

${user.home}
{code}

except

in

the

case

of

Windows,

where

you

probably

need

to

put

in

the

full

path.

{note} *

Note:

...

This

...

page

...

How

...

to

...

start

...

up

...

in

...

the

...

PAS

...

or

...

TELS

...

configuration

...

describes

...

in

...

more

...

detail

...

the

...

two

...

locations

...

where

...

the

...

<context.config.class>

...

must

...

be

...

changed

...

from:

...

net.sf.sail.webapp.spring.impl.SpringConfigurationImpl

...

to

org.telscenter.sail.webapp.spring.impl.SpringConfigurationImpl

...

To

...

enable

...

the

...

TELS

...

configuration

...

which

...

adds

...

the

...

following

...

functionality:

...

  • more

...

  • grading

...

  • UI

...

  • enhancements

...

  • TELS

...

  • workgroups

...

  • include

...

  • a

...

  • reference

...

  • to

...

  • a

...

  • class

...

  • period

...

  • added

...

  • teacher,

...

  • student,

...

  • and

...

  • researcher

...

  • user

...

  • roles

...

Anchor

...

settings

}
Code Block
xml
title.m2/settings.xml
<settings>
    <servers>
        <server>
            <id>myserver</id>
            <username>myuser</username>
            <password>mypass</password>
        </server>
    </servers>

    <profiles>
        <profile>
            <id>databaseConfig</id>
            <activation>
                <activeByDefault />
            </activation>
            <properties>
                <db.vendor>hsqldb</db.vendor>
                <jdbc.url>
                    jdbc:hsqldb:file:${user.home}/tomcat/db/sail_database;shutdown=true
                </jdbc.url>
                <jdbc.driverClassName>
                    org.hsqldb.jdbcDriver
                </jdbc.driverClassName>
                <jdbc.username>sa</jdbc.username>
                <jdbc.password></jdbc.password>
                <hibernate.dialect>
                    org.hibernate.dialect.HSQLDialect
                </hibernate.dialect>
            </properties>
        </profile>

        <profile>
            <id>portalConfig</id>
            <activation>
                <activeByDefault />
            </activation>
            <properties>
                <context.config.class>
                    net.sf.sail.webapp.spring.impl.SpringConfigurationImpl
                </context.config.class>
            </properties>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>databaseConfig</activeProfile>
        <activeProfile>portalConfig</activeProfile>
    </activeProfiles>
</settings>
{code}\\
{anchor:Step3}

h3. Install Eclipse and tools for Eclipse

# Download Eclipse from [


Anchor
Step3

Install Eclipse and tools for Eclipse

  1. Download Eclipse from http://www.eclipse.org/downloads/

...

  1. .

...

  1. Get

...

  1. the

...

  1. "Eclipse

...

  1. IDE

...

  1. for

...

  1. Java

...

  1. EE

...

  1. Developers"

...

  1. version.

...

  1. Eclipse

...

  1. 3.4

...

  1. (Ganymede),3.5

...

  1. (Galileo)

...

  1. and

...

  1. 3.6

...

  1. (Helios)

...

  1. have

...

  1. been

...

  1. reported

...

  1. to

...

  1. work.

...

  1. We

...

  1. recommend

...

  1. using

...

  1. version

...

  1. 3.6.

...

  1. Define

...

  1. Maven

...

  1. 2

...

  1. local

...

  1. repository

...

  1. location

...

  1. and

...

  1. add

...

  1. to

...

  1. the

...

  1. Eclipse

...

  1. build

...

  1. classpath.

...

  1. Otherwise

...

  1. you

...

  1. will

...

  1. see

...

  1. lots

...

  1. of

...

  1. build

...

  1. errors.

...

  1. To

...

  1. do

...

  1. that,

...

  1. look

...

  1. under

...

  1. the

...

  1. Eclipse

...

  1. Menu

...

  1. Window->Preferences

...

  1. .

...

  1. Within

...

  1. the

...

  1. preferences,

...

  1. select

...

  1. Java->Build

...

  1. Path->Classpath

...

  1. .

...

  1. Click

...

  1. "New"

...

  1. to

...

  1. add

...

  1. a

...

  1. new

...

  1. variable.

...

  1. The

...

  1. Name

...

  1. must

...

  1. be

...

  1. M2_REPO

...

  1. and

...

  1. the

...

  1. Path

...

  1. should

...

  1. be

...

  1. where

...

  1. the

...

  1. Maven

...

  1. 2

...

  1. local

...

  1. repository

...

  1. lives,

...

  1. usually

...

  1. home_folder/.m2/repository

...

  1. .

...

  1. Create

...

  1. a

...

  1. home_folder/.m2/repository

...

  1. if

...

  1. you

...

  1. don't

...

  1. have

...

  1. one.

...

  1. Install

...

  1. the

...

  1. Web

...

  1. Tools

...

  1. Platform

...

  1. (WTP)

...

  1. ,

...

  1. Spring

...

  1. IDE

...

  1. ,

...

  1. and

...

  1. Subclipse

...

  1. for

...

  1. Eclipse.

...

  1. These

...

  1. Eclipse

...

  1. plug-ins

...

  1. provide

...

  1. a

...

  1. nicer

...

  1. view

...

  1. when

...

  1. working

...

  1. with

...

  1. files

...

  1. such

...

  1. as

...

  1. JSP,

...

  1. spring

...

  1. XML

...

  1. configurations,

...

  1. etc.

...

  1. Info

...

  1. title

...

  1. Useful

...

  1. Information

...

  1. You

...

  1. can

...

  1. install

...

  1. all

...

  1. these

...

  1. plug-ins

...

  1. using

...

  1. the

...

  1. Eclipse

...

  1. Update

...

  1. Manager

...

  1. .

...

  1. Instructions

...

  1. for

...

  1. installing

...

  1. Spring

...

  1. IDE

...

  1. are

...

  1. available

...

  1. at

...

  1. http://springide.org/project/wiki/SpringideCallistoInstall

...

  1. .

...

  1. The

...

  1. actual

...

  1. update

...

  1. site

...

  1. for

...

  1. Spring

...

  1. IDE

...

  1. is

...

  1. at

...

  1. http://springide.org/updatesite

...

  1. .

...

  1. Subclipse

...

  1. update

...

  1. site

...

  1. is

...

  1. at

...

  1. http://subclipse.tigris.org/update_1.6.x

...

  1. .

...

  1. WTP

...

  1. update

...

  1. site

...

  1. is

...

  1. at

...

  1. http://download.eclipse.org/webtools/updates/

...


Image Added

Anchor
Step4

Install Tomcat 5.5+

  1. Download Tomcat 5.5.x

...

  1. (requires

...

  1. java

...

  1. 1.4+)

...

  1. or

...

  1. Tomcat

...

  1. 6.0.x

...

  1. (requires

...

  1. java

...

  1. 1.5+)

...

  1. from

...

  1. http://tomcat.apache.org/

...

  1. .

...

  1. You

...

  1. can

...

  1. find

...

  1. out

...

  1. which

...

  1. version

...

  1. suits

...

  1. you

...

  1. by

...

  1. reading

...

  1. this

...

  1. page:

...

  1. http://tomcat.apache.org/whichversion.html

...

  1. .

...

  1. This

...

  1. tutorial

...

  1. assumes

...

  1. that

...

  1. you

...

  1. are

...

  1. using

...

  1. 6.0.

...

  1. Unpack

...

  1. the

...

  1. downloaded

...

  1. distribution.

...

  1. Read

...

  1. the

...

  1. setup

...

  1. documentation

...

  1. http://tomcat.apache.org/tomcat-6.0-doc/setup.html

...

  1. .

...

  1. You

...

  1. will

...

  1. need

...

  1. to

...

  1. set

...

  1. CATALINA_HOME

...

  1. and

...

  1. JAVA_HOME

...

  1. environment

...

  1. variables

...

  1. as

...

  1. specified

...

  1. in

...

  1. the

...

  1. documentation.

...

  1. We

...

  1. will

...

  1. be

...

  1. referring

...

  1. the

...

  1. directory

...

  1. where

...

  1. you

...

  1. unpacked

...

  1. Tomcat

...

  1. as

...

  1. CATALINA_HOME

...

  1. .

...

  1. Info

...

  1. title

...

  1. Mac

...

  1. tip

...

  1. For

...

  1. Mac,

...

  1. to

...

  1. set

...

  1. CATALINA_HOME

...

  1. and

...

  1. JAVA_HOME

...

  1. variables,

...

  1. add

...

  1. this

...

  1. into

...

  1. your

...

  1. ~/.profile

...

  1. file:

...

  1. Code Block

...

  1. xml

...

  1. title

...

  1. ~/.profile

...

  1. 
    export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
    export CATALINA_HOME="/Users/telsbot/apache-tomcat-6.0.29"    # change this to match your setting
    

...

  1. Then

...

  1. run

...

  1. source

...

  1. command

...

  1. to

...

  1. read

...

  1. in

...

  1. the

...

  1. changes

...

  1. in

...

  1. the

...

  1. .profile:

...

  1. Code Block

...

  1. 
    $ source ~/.profile
    

...

  1. In CATALINA_HOME/conf/context.xml

...

  1. file,

...

  1. add

...

  1. the

...

  1. antiJARLocking

...

  1. and

...

  1. antiResourceLocking

...

  1. attributes

...

  1. and

...

  1. set

...

  1. them

...

  1. to

...

  1. true

...

  1. for

...

  1. the

...

  1. existing

...

  1. <Context>

...

  1. element.

...

  1. This

...

  1. prevents

...

  1. any

...

  1. problems

...

  1. with

...

  1. hot

...

  1. deployment

...

  1. in

...

  1. certain

...

  1. operating

...

  1. systems.

...


  1. Panel

...

  1. title

...

  1. CATALINA_HOME/conf/context.xml

...

  1. <Context

...

  1. antiJARLocking="true"

...

  1. antiResourceLocking="true">

...


  1. ...

...


  1. </Context>

...


Info

If you do not want to use Eclipse Tomcat integration, see Running Tomcat from a shell script for an example of how to manage tomcat with a shell script.

Anchor
Step5

Configure personal settings for Tomcat

  1. In CATALINA_HOME/conf/tomcat-users.xml

...

  1. file,

...

  1. you

...

  1. need

...

  1. to

...

  1. add

...

  1. a

...

  1. new

...

  1. "manager"

...

  1. role

...

  1. as

...

  1. well

...

  1. as

...

  1. a

...

  1. new

...

  1. user

...

  1. that

...

  1. has

...

  1. been

...

  1. granted

...

  1. the

...

  1. manager

...

  1. role.

...


  1. Panel

...

  1. title

...

  1. CATALINA_HOME/conf/tomcat-users.xml

...

  1. <tomcat-users>

...


  1. ...

...


  1. <role

...

  1. rolename="manager"/>

...


  1. <user

...

  1. username="myuser"

...

  1. password="mypass"

...

  1. roles="manager"/>

...


  1. ...

...


  1. </tomcat-users>

...


  1. Warning
    titleWarning

    This username and password must match the one previously defined in .m2/settings.xml

...

  1. .

    Anchor
    Step6

Install Ant 1.7

...

+

...

  1. Download

...

  1. Ant

...

  1. from

...

  1. http://ant.apache.org/bindownload.cgi

...

  1. .

...

  1. Unpack

...

  1. the

...

  1. downloaded

...

  1. distribution.

...

  1. Define

...

  1. an

...

  1. ANT_HOME

...

  1. system

...

  1. variable.

...

  1. Add ANT_HOME/bin

...

  1. to

...

  1. the

...

  1. system

...

  1. path.

...

  1. Info

...

  1. For

...

  1. mac

...

  1. users,

...

  1. follow

...

  1. the

...

  1. M2_HOME

...

  1. example

...

  1. above.

...

  1. Here

...

  1. is

...

  1. a

...

  1. more

...

  1. detailed

...

  1. guide

...

  1. from

...

  1. the

...

  1. Ant

...

  1. website

...

  1. http://ant.apache.org/manual/index.html

...

  1. .

...

Anchor

...

Step7

Check out the source code from the code repository

There is a publicly available anonymous read-only subversion repository at http://sailportal.googlecode.com/svn/trunk/

...

(i.e.,

...

you

...

can

...

check

...

out

...

the

...

code

...

but

...

not

...

commit).

...

It

...

can

...

be

...

checked

...

out

...

within

...

Eclipse

...

using

...

the

...

SVN

...

browsing

...

perspective,

...

or

...

from

...

the

...

command

...

line,

...

by

...

running

...

'svn

...

checkout

...

http://sailportal.googlecode.com/svn/trunk/

...

sailportal-read-only'.

...

If

...

you

...

would

...

really

...

like

...

to

...

have

...

development

...

access

...

(i.e.,

...

permission

...

to

...

commit),

...

please

...

send

...

an

...

email

...

request

...

to

...

pas-portal-dev@googlecode.com

...

If

...

you'd

...

like

...

to

...

check

...

out

...

a

...

branch

...

of

...

the

...

webapp

...

and

...

work

...

with

...

the

...

latest

...

version

...

of

...

webapp,

...

substitute

...

the

...

repository

...

url

...

with

...

http://sailportal.googlecode.com/svn/webapp/branches/webapp-3.0/

...

  1. copy

...

  1. src/main/resources/sendmail_sample.properties

...

  1. to

...

  1. src/main/resources/sendmail.properties

...

  1. and

...

  1. edit

...

  1. the

...

  1. mappings

...

  1. in

...

  1. the

...

  1. sendmail.properties

...

  1. file.

...

  1. This

...

  1. file

...

  1. stores

...

  1. configuration

...

  1. settings

...

  1. when

...

  1. email

...

  1. needs

...

  1. to

...

  1. be

...

  1. sent

...

  1. from

...

  1. the

...

  1. portal.

...

  1. copy

...

  1. src/main/resources/portal_sample.properties

...

  1. to

...

  1. src/main/resources/portal.properties

...

  1. and

...

  1. edit

...

  1. the

...

  1. mappings

...

  1. in

...

  1. the

...

  1. portal.properties

...

  1. file.

...

  1. This

...

  1. file

...

  1. is

...

  1. stores

...

  1. other

...

  1. portal

...

  1. settings

...

  1. like

...

  1. portal

...

  1. name.

...

Anchor

...

Step8

Install the Maven 2 dependencies into the local repository

  1. You must manually download and install the Java Transaction API (JTA) jar due to licensing restrictions.
  2. Download Java Transaction API Specification 1.0.1B

...

  1. Class

...

  1. Files

...

  1. from

...

  1. http://www.oracle.com/technetwork/java/javaee/tech/jta-138684.html

...

  1. .

...

  1. You

...

  1. must

...

  1. accept

...

  1. the

...

  1. license

...

  1. agreement.

...

  1. Then,

...

  1. install

...

  1. it

...

  1. using

...

  1. the

...

  1. command:

...

  1. No Format

...

  1. 
    mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/jta-1_0_1B-classes.zip
    

...


Check to see if it is already installed

Code Block
ls ~/.m2/repository/javax/transaction/jta
{code}
# Install the remaining Maven 2 dependency jars and run all the unit tests from the project directory.
{noformat}
  1. Install the remaining Maven 2 dependency jars and run all the unit tests from the project directory.
    No Format
    
    cd  /path/where/project/code/from/svn/resides
    mvn clean; mvn compile; mvn resources:resources
    

...


Anchor
Step9

Create and initialize a working database

In order to swap MySQL for HSQL follow the instructions below and once you know the application works successfully using HSQL, you can follow the instructions in How to install and use MYSQL instead of HSQLDB as the portal's database to switch to MySQL.

  1. Create the necessary directories where your sail database will reside (specified in .m2/settings.xml

...

  1. previously).

...

  1. Use

...

  1. ant

...

  1. from

...

  1. the

...

  1. project

...

  1. directory

...

  1. to

...

  1. create

...

  1. a

...

  1. working

...

  1. database.

...

  1. No Format

...

  1. 
    cd  /path/where/project/code/from/svn/resides
    ant db.schema-export
    ant db.init
    

...


Anchor
Step10

Configure Tomcat server to run within Eclipse

Pas Portal mode

  1. Modify src/main/webapp/WEB-INF/web.xml

...

  1. and

...

  1. replace

...

  1. the

...

  1. 2

...

  1. occurrences

...

  1. of

...

  1. $

...

  1. {context.config.class

...

  1. }

...

  1. with

...

  1. the

...

  1. value

...

  1. "

...

  1. net.sf.sail.webapp.spring.impl.SpringConfigurationImpl

...

  1. "
}
Code Block
xml
titlesrc/main/webapp/WEB-INF/web.xml
<context-param>
    <param-name>contextConfigClass</param-name>
    <param-value>net.sf..sail.webapp.spring.impl.SpringConfigurationImpl</param-value>
</context-param>
{code}
{code:xml| title=
}
Code Block
xml
titlesrc/main/webapp/WEB-INF/web.xml
<init-param>
    <param-name>contextConfigClass</param-name>
    <param-value>${net.sf..sail.webapp.spring.impl.SpringConfigurationImpl}</param-value>
</init-param>
{code}\\
h4. TELS Portal mode

# Modify {{


TELS Portal mode

  1. Modify src/main/webapp/WEB-INF/web.xml

...

  1. and

...

  1. replace

...

  1. the

...

  1. 2

...

  1. occurrences

...

  1. of

...

  1. $

...

  1. {context.config.class

...

  1. }

...

  1. with

...

  1. the

...

  1. value

...

  1. "

...

  1. org.telscenter.sail.webapp.spring.impl.SpringConfigurationImpl

...

  1. "
}
Code Block
xml
titlesrc/main/webapp/WEB-INF/web.xml
<context-param>
    <param-name>contextConfigClass</param-name>
    <param-value>org.telscenter.sail.webapp.spring.impl.SpringConfigurationImpl</param-value>
</context-param>
{code}
{code:xml| title=
}
Code Block
xml
titlesrc/main/webapp/WEB-INF/web.xml
<init-param>
    <param-name>contextConfigClass</param-name>
    <param-value>${org.telscenter.sail.webapp.spring.impl.SpringConfigurationImpl}</param-value>
</init-param>
{code}\\
Create an eclipse workspace with the svn checkout of the portal webapp directory.
# Look under the Eclipse menu _Window_\->_Preferences_ (or Eclipse->Preferences.  Within the preferences, select _Server_\->_Installed Runtime_ (Runtime Environments in Eclipse 


Create an eclipse workspace with the svn checkout of the portal webapp directory.

  1. Look under the Eclipse menu Window->Preferences (or Eclipse->Preferences. Within the preferences, select Server->Installed Runtime (Runtime Environments in Eclipse 3.4.x)

...

  1. Click

...

  1. Add

...

  1. to

...

  1. add

...

  1. a

...

  1. new

...

  1. server

...

  1. runtime.

...

  1. Select

...

  1. Apache

...

  1. ->

...

  1. Apache

...

  1. Tomcat

...

  1. v5.5

...

  1. and

...

  1. then

...

  1. click

...

  1. Next

...

  1. .

...

  1. Click

...

  1. Browse

...

  1. and

...

  1. select

...

  1. the

...

  1. Tomcat

...

  1. installation

...

  1. directory

...

  1. as

...

  1. required.

...

  1. Then

...

  1. click

...

  1. Finish

...

  1. and

...

  1. OK

...

  1. to

...

  1. finish

...

  1. the

...

  1. dialog.

...

  1. Look

...

  1. under

...

  1. the

...

  1. Eclipse

...

  1. menu

...

  1. Window

...

  1. ->

...

  1. Show

...

  1. View

...

  1. ->

...

  1. Other

...

  1. .

...

  1. Within

...

  1. the

...

  1. Show

...

  1. View

...

  1. dialog,

...

  1. select

...

  1. Server

...

  1. ->

...

  1. Servers

...

  1. .

...

  1. In

...

  1. the

...

  1. Servers

...

  1. view,

...

  1. right

...

  1. click

...

  1. in

...

  1. the

...

  1. window

...

  1. underneath

...

  1. and

...

  1. select

...

  1. New

...

  1. ->

...

  1. Server

...

  1. .

...

  1. Enter

...

  1. "

...

  1. localhost

...

  1. "

...

  1. into

...

  1. Server's

...

  1. host

...

  1. name

...

  1. box.

...

  1. Select

...

  1. Apache

...

  1. ->

...

  1. Tomcat

...

  1. v5.5

...

  1. Server

...

  1. and

...

  1. click

...

  1. Next
  2. Right click on the new server and select Add and then select the project from Available Projects and add to the Configured Projects
  3. Click Next and then Finish.
    Warning
    titleWarning

    You will be required to run "mvn resources:resources" from the command line if the project is built within Eclipse. Maven 2 is used to filter some resources and dynamically replace values in the source code from your personal .m2/settings.xml

...

  1. file.

...

  1. Every

...

  1. time

...

  1. Eclipse

...

  1. starts

...

  1. a

...

  1. clean

...

  1. build

...

  1. you

...

  1. need

...

  1. to

...

  1. perform

...

  1. the

...

  1. above

...

  1. action

...

  1. before

...

  1. you

...

  1. can

...

  1. deploy

...

  1. to

...

  1. the

...

  1. server,

...

  1. i.e.,

...

  1. the

...

  1. first

...

  1. time

...

  1. you

...

  1. build

...

  1. the

...

  1. project

...

  1. and

...

  1. anytime

...

  1. thereafter

...

  1. when

...

  1. you

...

  1. clean

...

  1. the

...

  1. project

...

  1. in

...

  1. Eclipse.

...


Anchor
Step11

Basic commands for working with Tomcat running in Eclipse

All the controls for interacting with Tomcat are done using the Servers view in Eclipse. There should be a defined server for "Tomcat v5.5 Server @ localhost".

Copying and replacing the resources for the web application.


No Format
mvn resources:resources
{noformat}\\
h4. The web application needs to be 


The web application needs to be "published"

...

to

...

the

...

server

...

to

...

begin.

...

  • Right

...

  • click

...

  • on

...

  • the

...

  • server

...

  • and

...

  • select

...

  • Publish

...

  • .

...

The

...

server

...

needs

...

to

...

be

...

"started".

...

  • Right

...

  • click

...

  • on

...

  • the

...

  • server

...

  • and

...

  • select

...

  • Start

...

  • .

...

The

...

web

...

application

...

needs

...

to

...

be

...

"republished"

...

whenever

...

files

...

have

...

changed.

...

  • Right

...

  • click

...

  • on

...

  • the

...

  • server

...

  • and

...

  • select

...

  • Publish

...

  • .

...

The

...

server

...

can

...

be

...

started

...

in

...

"debug"

...

mode.

...

  • Right

...

  • click

...

  • on

...

  • the

...

  • server

...

  • and

...

  • select

...

  • Debug

...

  • .

...

Anchor

...

Step12

Basic commands for working from the command line.

  • Maven 2 has an Eclipse plugin that supports the Web Tools Project (WTP) that sets the project build classpath based on the dependencies listed in pom.xml. Just run:

mvn -Dwtpversion=1.5

...

eclipse:eclipse

...

And

...

then

...

refresh

...

your

...

project.

...

Note

...

that

...

the

...

version

...

#

...

above

...

will

...

change

...

with

...

the

...

WTP

...

version.

...

  • Maven

...

  • 2

...

  • Tomcat

...

  • plug-in

...

  • has

...

  • been

...

  • configured

...

  • for

...

  • usage

...

  • in

...

  • the

...

  • pom.xml.

...

  • For

...

  • more

...

  • details

...

  • see

...

...

  • .

...

  • The

...

  • basic

...

  • development

...

  • work

...

  • flow

...

  • consists

...

  • of:

...

  1. Start

...

  1. tomcat:

...

  1. Code Block

...

  1. 
    mytomcat.sh start
    

...


  1. Write the code (Use

...

  1. eclipse

...

  1. if

...

  1. you

...

  1. want

...

  1. here).

...

  1. Compile

...

  1. the

...

  1. code

...

  1. at

...

  1. the

...

  1. command

...

  1. line.

...

  1. Code Block

...

  1. 
    mvn compile
    

...


  1. If your webapp is currently deployed, you will need to un-deploy

...

  1. it

...

  1. first

...

  1. before

...

  1. re-deploying

...

  1. it

...

  1. again.

...

  1. Code Block

...

  1. 
    mvn tomcat:undeploy
    

...


  1. #Hot deploy a working copy of the webapp to the running tomcat:
    Code Block
    
    mvn war:exploded tomcat:exploded
    

...


  1. Test your webapp.

...

  1. The

...

  1. URL

...

  1. for

...

  1. the

...

  1. standard

...

  1. default

...

  1. tomcat

...

  1. setup

...

  1. is

...

  1. Code Block

...

  1. 
    http://localhost:8080/webapp/
    

...


  1. If you have configured a different port and/or

...

  1. hostname,

...

  1. the

...

  1. URL

...

  1. must

...

  1. reflect

...

  1. your

...

  1. changes.

...

  1. Go

...

  1. back

...

  1. to

...

  1. the

...

  1. development

...

  1. step,

...

  1. there

...

  1. is

...

  1. no

...

  1. need

...

  1. to

...

  1. stop

...

  1. and

...

  1. re-start

...

  1. tomcat.

...

  1. Command

...

  1. to

...

  1. list

...

  1. currently

...

  1. deployed

...

  1. webapps

...

  1. in

...

  1. tomcat:

...

  1. Code Block

...

  1. 
    mvn tomcat:list
    

...


  1. When you want to stop tomcat run:
    Code Block
    
    mytomcat.sh stop
    

...


  1. Anchor
    Step13

Viewing the portal with the browser

  1. In your browser, point to http://localhost:8080/webapp/

...

  1. for

...

  1. the

...

  1. home

...

  1. page.

...

Anchor

...

Step14

Useful debugging techniques

  • The Console view in Eclipse displays all the output messages from Tomcat's standard out. Set the Log4J output level to DEBUG for verbose debugging information.

Anchor
Step15

Problems/solutions encountered during platform installation

  • problem: in .m2/settings.xml

...

  • I

...

  • tried

...

  • to

...

  • use

...

  • linux's

...

  • $

...

  • {HOME

...

  • }

...

  • variable

...

  • to

...

  • indicate

...

  • the

...

  • home

...

  • on

...

  • my

...

  • machine

...

  • for

...

  • the

...

  • 'jdbc.url'

...

  • variable.

...

  • This

...

  • will

...

  • cause

...

  • a

...

  • failure

...

  • when

...

  • executing

...

  • ant

...

  • db.init

...


  • solution

...

  • :

...

  • don't

...

  • use

...

  • system

...

  • variables.

...

  • Even

...

  • though

...

  • the

...

  • system

...

  • variable

...

  • was

...

  • defined

...

  • and

...

  • could

...

  • be

...

  • seen

...

  • by

...

  • the

...

  • system,

...

  • you

...

  • need

...

  • to

...

  • hard-code

...

  • the

...

  • absolute

...

  • path

...

  • for

...

  • the

...

  • jdbc.url

...

  • var.

...

  • Don't

...

  • forget

...

  • to

...

  • create

...

  • the

...

  • sail_database

...

  • database

...

  • and

...

  • make

...

  • sure

...

  • your

...

  • mysql

...

  • server

...

  • is

...

  • up

...

  • and

...

  • running

...

  • before

...

  • you

...

  • run

...

  • ant

...

  • db.init

...

  • You

...

  • must

...

  • make

...

  • sure

...

  • that

...

  • your

...

  • my.cnf

...

  • file,

...

  • which

...

  • is

...

  • a

...

  • configuration

...

  • file

...

  • for

...

  • MySQL

...

  • contains

...

  • the

...

  • following

...

  • content:

...


  • [mysqld

...

  • ]

...


  • lower_case_table_names=1

...

  • Don't

...

  • forget

...

  • to

...

  • run

...

  • "mvn

...

  • resources:resources"

...

  • followed

...

  • by

...

  • a

...

  • refresh

...

  • in

...

  • eclipse

...

  • before

...

  • you

...

  • deploy

...

  • the

...

  • application

...

  • onto

...

  • tomcat.

...

  • problem:

...

  • When

...

  • tomcat

...

  • server

...

  • is

...

  • launched

...

  • from

...

  • within

...

  • eclipse,

...

  • you

...

  • get

...

  • an

...

  • exception

...

  • in

...

  • the

...

  • eclipse

...

  • console

...

  • view

...

  • indicating

...

  • that

...

  • jdbc

...

  • driver

...

  • could

...

  • not

...

  • be

...

  • found.

...


  • solution:

...

  • once

...

  • the

...

  • platform

...

  • is

...

  • in

...

  • place,

...

  • clean

...

  • the

...

  • project

...

  • and

...

  • build

...

  • it.

...

  • Then

...

  • run

...

  • 'mvn

...

  • resources:resources

...

  • "

...

  • on

...

  • the

...

  • command

...

  • line.

...

  • Then

...

  • deploy

...

  • the

...

  • project

...

  • onto

...

  • tomcat

...

  • and

...

  • then

...

  • run

...

  • pas-portal.

...


  • note:

...

  • running

...

  • '

...

  • mvn

...

  • resources:resources

...

  • '

...

  • is

...

  • necessary

...

  • (as

...

  • mentioned

...

  • in

...

  • the

...

  • notes

...

  • above)

...

  • because

...

  • it

...

  • will

...

  • replace

...

  • certain

...

  • variables

...

  • in

...

  • the

...

  • code,

...

  • with

...

  • their

...

  • appropriate

...

  • values.