2 Replies Latest reply on Nov 27, 2006 7:59 AM by Karl August

    weblets and seam

    Enzo Aquino Newbie

      Howdy all,

      I'm creating a custom JSF component that relies on some javascripts and I'm using the weblets library to retrieve them. When weblets generates the URL for resource it ends up being something along the lines of: /myapp/weblets/resources/container.js.seam. Since it has a .seam extension, it's attempting to load the page context and generating a null pointer exception because there is no view root for javascript file.

      My question, is there a configuration in the face-config.xml or web.xml to prevent it from attempting to load the context? Below is my configuration and the exception that I'm receiving. Thanks.

      - Enzo

      ---------------------------------------------------------------------------------------

      libraries:
      - JBoss AS 4.0.4.GA
      - Seam 1.0.1
      - MyFaces 1.1.3 (in the jsf-libs directory)
      - Tomahawk 1.1.3 (in the jsf-libs directory)
      - Weblets 0.4 (installed the server/default/lib directory)
      - Facelets

      ---------------------------------------------------------------------------------------

      web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <!-- Seam -->

      <listener-class>
      org.jboss.seam.servlet.SeamListener
      </listener-class>



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


      <!-- Facelet configuration -->
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>

      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>true</param-value>
      </context-param>

      <!-- MyFaces -->

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


      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>client</param-value>
      </context-param>

      <!-- Faces Servlet Mapping -->

      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>


      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.seam</url-pattern>
      </servlet-mapping>

      <!-- Exception filter -->

      <filter-name>Seam Exception Filter</filter-name>
      <filter-class>
      org.jboss.seam.servlet.SeamExceptionFilter
      </filter-class>


      <filter-mapping>
      <filter-name>Seam Exception Filter</filter-name>
      <url-pattern>*.seam</url-pattern>
      </filter-mapping>

      <!-- More seam configuration -->

      <filter-name>Seam Redirect Filter</filter-name>
      <filter-class>
      org.jboss.seam.servlet.SeamRedirectFilter
      </filter-class>


      <filter-mapping>
      <filter-name>Seam Redirect Filter</filter-name>
      <url-pattern>*.seam</url-pattern>
      </filter-mapping>

      <!-- Tomahawk extension filter -->

      <filter-name>MyFacesExtensionsFilter</filter-name>
      <filter-class>
      org.apache.myfaces.webapp.filter.ExtensionsFilter
      </filter-class>
      <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>20m</param-value>
      </init-param>


      <!-- extension mapping for adding , , and other resource tags to JSF-pages -->
      <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
      <servlet-name>Faces Servlet</servlet-name>
      </filter-mapping>

      <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
      <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
      </filter-mapping>

      <!-- extension mapping for adding , , and other resource tags to JSF-pages -->
      <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>*.seam</url-pattern>
      </filter-mapping>

      <!-- Seam remoting servlet -->

      <servlet-name>Seam Remoting</servlet-name>
      <servlet-class>
      org.jboss.seam.remoting.SeamRemotingServlet
      </servlet-class>


      <servlet-mapping>
      <servlet-name>Seam Remoting</servlet-name>
      <url-pattern>/seam/remoting/*</url-pattern>
      </servlet-mapping>
      </web-app>

      ---------------------------------------------------------------------------------------

      faces-config.xml:
      <faces-config>
      <!-- Phase listener needed for all Seam applications -->

      <phase-listener>
      org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener
      </phase-listener>


      <!-- Facelets -->

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


      <!-- bunch of navigation -->

      </faces-config>

      ---------------------------------------------------------------------------------------

      weblets-config.xml:
      <?xml version="1.0" encoding="UTF-8" ?>
      <weblets-config xmlns="http://weblets.dev.java.net/config">

      <weblet-name>com.evolved.ui</weblet-name>
      <weblet-class>
      net.java.dev.weblets.packaged.PackagedWeblet
      </weblet-class>
      <init-param>
      <param-name>package</param-name>
      <param-value>resources</param-value>
      </init-param>

      <weblet-mapping>
      <weblet-name>com.evolved.ui</weblet-name>
      <url-pattern>/resources/*</url-pattern>
      </weblet-mapping>
      </weblets-config>

      ---------------------------------------------------------------------------------------
      exception:
      java.lang.NullPointerException
      at org.apache.myfaces.renderkit.html.util.AutoScrollPhaseListener.afterPhase(AutoScrollPhaseListener.java:52)
      at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
      at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
      at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
      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:97)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      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:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)