Re: Trouble with Tomcat / MyFaces in Maven JUnits
Hi Josh, if it is like that, you can also try if adding the dependency to the surefire plugin configuration (I assume you run the tomcat with surefire?) works. Stefan Joshua ChaitinPollak wrote: Hi Stefan, Thanks for the suggestion. For now I've just checked the myfaces libs into our webapp directory and moved on. Ugly, but it works. -Josh On Feb 26, 2008, at 7:37 AM, VUB Stefan Seidel wrote: Hi, I could be totally wrong, but I remember something like tomcat scanning the JARs in java.class.path for JSP tag libraries. As maven does not set java.class.path to the test class path, this could be the problem. In your test, try invoking the method presented in http://markmail.org/message/2lgpzzfyqypvp4km with classes from the myfaces JARs and append the resulting file names to the system property java.class.path. HTH, Stefan Joshua Pollak wrote: 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 groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-api/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-impl/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.tomahawk/groupId artifactIdtomahawk/artifactId version1.1.5/version /dependency dependency groupIdtaglibs/groupId artifactIdstandard/artifactId version1.1.2/version /dependency dependency groupIdjavax.servlet/groupId artifactIdjstl/artifactId version1.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
Re: Trouble with Tomcat / MyFaces in Maven JUnits
Hi Stefan, Thanks for the suggestion. For now I've just checked the myfaces libs into our webapp directory and moved on. Ugly, but it works. -Josh On Feb 26, 2008, at 7:37 AM, VUB Stefan Seidel wrote: Hi, I could be totally wrong, but I remember something like tomcat scanning the JARs in java.class.path for JSP tag libraries. As maven does not set java.class.path to the test class path, this could be the problem. In your test, try invoking the method presented in http://markmail.org/message/2lgpzzfyqypvp4km with classes from the myfaces JARs and append the resulting file names to the system property java.class.path. HTH, Stefan Joshua Pollak wrote: 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 groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-api/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-impl/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.tomahawk/groupId artifactIdtomahawk/artifactId version1.1.5/version /dependency dependency groupIdtaglibs/groupId artifactIdstandard/artifactId version1.1.2/version /dependency dependency groupIdjavax.servlet/groupId artifactIdjstl/artifactId version1.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
Re: Trouble with Tomcat / MyFaces in Maven JUnits
Hi, I could be totally wrong, but I remember something like tomcat scanning the JARs in java.class.path for JSP tag libraries. As maven does not set java.class.path to the test class path, this could be the problem. In your test, try invoking the method presented in http://markmail.org/message/2lgpzzfyqypvp4km with classes from the myfaces JARs and append the resulting file names to the system property java.class.path. HTH, Stefan Joshua Pollak wrote: 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 groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-api/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.core/groupId artifactIdmyfaces-impl/artifactId version1.1.5/version /dependency dependency groupIdorg.apache.myfaces.tomahawk/groupId artifactIdtomahawk/artifactId version1.1.5/version /dependency dependency groupIdtaglibs/groupId artifactIdstandard/artifactId version1.1.2/version /dependency dependency groupIdjavax.servlet/groupId artifactIdjstl/artifactId version1.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