quote

mercoledì, gennaio 09, 2008

migration maven based project to using spring 2.5

As the new version of spring labelled 2.5 has been released, I wanted update all the dependencies in the parancoe project to the new version of spring.
I didn't find the 2.5 version for the following spring modules:

  • spring-dao
  • spring-hibernate3

At the first I used the old version, 2.0.7, for these two modules but I had many test failures. I have found the explanation of the reason of these missing files here.
These two modules have been renominated in the following way:

  • spring-dao to spring-tx
  • spring-hibernate3 to spring-orm

Here the section in your pom.xml maven file with the updated version of these two modules:


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>2.5</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>2.5</version>
</dependency>

giovedì, gennaio 03, 2008

Deploy webapp on tomcat 6

Here, the steeps I have followed in order to deploy and starting my web application on tomcat 6.
I wanted deploy my webapp (hereafter I'll call it pippo), without moving the pippo.war on <tomcat-home>/webapps
Environment: Windows XP, JDK 1.6, tomcat 6.0

  • Create the folder <tomcat-home>/conf/Catalina/localhost (Note the capital letter C in Catalina)
  • Rename the contex.xml of your webapp as pippo.xml e copy it under the localhost folder just created.
  • Copy all the jdbc drivers that your webapp needs under the folder <tomcat-home>/lib
  • Exec $ catalina start from <tomcat-home>/bin
  • Open the browser and type http://localhost:8080/pippo

Here the context.xml of pippo webapp, renamed pippo.xml


<Context path="/pippo" reloadable="true"
docBase="C:/temp/pippo">
<Resource auth="Container"
driverClassName="org.hsqldb.jdbcDriver"
maxActive="5"
name="jdbc/pippoDS"
password=""
type="javax.sql.DataSource"
url="jdbc:hsqldb:hsql://localhost/pippo"
username="sa"/>
</Context>


Remember also to modify the tomcat-users.xml file in the <tomcat-home>/conf/ folder.
Here the file I use.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="manager,tomcat,admin"/>
</tomcat-users>


Deployment descriptor for the basicwebappevolution




<Context path="/basicWebAppEvolution" reloadable="true"
docBase="/dev/parancoe/parancoe/examples/basicWebAppEvolution/target/basicWebAppEvolution">
<Resource auth="Container"
driverClassName="org.postgresql.Driver"
maxActive="5"
name="jdbc/dataSource"
password="mypassword"
type="javax.sql.DataSource"
url="jdbc:postgresql://localhost:5432/basicwebappevolution"
username="postgres"/>
</Context>