java - org.springframework.web.client.HttpClientErrorException: 415 Unsupported Media Type: javax.faces.FacesException: -


i working on login page client , server using users table created on mysql database. keep getting following error message , i'm not sure why. thoughts?

warning [javax.enterprise.resource.webcontainer.jsf.lifecycle] (default task-14) #{userbean.login()}: org.springframework.web.client.httpclienterrorexception: 415 unsupported media type: javax.faces.facesexception: #{userbean.login()}: org.springframework.web.client.httpclienterrorexception: 415 unsupported media type     @ com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:118)     @ javax.faces.component.uicommand.broadcast(uicommand.java:315)     @ javax.faces.component.uiviewroot.broadcastevents(uiviewroot.java:790)     @ javax.faces.component.uiviewroot.processapplication(uiviewroot.java:1282)     @ com.sun.faces.lifecycle.invokeapplicationphase.execute(invokeapplicationphase.java:81)     @ com.sun.faces.lifecycle.phase.dophase(phase.java:101)     @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:198)     @ javax.faces.webapp.facesservlet.service(facesservlet.java:658)     @ io.undertow.servlet.handlers.servlethandler.handlerequest(servlethandler.java:85)     @ io.undertow.servlet.handlers.filterhandler$filterchainimpl.dofilter(filterhandler.java:129)     @ com.cooksys.filter.loginfilterbean.dofilter(loginfilterbean.java:43)     @ org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:344)     @ org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:261)     @ io.undertow.servlet.core.managedfilter.dofilter(managedfilter.java:60)     @ io.undertow.servlet.handlers.filterhandler$filterchainimpl.dofilter(filterhandler.java:131)     @ io.undertow.servlet.handlers.filterhandler.handlerequest(filterhandler.java:84)     @ io.undertow.servlet.handlers.security.servletsecurityrolehandler.handlerequest(servletsecurityrolehandler.java:62)     @ io.undertow.servlet.handlers.servletdispatchinghandler.handlerequest(servletdispatchinghandler.java:36)     @ org.wildfly.extension.undertow.security.securitycontextassociationhandler.handlerequest(securitycontextassociationhandler.java:78)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43)     @ io.undertow.servlet.handlers.security.sslinformationassociationhandler.handlerequest(sslinformationassociationhandler.java:131)     @ io.undertow.servlet.handlers.security.servletauthenticationcallhandler.handlerequest(servletauthenticationcallhandler.java:57)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43)     @ io.undertow.security.handlers.abstractconfidentialityhandler.handlerequest(abstractconfidentialityhandler.java:46)     @ io.undertow.servlet.handlers.security.servletconfidentialityconstrainthandler.handlerequest(servletconfidentialityconstrainthandler.java:64)     @ io.undertow.security.handlers.authenticationmechanismshandler.handlerequest(authenticationmechanismshandler.java:60)     @ io.undertow.servlet.handlers.security.cachedauthenticatedsessionhandler.handlerequest(cachedauthenticatedsessionhandler.java:77)     @ io.undertow.security.handlers.notificationreceiverhandler.handlerequest(notificationreceiverhandler.java:50)     @ io.undertow.security.handlers.abstractsecuritycontextassociationhandler.handlerequest(abstractsecuritycontextassociationhandler.java:43)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43)     @ org.wildfly.extension.undertow.security.jacc.jacccontextidhandler.handlerequest(jacccontextidhandler.java:61)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43)     @ io.undertow.servlet.handlers.servletinitialhandler.handlefirstrequest(servletinitialhandler.java:284)     @ io.undertow.servlet.handlers.servletinitialhandler.dispatchrequest(servletinitialhandler.java:263)     @ io.undertow.servlet.handlers.servletinitialhandler.access$000(servletinitialhandler.java:81)     @ io.undertow.servlet.handlers.servletinitialhandler$1.handlerequest(servletinitialhandler.java:174)     @ io.undertow.server.connectors.executeroothandler(connectors.java:202)     @ io.undertow.server.httpserverexchange$1.run(httpserverexchange.java:793)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ java.lang.thread.run(unknown source) 

server side web.xml:

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xmlns="http://xmlns.jcp.org/xml/ns/javaee"     xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee      http://xmlns.jcp.org/xml/ns/javaee/web-     app_3_1.xsd"     id="webapp_id" version="3.1">     <display-name>backend</display-name>     <servlet>         <servlet-name>mvc-dispatcher</servlet-name>         <servlet-class>             org.springframework.web.servlet.dispatcherservlet         </servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>      <servlet-mapping>         <servlet-name>mvc-dispatcher</servlet-name>         <url-pattern>/</url-pattern>     </servlet-mapping> </web-app> 

