2 Replies Latest reply on Nov 16, 2007 10:36 AM by darren hartford

    Remoting: Exception during loadResourceProviders

    Thomas Bauer Newbie

      Hi!

      I got my information from here http://docs.jboss.com/seam/2.0.0.CR2/reference/en/html/remoting.html

      please tell me what I did wrong.

      My setup is like this:

      app.ear
       ejb.jar
       com/acme/..
       META-INF
       components.xml
       ejb-jar.xml
       persistence.xml
       web.war
       <resources>
       WEB-INF
       lib/jboss-seam-remoting.jar
       web.xml
       jboss-seam-debug.jar
       jboss-seam.jar
      


      my components.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:core="http://jboss.com/products/seam/core"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=
       "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
      
       <core:init jndi-pattern="myapp/#{ejbName}/local"/>
      
      
      </components>
      
      


      my 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">
      
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/seam/resource/*</url-pattern>
       </servlet-mapping>
      
      </web-app>
      


      Now the problem is when accessing resources via seam/resource/*

      I get the follwing exception
      12:01:53,919 ERROR [[Seam Resource Servlet]] Allocate exception for servlet Seam Resource Servlet
      java.lang.NullPointerException
       at org.jboss.seam.servlet.SeamResourceServlet.loadResourceProviders(SeamResourceServlet.java:43)
       at org.jboss.seam.servlet.SeamResourceServlet.init(SeamResourceServlet.java:35)
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
       at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:637)
      


      I debugged the problem and here the NPE occurs:
       protected void loadResourceProviders()
       {
       Context tempApplicationContext = new ApplicationContext( new ServletApplicationMap(context) );
      
       Init init = (Init) tempApplicationContext.get(Init.class);
       /**
       * Here init == null !!
       */
       for (String name : init.getResourceProviders())
       {
       AbstractResource provider = (AbstractResource) tempApplicationContext.get(name);
       if (provider != null)
       {
       provider.setServletContext(context);
       providers.put( provider.getResourcePath(), provider );
       }
       }
       }
      


      Thank you,

      Thomas

        • 1. Re: Remoting: Exception during loadResourceProviders
          Thomas Bauer Newbie

          I 'solved' it:

          I forgot to include

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


          into my web.xml

          So the complete web.xml is now:
          <?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">
          
           <listener>
           <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
           </listener>
          
           <servlet>
           <servlet-name>Seam Resource Servlet</servlet-name>
           <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
           </servlet>
          
           <servlet-mapping>
           <servlet-name>Seam Resource Servlet</servlet-name>
           <url-pattern>/seam/resource/*</url-pattern>
           </servlet-mapping>
          
          </web-app>
          
          


          • 2. Re: Remoting: Exception during loadResourceProviders
            darren hartford Expert

            excellent, thanks for posting back, helped me!