代码之家  ›  专栏  ›  技术社区  ›  stephan

weblogic服务器中的thymeleaf登录错误

  •  1
  • stephan  · 技术社区  · 8 年前

    我正在尝试从IntelliJ登录我的应用程序,一切正常!但是,当我将相同的程序部署到weblogic server时,我无法登录系统。在weblogic日志中;

    <The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.> 
    <The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.> 
    <The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.> 
    <The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.>
    

    这是我的html表单;

    <form class="col s12" action="#" th:action="@{/admin/login}" method="post">
        <div class="row">
            <div class="input-field col s6 offset-s3">
                <input name="username" id="first_name" type="text" class="validate">
                <label for="first_name">user:</label>
            </div>
        </div>
    
        <div class="row">
            <div class="input-field col s6 offset-s3">
                <input name="password" id="password" type="password" class="validate">
                <label for="password">pass:</label>
            </div>
        </div>
    
        <button class="btn waves-effect waves-light col s2 offset-s3 cyan" type="submit" name="action">
            login <i class="material-icons right">send</i>
        </button>
    </form>
    

    这是登录控制器;

    @RequestMapping(value = "admin/login")
    public String liste() {
        return "login";
    }
    

    截图: login request

    请求URL: http://localhost:7001/Avantaj/admin/login 要求 方法:POST状态代码:302暂时远程移动 地址:[:::1]:7001推荐人策略:降级响应时无推荐人 标题查看源日期:2017年11月23日星期四12:48:17 GMT 位置: http://localhost:7001/Avantaj/admin/home 传输编码:分块请求头视图源 接受:text/html、application/xhtml+xml、application/xml;q=0.9,图像/网络处理器,图像/apng, / ;q=0.8 接受编码:gzip,deflate,br 接受语言:tr tr,tr;q=0.9,en-US;q=0.8,en;q=0.7 缓存控制:无缓存连接:保持活动内容长度:80 内容类型:application/x-www-form-urlencoded Cookie:JSESSIONID=1ED30C816EF25AC17194374E770CD346; jenkins时间戳偏移量=-10800000;jenkins时间戳=系统; jenkins时间戳局部=false; Idea-1d074cc6=2BD3BFA-1a60-4e9f-9163-645455c02386; JSESSIONID=yqXo68oDWhjpgd-MXZD3JS4ZNL50ELOUTGOTELOIMACWYH1N7K!1056880247 主机:本地主机:7001来源: http://localhost:7001 Pragma:无缓存 推荐人: http://localhost:7001/Avantaj/admin/login 升级不安全请求:1个用户代理:Mozilla/5.0(Windows NT 6.1; Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/62.0.3202.94 狩猎/537.36

    第二页:管理员/主页

    请求URL: http://localhost:7001/Avantaj/admin/home 要求 方法:获取状态代码:302临时移动远程地址:[:::1]:7001 推荐人策略:降级响应标题视图时没有推荐人 源缓存控制:无缓存,无存储,最大年龄=0,必须重新验证 连接:关闭日期:2017年11月23日星期四14:31:25 GMT到期时间:0 http://localhost:7001/Avantaj/admin/login Pragma:无缓存 设置Cookie:JSESSIONID=girpslveykuhjdh1zww-wbtiaajhegpkbwosn1n6tejzxlpag-542853697; 路径=/;HttpOnly传输编码:分块请求头视图源 接受:text/html、application/xhtml+xml、application/xml;q=0.9,图像/网络处理器,图像/apng, / ;q=0.8 接受编码:gzip,deflate,br 接受语言:tr tr,tr;q=0.9,en-US;q=0.8,en;q=0.7 缓存控制:无缓存连接:保持活动状态 Cookie:JSESSIONID=3996AB4039DC5F2230033D6B816C498F; jenkins时间戳偏移量=-10800000;jenkins时间戳=系统; jenkins时间戳局部=false; Idea-1d074cc6=2BD3BFA-1a60-4e9f-9163-645455c02386; ADMINCONSOLESESSION=Z_npKvR7H0hvii2TSvKQP086Yty0sxE3GYm9GYt3m8V-8b7UGvpN-542853697; JSESSIONID=kYrpSjqm-XZ659r5LdoROvvp9NS5T8OC0MlQEJaIdrS2R5OSKAHg-542853697 主机:localhost:7001 Pragma:无缓存 推荐人: http://localhost:7001/Avantaj/admin/login 升级不安全请求:1个用户代理:Mozilla/5.0(Windows NT 6.1; Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/62.0.3202.94 狩猎/537.36

    springSecurityConfig:

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        enhancer.addRecaptchaSupport(http.formLogin()).loginPage("/admin/login").permitAll()
            .and().csrf().ignoringAntMatchers("/api/**")
            .and().authorizeRequests().antMatchers("/admin/**").fullyAuthenticated()
            .and().headers().defaultsDisabled().cacheControl();
    }
    
    2 回复  |  直到 7 年前
        1
  •  0
  •   juanlumn    8 年前

    试试:

    @PostMapping("/admin/login")
    public String liste() {
      return "login";
    }
    

    以您的形式:

    <form class="col s12" action="#" th:action="@{/admin/login}" method="post">
    ...
    
        2
  •  0
  •   stephan    8 年前

    weblogic服务器出现问题。我给weblogic添加了一些定义。xml文件。于是问题解决了。

        <wls:session-descriptor>
            <wls:cookie-path>/myApplicationPath</wls:cookie-path>
        </wls:session-descriptor>