Explorer to JSF Day 1

 

System specification

Tomcat 5.5 (6.0)

Eclipse 3.2 + WTP 1.1 (2.0)

Maven 2.07

JSF 1.2

Problem solution

 

I have struggled for a whole day to figure out whether it is possible to build my project together with Eclipse WTP and Maven like my earlier projects. The answer so far is yes, you can, but you have to be ware that you may have to compromise some of the Eclipse JSF application features (such as configuration navigation for faces-config). Besides, to minimise your trouble, you got to update your system specification.

 

Let me just introduce some problems that I have encounter, which may could be your future reference.

 

Java Build path – once you import your project into the eclipse IDE, you would found that you couldn’t use the refactor function as your default build path (src/main/recourses) has excludes all the .java files. Rather than enabling this path, I would prefer to create a new path (src/main/java) to hold all my business logic java files and leave that recourses to only hold the static files (such as .property file)

 

Tomcat 5.5 is too old– When you try to deploy your project onto tomcat, you could always find the following error message in your log file.

SEVERE: Error configuring application listener of class.com.sun.faces.config.GlassFishConfigureListener

 

You could notice that was because some of the libraries were missing (servlet-api.jar and jsp-api.jar). You could download them with maven, if you would like, but I don’t recommend. The easiest way to solve this problem is to update your Tomcat to 6.0

           <dependency>

                  <groupId>com.sun.el</groupId>

                  <artifactId>el-ri</artifactId>

                  <version>1.2</version>

           </dependency>

           <dependency>

                  <groupId>javax.el</groupId>

                  <artifactId>el-api</artifactId>

                  <version>1.0</version>

           </dependency>

 

If you don’t have the problem to upgrade your tomcat, you’d better to do so, since Jsf1.2 employed a lot of new JSP API, which Tomcat 5.5 doesn’t support.

 

I really hate to use the server application with Eclipse, so I stay with maven and use the tomcat plugin to look after the deployment. If you like what I am doing, please aware that tomcat:reploy would not be good enough to correspond small changes you made on your file. (I have tried to delete all the caches, but it does not seem to work).

Unsolved problem

Although, I have update the WTP to the latest, but it seems that you still can’t fully use JSF 1.2 with Eclipse. When you create a new Dynamic web project, you got the opportunity to configure your project facets. However, there is no way you could tick the Jsf 1.2 option as it requires to go with dynamic web module 2.5, which is actually not an option in the current version Eclipse WTP!!!

 

eclipsejsf

 

 

I really fancy the configuration wizard for faces-config.xml. I have tried quite long time to make the project loaded from maven could keep this features, but I failed to do so. You can only edit it with its source code, which means you have manually to write down all those navigation configurations. If any body could figure out how to use it, please let me know.

Advertisements
This entry was posted in JSF. Bookmark the permalink.

One Response to Explorer to JSF Day 1

  1. nanomoon says:

    The JSF 1.2 requires eclipse web facet 2.5. You need to open the file “org.eclipse.wst.common.project.facet.core.xml”, change 2.4 to 2.5. But, i have to manually do that every time after i run mvn eclipse:clean. Another stuff to make maven and eclipse working together is move the webapp directory to the root of your project, and do the favor with pom.xml in maven-war-plugin (<warSourceDirectory>webapp</warSourceDirectory>). Hope this help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s