Spring Boot + PrimeFaces: IllegalArgumentException when using ajax calls

UI Components for JSF
Post Reply
SebastianG
Posts: 4
Joined: 01 Jun 2018, 11:03

01 Jun 2018, 11:06

Hi,

i have a basic setup using spring boot and joinfaces to use primefaces and bootsfaces in my application.

Using for example bootsfaces components and perform ajax calls works like a charm.
When i add a simple primefaces component which uses ajax, the call fails and i get the following exception:

Code: Select all

    j.e.resource.webcontainer.jsf.context    : java.lang.IllegalArgumentException: Unrecognized Content Type.
	at com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:283)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.createResponseWriter(FaceletViewHandlingStrategy.java:1160)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:438)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:194)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:126)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
It does not matter if i just use a button like in this example:

Code: Select all

<h:form>
	   <p:commandButton value="Add" ajax="true" actionListener="#{pingResultBean.onAction}" />
    </h:form>
or using any other primefaces component which fires ajax calls.
Clicking the button will raise the descriped exception

I have Spring security enabled and using following configuration:

Code: Select all

 http
            .authorizeRequests()
                .antMatchers("/login*").permitAll()
                .antMatchers("/logout*").permitAll()
                .antMatchers("/js/**").permitAll()
                .antMatchers("/css/**").permitAll()
                .antMatchers("/javax.faces.resource/**").permitAll()
                .anyRequest().authenticated()
            .and()
                .formLogin()
                .loginPage("/login.xhtml")
                .defaultSuccessUrl("/index.xhtml")
                .failureUrl("/login.xhtml?error=1")
            .and()
                .csrf().disable()
                .logout().logoutSuccessUrl("/login.xhtml?logout");
All other ajax calls are working.
Would be nice if someone can help me.

Ireth
Posts: 4
Joined: 20 May 2013, 10:07

14 Dec 2018, 20:51

I had the same problem. I removed the content type from the <f:view> tag and problem was solved.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests