0

I'm building a web App using JSF 2.0 and had a jaf-facelets.1.1.10 jar in my WEB-INF > lib folder, so now I'm trying to remove that so I can use the built int facelets 2.0 I was reading through this Question which balusC answered and I've done that, except teh part where it saysI need to replace FaceletViewHandler by ViewHandlerWrapper. for that I saw this question, but I don't have any faceletViewhandler classes in my project.

as of now, my webxml looks like this ( please check taht I didn't miss anything, or I'm referencing something I shouldn't:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>miloWeb</display-name>
  <welcome-file-list>
    <welcome-file>faces/pages/index.xhtml</welcome-file>
  </welcome-file-list>
  <listener>
    <listener-class>com.bravo.listeners.ServletListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <servlet>
        <servlet-name>PdfServlet</servlet-name>
        <servlet-class>com.bravo.servlets.PdfServlet</servlet-class>
    </servlet>    
    <servlet-mapping>
        <servlet-name>PdfServlet</servlet-name>
        <url-pattern>/PdfServlet</url-pattern>
    </servlet-mapping>
  <filter>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
  </filter> 
  <filter-mapping>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <servlet-name>Faces Servlet</servlet-name> 
  </filter-mapping>
  <context-param>
    <description>
      This is to Have separated faces.config files            
    </description>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>
      /pages/history/faces-config.xml,
      /pages/contactInformation/faces-config.xml,
      /pages/childHealthRecord/faces-config.xml,
      /pages/dashboard/faces-config.xml,
      /pages/insurance/faces-config.xml,
      /pages/search/faces-config.xml,
      /pages/labs/faces-config.xml,
      /pages/patient/faces-config.xml,
      /pages/physical/faces-config.xml,
      /pages/notes/faces-config.xml,
      /pages/scheduler/faces-config.xml,
      /pages/settings/faces-config.xml,
      /pages/orderEntry/faces-config.xml,
      /pages/vitals/faces-config.xml
    </param-value>
  </context-param>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
</web-app>

And as you can see, I have quite a few faces-configs I removed the

<application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    </application>

And now it looks like this ( I know some features I don't need like the navigation, but does it really hurt to keep it taht way?):

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <managed-bean>
        <managed-bean-name>vitalsBB</managed-bean-name>
        <managed-bean-class>com.bravo.vitals.VitalsBB</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
        <navigation-case>
            <from-outcome>vitals</from-outcome>     
            <to-view-id>/pages/vitals/vitals.xhtml</to-view-id>
            <redirect />
        </navigation-case>
    </navigation-rule>

</faces-config>

after doing some changes and leaving it like that, I run the project on tomcatv7 and get this error:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
    com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:452)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)

Does that look like an error I would get for having my files like this? because all I did was remove the jar-facelets.1.1.10.jar and now I'm getting this Error. But teh App works fine b4 I remove the facelets jar, so what is the relationship between these two jars??

I tried adding the jstl.jar but that doesn't work, it just shows me this:

it doesn't make sense to me

Community
  • 1
  • 1
Myy
  • 16,507
  • 11
  • 33
  • 55

2 Answers2

2

The error suggest include jstl-1.2.jar available here in the same folder where your jsf jars are.

There is no need for facelets 2.0 jar, because JSF 2.0 adopted facelets as its default View Declaration Language (VDL), and now it is bundled inside jsf jars (for both MyFaces and Mojarra)

lu4242
  • 2,268
  • 1
  • 13
  • 15
  • I added the jar, but It's weird It didn't complain before. I added it, and now when I try to run it on the server, ( It tried to open up index.xhtml) and a pop up shows up asking me if I want to open the file or save it? I've never gotten this before – Myy Apr 03 '12 at 18:41
0

To solve this issue, I had to Add the jstl-impl.jar and jstl-api.jar and update to the latest jsf-impl.jar and jsf-api.jar. That fixed it.

Don't really know why it never complained about it when the facelets.1.10.jar was there.

Myy
  • 16,507
  • 11
  • 33
  • 55
  • You should NOT have the JSP API/impl in your webapp! It's the servletcontainer itself who is supposed to provide it. Your webapplication is now unportable and will only work in the very same servletcontainer make/version as where those JSP libraries originated from. – BalusC Apr 04 '12 at 11:49
  • huh? so I have to remove them then? or are you telling me it unfixable? :( – Myy Apr 04 '12 at 21:43
  • http://stackoverflow.com/questions/4441713/migrating-from-jsf-1-2-to-jsf-2-0/4532870#4532870 you tell us to drop jsf 2.0 jars in our WEB_INF, and since It works I assumed it was right... what do i do now? – Myy Apr 04 '12 at 23:18
  • OMG, I'm sorry. I meant to say I added in the jsf-impl.jar and jsf-api.jar into my WEB_INF. I messed up when I typed in jsp. I'll edit my answer. I don't have any jsp jars in there. Am I good? – Myy Apr 05 '12 at 01:41
  • just wanted to doubleCheck with you. Thanks – Myy Apr 05 '12 at 17:18