Search code examples
javaspring-securitythymeleafweblogic12c

thymeleaf login error in weblogic server


I'm trying to login my application from IntelliJ and everythihg is OK! But when I deploy same program to weblogic server, I can not log in the system. In weblogic logs;

<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.>

here is my html form;

<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>

here is login controller;

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

screenshot: login request

Request URL:http://localhost:7001/Avantaj/admin/login Request Method:POST Status Code:302 Moved Temporarily Remote Address:[::1]:7001 Referrer Policy:no-referrer-when-downgrade Response Headers view source Date:Thu, 23 Nov 2017 12:48:17 GMT Location:http://localhost:7001/Avantaj/admin/home Transfer-Encoding:chunked Request Headers view source Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8 Accept-Encoding:gzip, deflate, br Accept-Language:tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7 Cache-Control:no-cache Connection:keep-alive Content-Length:80 Content-Type:application/x-www-form-urlencoded Cookie:JSESSIONID=1ED30C816EF25AC17194374E770CD346; jenkins-timestamper-offset=-10800000; jenkins-timestamper=system; jenkins-timestamper-local=false; Idea-1d074cc6=2bd3bbfa-1a60-4e9f-9163-645455c02386; ADMINCONSOLESESSION=Gk_o3QryHWiuNVoJJ0051hq_HIeAT52n6Ug8XuuZLXcdYm-DpXUj!1056880247; JSESSIONID=yqXo68oDWhjpgd-mxzd3JS4ZnL50ELUOTGOteLOimAWgcWyH1n7K!1056880247 Host:localhost:7001 Origin:http://localhost:7001 Pragma:no-cache Referer:http://localhost:7001/Avantaj/admin/login Upgrade-Insecure-Requests:1 User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36

secodPage: admin/home

Request URL:http://localhost:7001/Avantaj/admin/home Request Method:GET Status Code:302 Moved Temporarily Remote Address:[::1]:7001 Referrer Policy:no-referrer-when-downgrade Response Headers view source Cache-Control:no-cache, no-store, max-age=0, must-revalidate Connection:close Date:Thu, 23 Nov 2017 14:31:25 GMT Expires:0 Location:http://localhost:7001/Avantaj/admin/login Pragma:no-cache Set-Cookie:JSESSIONID=GirpSlveeYkuHjDH1Zww-WBtIaAjheHEgpkbWOSN1N6TEJzxLPag!-542853697; path=/; HttpOnly Transfer-Encoding:chunked Request Headers view source Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8 Accept-Encoding:gzip, deflate, br Accept-Language:tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7 Cache-Control:no-cache Connection:keep-alive Cookie:JSESSIONID=3996AB4039DC5F2230033D6B816C498F; jenkins-timestamper-offset=-10800000; jenkins-timestamper=system; jenkins-timestamper-local=false; Idea-1d074cc6=2bd3bbfa-1a60-4e9f-9163-645455c02386; ADMINCONSOLESESSION=Z_npKvR7H0hvii2TSvKQP086Yty0sxE3GYm9GYt3m8V-8b7UGvpN!-542853697; JSESSIONID=kYrpSjqm-XZ659r5LdoROvvp9NS5T8OC0MlQEJaIdrS2R5OSKAHg!-542853697 Host:localhost:7001 Pragma:no-cache Referer:http://localhost:7001/Avantaj/admin/login Upgrade-Insecure-Requests:1 User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/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();
}

Solution

  • Problem was occured weblogic server. I added some definition to weblogic.xml file. So the problem resolved.

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