mvc-dispacher-servlet:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="     http://www.springframework.org/schema/beans          http://www.springframework.org/schema/beans/spring-beans.xsd     http://www.springframework.org/schema/context      http://www.springframework.org/schema/context/spring-context.xsd     http://www.springframework.org/schema/mvc     http://www.springframework.org/schema/mvc/spring-mvc.xsd     http://www.springframework.org/schema/tx     http://www.springframework.org/schema/tx/spring-tx.xsd">  <context:component-scan base-package="com.server" />  <mvc:annotation-driven />  <bean id="datasource" class="org.apache.commons.dbcp2.basicdatasource"     destroy-method="close">     <property name="driverclassname" value="com.mysql.jdbc.driver" />     <property name="url" value="jdbc:mysql://localhost:3306/serverclient" />     <property name="username" value="demo" />     <property name="password" value="demo" /> </bean>  <bean id="sessionfactory"         class="org.springframework.orm.hibernate4.localsessionfactorybean">     <property name="datasource" ref="datasource" />     <property name="configlocation" value="classpath:hibernate.cfg.xml" /> </bean> 

server side pom file:

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelversion>4.0.0</modelversion>   <groupid>backend</groupid>   <artifactid>cooksysback</artifactid>   <version>0.0.1-snapshot</version>    <dependencies>         <dependency>             <groupid>org.hibernate</groupid>             <artifactid>hibernate-core</artifactid>             <version>4.3.8.final</version>         </dependency>         <dependency>             <groupid>mysql</groupid>             <artifactid>mysql-connector-java</artifactid>             <version>5.1.34</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-web</artifactid>             <version>4.1.5.release</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-webmvc</artifactid>             <version>4.1.5.release</version>         </dependency>         <dependency>             <groupid>org.springframework</groupid>             <artifactid>spring-orm</artifactid>             <version>4.1.5.release</version>         </dependency>         <dependency>             <groupid>org.apache.commons</groupid>             <artifactid>commons-dbcp2</artifactid>             <version>2.0</version>         </dependency>     </dependencies>    <packaging>war</packaging>   <build>     <sourcedirectory>src</sourcedirectory>     <plugins>       <plugin>         <artifactid>maven-compiler-plugin</artifactid>         <version>3.3</version>         <configuration>           <source>1.8</source>           <target>1.8</target>         </configuration>       </plugin>       <plugin>         <artifactid>maven-war-plugin</artifactid>         <version>2.6</version>         <configuration>           <warsourcedirectory>webcontent</warsourcedirectory>           <failonmissingwebxml>false</failonmissingwebxml>         </configuration>       </plugin>     </plugins>   </build> </project> 

web.xml on client side:

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xmlns="http://xmlns.jcp.org/xml/ns/javaee"     xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"     id="webapp_id" version="3.1">     <display-name>frontend</display-name>     <filter>         <filter-name>loginfilterbean</filter-name>         <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class>     </filter>     <filter-mapping>         <filter-name>loginfilterbean</filter-name>         <url-pattern>*.xhtml</url-pattern>     </filter-mapping>     <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>     <listener>         <listener-class>             org.springframework.web.context.request.requestcontextlistener</listener-class>     </listener>     <context-param>         <param-name>primefaces.theme</param-name>         <param-value>cupertino</param-value>     </context-param>     <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>*.xhtml</url-pattern>     </servlet-mapping>     <welcome-file-list>         <welcome-file>login.xhtml</welcome-file>     </welcome-file-list> </web-app> 

login.xhtml:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml"       xmlns:ui="http://java.sun.com/jsf/facelets"       xmlns:f="http://java.sun.com/jsf/core"       xmlns:h="http://java.sun.com/jsf/html"       xmlns:p="http://primefaces.org/ui">   <h:head></h:head>  <h:body style="background-color:rgb(128,128,128)">  <h:form>          <p:growl id="msgs" showdetail="true" />          <p:panel id="basic" header="login page" style="margin-bottom:20px;float:right;width:100%;height:10%;" >             <h:panelgrid columns="9" cellpadding="2" style="margin-bottom:20px;float:left">              <p:graphicimage value="logo.png" />                  <h:outputtext value="username" for="username" />                   <p:inputtext id="username" value="#{userbean.username}">                  </p:inputtext> <p:message for="username" />             <h:outputtext value="password" for="password" />                 <p:password id="password" value="#{userbean.password}" >                  </p:password> <p:message for="password" />                  <p:commandbutton value="login" id="ajax"                     action="#{userbean.login()}" />               </h:panelgrid>         </p:panel>          </h:form>           <div>         <h:form>          <p:growl id="msg" showdetail="true" />          <p:panel id="basic1" header="registration page" style="margin-bottom:20px;float:right;width:100%;height:90%;">             <h:panelgrid cellpadding="0">           <h:outputlabel  value="first name:" />                          <p:inputtext id="firstname" value="enter first name">                  </p:inputtext> <p:message for="firstname" />                    <h:outputlabel  value="last name:" />                  <p:inputtext id="lastname" value="enter last name">                  </p:inputtext> <p:message for="lastname" />                   <h:outputlabel  value="username:" />                 <p:inputtext id="username" value="enter username">                  </p:inputtext> <p:message for="username" />               <h:outputlabel value="password:" />                  <p:password id="password" value="enter password" >                  </p:password> <p:message for="password" />                    <p:commandbutton value="register" id="ajax"                     action="#" />               </h:panelgrid>         </p:panel>      </h:form> </div> </h:body>  </html> 


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -