Hello,

We use embedded Tomcat with MyFaces, and I'm having trouble getting them to run properly with Maven. Tomcat itself is working fine, its just the Myfaces thats causing trouble, and I'm pretty sure it is classpath related, I'm just not sure how to diagnose it. In short, the error we get is:

javax.faces.FacesException: The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application

We don't see this error with our ant build system however (exactly the same code, web.xml files, etc), which leads me to suspect Maven's classpath shenanigans.

Any help would be appreciated, details are below....

-Josh

I have the following dependencies in our pom.xml:

        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
            <version>1.1.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-impl</artifactId>
            <version>1.1.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.myfaces.tomahawk</groupId>
            <artifactId>tomahawk</artifactId>
            <version>1.1.5</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>

And in an effort to make sure Tomcat was using the right classpath, I set it explicitly when we start tomcat:

        // Create a class loader from our own classpath
Loader classLoader = initTomcat.createLoader(this.getClass().getClassLoader());
        classLoader.setDelegate(true);

        Engine baseEngine = initTomcat.createEngine();

        baseEngine.setName(TOMCAT_ENGINE_NAME);
        baseEngine.setDefaultHost(TOMCAT_HOST);
baseEngine.setParentClassLoader(this.getClass().getClassLoader());

        // Create Host
        Host baseHost = initTomcat.createHost(TOMCAT_HOST, "");

        // add host to Engine
        baseEngine.addChild(baseHost);

        Context rootCtx = initTomcat.createContext("/", "webapp");
        rootCtx.setPrivileged(true);
        rootCtx.setLoader(classLoader);
        baseHost.addChild(rootCtx);

        PersistentManager manager = new PersistentManager();
        manager.setSaveOnRestart(false);
        rootCtx.setManager(manager);

But I see the following when I try and load a .jsf file:

javax.faces.FacesException: The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application at org .apache .myfaces .context .servlet .ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java: 425) at org .apache .myfaces .application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java: 211) at org .apache .myfaces .lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java: 41) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java: 132) at javax.faces.webapp.FacesServlet.service(FacesServlet.java: 140) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 252) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org .apache .myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java: 147) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 202) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 213) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 178) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 126) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 105) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 869) at org.apache.coyote.http11.Http11BaseProtocol $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667) at org .apache .tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org .apache .tomcat .util .net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java: 80) at org.apache.tomcat.util.threads.ThreadPool $ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:613)
Caused by: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with
this application
at org .apache .jasper .servlet.JspServletWrapper.handleJspException(JspServletWrapper.java: 510) at org .apache .jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 252) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org .apache .catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java: 672) at org .apache .catalina .core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java: 463) at org .apache .catalina .core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at org .apache .catalina .core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org .apache .myfaces .context .servlet .ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java: 419)
        ... 21 more


--
Joshua ChaitinPollak | Software Engineer
Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970






Reply via email to