Installing WEDIA WMS in Eclipse

Installing WEDIA WMS in Eclipse

  • | Facebook
  • Twitter
  • Delicious
  • print

How to set up a WEDIA WMS project in Eclipse ?

Section(s): configuration, ergonomics

Using an IDE is much more comfortable for a developper. Follow this tutorial to set up your WEDIA WMS project in Eclipse.
Following this method, you will easily have code completion in your SAN directory.

key  Read also

Prerequisits

To follow this tutorial, we assume that you have
  • Eclipse installed with the web tools plugin, tomcat configured in it.
  • A mysql capable version of WEDIA WMS
  • a Mysql server running and accessible and sufficient privileges to create a database and a user.
  • Tomcat is configured in Eclipse and latest mysql driver is in your /common/lib tomcat installation directory

Setting up the database

WEDIA WMS requires a dediacated database to run (a schema is fine for Oracle users). The Database user that you will assign to WEDIA WMS must be able to create/destroy objects on its database (or schema). Assuming we are logged on a mysql shell DB with root profile :

mysql> create database wms_sample;
Query OK, 1 row affected (0.07 sec)
mysql> grant all on wms_sample.* to 'wms_sample'@'%' identified by 'wms_sample';
Query OK, 0 rows affected (0.13 sec)
mysql> quit
Bye


We successfully created the wms_sample database and granted wms_sample user all rights from any location on that database.

Checking Eclipse tomcat installation

In order to be fully operational, WEDIA WMS requires a JDK rather than a JRE to run tomcat. The reason is that the WMS application requires to be able to compile JAVA classes. The Java version of the JDK must be 1.4 or above.

From Eclipse, choose Window > Preferences. Then from the tree in the opened window, select Server > Runtime Environments, choose the Apache server and click on the Edit button. You must have a JDK installed as JRE :

Check that tomcat app server uses a JDK

WEDIA WMS app server configuration

Make sure a tomcat server is initialized: from the Servers view (Window > show view > Servers). You should have a server. Otherwise create one.
From the Project Explorer view, open Servers > Tomcat > tomcat-users.xml :

Open the tomcat-users.xml file

Add a new user having the Administrators role :

<tomcat-users>
  <user name="tomcat" password="tomcat" roles="tomcat"/>
  <user name="role1" password="tomcat" roles="role1"/>
  <user name="both" password="tomcat" roles="tomcat,role1"/>
  <user name="admin" password="admin" roles="Administrators"/>
</tomcat-users>

Creating the projects

You will have to set up 2 Dynamic Web projects. The first one is a standard one, it will contain the WMS war :
File > New > Dynamic Web Project and give it a name...

Create a dynamic web project

From the Project Explorer view, open wms_sample / WebContent and remove all its content, then extract in the WebContent Directory the wms.war file (it might for historical reasons be called noheto.war)
From the project Explorer, you should now see something like this :

Project Explorer View after extracting the war in the WebContentDirectory

Now we're ready for creating a new Dynamic Web Project that we will call wms_sample_san. This project will be used for WEDIA WMS SAN directory. From the Project Explorer view, open the directory wms_sample_san/WebContent/, delete all its content then create a san folder and an admin folder in it.
Next, create a WEB-INF folder pointing on the wms_sample/WebContent/WEB-INF folder:

Adding a linked directory WEB-INF

In the end, your project should look like this :

Project Explorer View when everything is done


Right click on wms_sample_san, choose properties, click on Java Build Path from the left tree, click on the Projects tab, and Add wms_sample project

Install the application in the Apache Tomcat server

From the Servers view, right click on the tomcat server, choose Add and Remove... choose the wms_sample (not the wms_sample_san !) from left list and click on the Add button. Click finish.

Set up a connection pool to the database.

From the Project Explorer view, open Servers/Tomcat/server.xml. At the end of the ile, you should have something like that:

      <Context docBase="wms_sample" path="/wms_sample" reloadable="true" source="org.eclipse.jst.j2ee.server:wms_sample"/></Host>
    </Engine>
  </Service>
</Server>	

Replace with :

        <Context docBase="wms_sample" path="/wms_sample" reloadable="true" source="org.eclipse.jst.j2ee.server:wms_sample">
          <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="5" maxIdle="5" maxWait="-1" name="jdbc/wms_sample" password="wms_sample" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/wms_sample?autoReconnect=true" username="wms_sample" validationQuery="select 1"/>
        </Context>
      </Host>
    </Engine>
  </Service>
</Server>	

From the Servers view, select the server, and click on the Publish to the server button, when ready, click on the start button.

You can now access http://localhost:8080/wms_sample/admin