7 Replies Latest reply on Mar 25, 2008 6:18 AM by Darran Lofthouse

    Servlet regarded as ServiceEndPoint

    Karl de Boer Newbie

      Hi,

      i aa using jboss 404GA and JBossWS 1.0.1. The web application contains both web service endpoints and servlets. However if i try to call the servlet i get the following error:


      
      org.jboss.ws.WSException: Cannot obtain endpoint for: jboss.ws:context=mapserver/1.0,endpoint=MapDefinitionsCacheRefresher
       org.jboss.ws.server.StandardEndpointServlet.initServiceEndpoint(StandardEndpointServlet.java:156)
       org.jboss.ws.integration.jboss.JBossServiceEndpointServlet.initServiceEndpoint(JBossServiceEndpointServlet.java:49)
       org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:73)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
      


      The MapDefinitionsCacheRefresher is the class name of the servlet name 'refresh'. It is not a webservice endpoint. What is going on? This combination has worked before using the old WS stack. The new stack is much better but this is a strange side effect i cannot explain.
      Suggestions are welcome or is this a bug. I have checked jira but could not find anything related.

      Karl


        • 1. Re: Servlet regarded as ServiceEndPoint
          Heiko Braun Master

          Could you post your deployment descriptors?

          • 2. Re: Servlet regarded as ServiceEndPoint
            Gerbrand de Goeij Newbie

            Heiko,

            Due to a short holiday of Karl, I will try to provide you with the requested information.

            The web app war is also wrapped in an EAR. So the deployment descriptors of the EAR file are as follows:

            application.xml
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE application PUBLIC
            "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
            "http://java.sun.com/dtd/application_1_3.dtd">

            <display-name>jmapserver-ear</display-name>


            <web-uri>jmapserver-war-1.0-SNAPSHOT.war</web-uri>
            <context-root>/mapserver/1.0</context-root>




            jboss-app.xml
            <?xml version='1.0' encoding='UTF-8' ?>
            <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
            <jboss-app>
            <loader-repository>nl.denhaag.gbd:loader=jmapserver
            <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
            </loader-repository>
            </jboss-app>

            The deployment descriptors of the WAR are:

            web.xml
            <?xml version="1.0"?>
            <web-app 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"
            version="2.4">

            <display-name>MapServerWAR</display-name>
            <context-param>
            .........
            </context-param>

            Listener responsible for binding and unbinding a MapServer Definitions Cache
            <listener-class>nl.denhaag.gbd.mapserver.service.definitions.MapCreationDefinitionContextBinding</listener-class>


            Listener responsible for binding web xml context params in JNDI
            <listener-class>nl.denhaag.gbd.mapserver.service.impl.MapServerPropsManager</listener-class>


            <servlet-name>MapServer</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.MapServer_Impl</servlet-class>

            <!-- servlet>
            Servlet Bridge to new WebService
            <display-name>ServletToServiceBridge</display-name>
            <servlet-name>ServletToServiceBridge</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.bridge.ServletToServiceBridge</servlet-class>
            </servlet-->

            Fetches objectfoto files and streams them to the client
            <display-name>ObjectFotoFetcher</display-name>
            <servlet-name>ObjectFotoFetcher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.ObjectFotoFetcher</servlet-class>


            Fetches internetfoto files and streams them to the client
            <display-name>InternetFotoFetcher</display-name>
            <servlet-name>InternetFotoFetcher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.InternetFotoFetcher</servlet-class>


            Fetches peilpuntfoto files and streams them to the client
            <display-name>PeilPuntFotoFetcher</display-name>
            <servlet-name>PeilPuntFotoFetcher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.PeilPuntFotoFetcher</servlet-class>


            Fetches cyclorama files and streams them to the client
            <display-name>CycloramaFetcher</display-name>
            <servlet-name>CycloramaFetcher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.CycloramaFetcher</servlet-class>


            Fetches maps that have been previously generated by GeoMedia
            <display-name>KaartFetcher</display-name>
            <servlet-name>KaartFetcher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.KaartFetcher</servlet-class>


            Servlet whcih refresshes the cache
            <display-name>MapDefinitionsCacheRefresher</display-name>
            <servlet-name>MapDefinitionsCacheRefresher</servlet-name>
            <servlet-class>nl.denhaag.gbd.mapserver.service.impl.MapDefinitionsCacheRefresher</servlet-class>

            <servlet-mapping>
            <servlet-name>MapDefinitionsCacheRefresher</servlet-name>
            <url-pattern>/refresh</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>MapServer</servlet-name>
            <url-pattern>/MapServer</url-pattern>
            </servlet-mapping>
            <!-- servlet-mapping>
            <servlet-name>ServletToServiceBridge</servlet-name>
            <url-pattern>/getMap</url-pattern>
            </servlet-mapping-->

            <servlet-mapping>
            <servlet-name>ObjectFotoFetcher</servlet-name>
            <url-pattern>/ObjectfotoFetcher</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>InternetFotoFetcher</servlet-name>
            <url-pattern>/InternetFotoFetcher</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>PeilPuntFotoFetcher</servlet-name>
            <url-pattern>/PeilpuntFotoFetcher</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>CycloramaFetcher</servlet-name>
            <url-pattern>/CycloramaFetcher</url-pattern>
            </servlet-mapping>
            <servlet-mapping>
            <servlet-name>KaartFetcher</servlet-name>
            <url-pattern>/KaartFetcher/*</url-pattern>
            </servlet-mapping>
            <service-ref>
            <service-ref-name>service/MapServer</service-ref-name>
            <service-interface>nl.denhaag.gbd.mapserver.service.MapServerService</service-interface>
            <wsdl-file>WEB-INF/wsdl/MapServer.wsdl</wsdl-file>
            <jaxrpc-mapping-file>WEB-INF/wsdl/jaxrpc-mapping-client.xml</jaxrpc-mapping-file>
            </service-ref>
            </web-app>

            webservices.xml
            <?xml version="1.0" encoding="UTF-8"?>
            <webservices
            xmlns="http://java.sun.com/xml/ns/j2ee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:tns="http://gbd.denhaag.nl/mapserver/1.0"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
            version="1.1">

            <webservice-description>
            <webservice-description-name>MapServerService</webservice-description-name>
            <wsdl-file>WEB-INF/wsdl/MapServer.wsdl</wsdl-file>
            <jaxrpc-mapping-file>WEB-INF/wsdl/jaxrpc-mapping-client.xml</jaxrpc-mapping-file>
            <port-component>
            <port-component-name>mapserver</port-component-name>
            <wsdl-port>tns:MapServerPort</wsdl-port>
            <service-endpoint-interface>nl.denhaag.gbd.mapserver.service.MapServer</service-endpoint-interface>
            <service-impl-bean>
            <servlet-link>MapServer</servlet-link>
            </service-impl-bean>
            </port-component>
            </webservice-description>

            • 3. Re: Servlet regarded as ServiceEndPoint
              Heiko Braun Master

              I know there was a discussion a while ago. After looking into the the sources i now remember:

              ServiceEndpointPublisher:155 ff
              
               // Check if it is a real servlet that we can ignore
              
               if (servletClassName.endsWith("Servlet"))
               {
               log.info("Ignore <servlet-class> that ends with 'Servlet': " + servletClassName);
               continue;
               }
              


              JBossWS expects the 'real' Servlet's classname to end with 'Servlet'. This may not be the most elegant solution, but at this deployment stage we don't have control over the classload and therefore can't do 'instance of'.

              Just rename your servlet classes to *Servlet.java" and everything should be fine.

              • 4. Re: Servlet regarded as ServiceEndPoint
                Karl de Boer Newbie

                Thanks for the answer. I can fix this for our own code.
                But we are also using novell extend portal code and we don not have control over this piece of software.
                I think it is a good idea to make this more 'elegant'

                • 6. Re: Servlet regarded as ServiceEndPoint
                  Jonn Beames Newbie

                  I just ran into this using JBoss AS 4.0.5 with included JBossWS, and my servlet name DOES end with Servlet... turns out my web xml formatting was causing the endsWith("Servlet") to see more than the name string.

                  Changing:

                  <servlet>
                   <servlet-name>MyServlet</servlet-name>
                   <servlet-class>
                   com.example.MyServlet
                   </servlet-class>
                   ...
                  </servlet>

                  ..to:
                  <servlet>
                   <servlet-name>MyServlet</servlet-name>
                   <servlet-class>com.example.MyServlet</servlet-class>
                   ...
                  </servlet>

                  ...corrected the problem for me.