Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url 在Jboss Spring集成web项目中未找到URI为的HTTP请求的映射_Url_Spring Mvc_Jboss_Mapping_Integration - Fatal编程技术网

Url 在Jboss Spring集成web项目中未找到URI为的HTTP请求的映射

Url 在Jboss Spring集成web项目中未找到URI为的HTTP请求的映射,url,spring-mvc,jboss,mapping,integration,Url,Spring Mvc,Jboss,Mapping,Integration,嗨,我遇到的问题与URL映射有关,这让我很困惑 该项目是JBossSpring集成。 项目启动时没有出错,但我一直收到以下消息: 8:53:58959警告[PageNotFound]在名为“NUSLibraries”的DispatcherServlet中找不到URI为[/frontend/portal/afasfas/asdsad]的HTTP请求的映射 18:54:08992警告[PageNotFound]在名为“NUSLibraries”的DispatcherServlet中找不到URI为[/

嗨,我遇到的问题与URL映射有关,这让我很困惑

该项目是JBossSpring集成。 项目启动时没有出错,但我一直收到以下消息:

8:53:58959警告[PageNotFound]在名为“NUSLibraries”的DispatcherServlet中找不到URI为[/frontend/portal/afasfas/asdsad]的HTTP请求的映射

18:54:08992警告[PageNotFound]在名为“NUSLibraries”的DispatcherServlet中找不到URI为[/frontend/portal/afasfas]的HTTP请求的映射

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>frontend</display-name>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.seam</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>org.richfaces.SKIN</param-name>
    <param-value>blueSky</param-value>
  </context-param>
  <listener>
    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
  </listener>
  <filter>
    <filter-name>Seam Filter</filter-name>
    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>Seam Filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <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>
  <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <security-constraint>
    <display-name>Restrict raw XHTML Documents</display-name>
    <web-resource-collection>
      <web-resource-name>XHTML</web-resource-name>
      <url-pattern>*.xhtml</url-pattern>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>

  <servlet>
    <servlet-name>NUSLibraries</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>NUSLibraries</servlet-name>
    <url-pattern>/portal/*</url-pattern>
  </servlet-mapping>  

</web-app>
servlet.xml

<?xml version="1.0" encoding="UTF-8"?>                           
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:seam="http://jboss.com/products/seam/spring-seam"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://jboss.com/products/seam/spring-seam
                        http://jboss.com/products/seam/spring-seam-2.2.xsd">

    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" > 
        <property name="suffix">        
            <value>.xhtml</value>       
        </property> 
    </bean>

  <!-- Controller -->
  <bean id="SpringController" class="org.domain.frontend.controller.SpringController" scope="prototype">
    <property name="portalStaticPage" ref="ActionPortalStaticPage">
    </property>
  </bean>

  <seam:instance name="ActionPortalStaticPage" id="ActionPortalStaticPage" create="false"/>  

  <bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>
               /*/*/*=SpringController
            </value>
        </property>
  </bean>

</beans>
弹簧控制器

package org.domain.frontend.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;

import javax.persistence.NoResultException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.domain.frontend.session.ActionPortalStaticPage;
import org.jboss.seam.annotations.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.support.RequestContextUtils;


@Controller
@Transactional
public class SpringController{

    static Logger log = Logger.getLogger("SpringController");
    public ActionPortalStaticPage portalStaticPage; 

    public void setPortalStaticPage(ActionPortalStaticPage portalStaticPage) {
        this.portalStaticPage = portalStaticPage;
    }


    @RequestMapping("/*/*/{param}")
    public ModelAndView langzh(HttpServletRequest request, HttpServletResponse response, @PathVariable("param") String param) throws Exception {

        List<String> params = new ArrayList<String>();
        try{
            log.info("param("+param+")");
            StringTokenizer st = new StringTokenizer(param,"-");
            while (st.hasMoreTokens()) {
                params.add(st.nextToken());
            }
            portalStaticPage.setTitle(params.toString());
            log.info("portalStaticPage("+portalStaticPage.getTitle()+")");
            return new ModelAndView("index");
        }
        catch(Exception ex){
            ex.printStackTrace();
            return new ModelAndView(params.get(0));

        }           
    }
}
您的handlerMapping似乎过于复杂。如果要将所有请求映射到单个控制器,则只需将其标记为默认映射:

<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
   <property name="defaultHandler" value="SpringController"/>
</bean>