views:

765

answers:

2

Hello

I included this in my index.jsp JSF file:

<%@ taglib prefix="ui" uri="http://java.sun.com/jsf/facelets"%&gt;

and Eclipse underlines the URL, hovering gives this:

Cannot find the tag library descriptor for "http://java.sun.com/jsf/facelets"

Deploying and trying to start Tomcat 6 using the Tomcat plugin causes this:

|STDOUT| 2010-03-03 17:57:29,872 | INFO  | [main]: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
    |STDOUT| 2010-03-03 17:57:29,904 | INFO  | [main]: ServletContext 'C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myapp\' initialized.
    |STDOUT| 2010-03-03 17:57:29,904 | INFO  | [main]: Checking for plugins:org.apache.myfaces.FACES_INIT_PLUGINS
    03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    03-Mar-2010 17:57:29 org.apache.catalina.core.StandardContext start
    SEVERE: Context [/myapp] startup failed due to previous errors

...

03-Mar-2010 17:57:30 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)

My web.xml contains this

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

My face-config.xml contains this

    <application>
    <!-- tell JSF to use Facelets -->
    <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>

And my application build has the latest JSF 2.0.2 jsf-api.jar and jsf-impl.jar. I've also got MyFaces 1.2.8 and all the latest commons jars. The app was building fine til I upgraded JSF. I would at least expect a run time error but here Eclipse cannot see the taglib. What else could I be missing?

EDIT

For full information - I took out Mojarra and left in Myfaces. This meant I needed to remove this from my web.xml:

<listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener> 

and replace it with the equivalent for myfaces:

<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

Thanks

A: 

Well that's annoying. I read in a couple of places that the new Mojarra release embedded facelets. I added jsf-facelets-1.1.14.jar to my build and it deployed ok.

Mark Lewis
+3  A: 

Do not mix JSF 2.0 with JSF pre-2.0. It may lead to unexpected results (like the one above).

Choose a JSF 2.0 implementation (mojarra as it seems) and remove all myfaces and facelets libraries.

Bozho
Bozho, I've actually used myFaces, but you're right and that's my development naivety again. I've learned a lot from you and BalusC over the last month - thanks very much indeed guys.
Mark Lewis