javax.el.PropertyNotFoundException : Target Unreachable, identifier 'login' resolved to null Spring + JSF -


i can't resolve problem getting null @autowired service. here's code.

my configuration file

applicationcontext.xml

<?xml version="1.0" encoding="utf-8"?>      <beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xmlns:context="http://www.springframework.org/schema/context"       xmlns:tx="http://www.springframework.org/schema/tx"       xmlns:p="http://www.springframework.org/schema/p"       xsi:schemalocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd         http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context-3.2.xsd          http://www.springframework.org/schema/tx          http://www.springframework.org/schema/tx/spring-tx.xsd">      <tx:annotation-driven transaction-manager="transactionmanager"/>     <context:annotation-config/>     <context:component-scan base-package="com.vulcan.controller.login" />     <context:component-scan base-package="com.vulcan.service.login" />     <context:component-scan base-package="com.vulcan.dao.tenant" /> ........ 

web.xml

<?xml version="1.0" encoding="utf-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">     <context-param>          <param-name>contextconfiglocation</param-name>          <param-value>/web-inf/applicationcontext.xml</param-value>      </context-param>      <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>     <listener>         <listener-class>org.springframework.web.context.request.requestcontextlistener</listener-class>     </listener>.... 

faces-config.xml

<?xml version='1.0' encoding='utf-8'?> <faces-config version="2.2"     xmlns="http://xmlns.jcp.org/xml/ns/javaee"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">     <application>         <variable-resolver>             org.springframework.web.jsf.delegatingvariableresolver         </variable-resolver>     </application>     <application>         <el-resolver>org.springframework.web.jsf.el.springbeanfaceselresolver</el-resolver>     </application>........ 

my code

loginserviceimpl.java

@service public class loginserviceimpl implements loginservice{      @autowired     tenantdao tenantdao;      @transactional     @override     public string gettenantidentifier(string email, string password) { .... 

logincontroller.java

@component @scope("session") @qualifier("login") public class logincontroller  {      private string email;     private string password;     private string tenantid;      @autowired      loginservice loginservice;      public void dologin() {         this.tenantid = loginservice.gettenantidentifier(email, password); .. 

login.xhtml

<ui:define name="content">     <h:form id="form">            <p:growl id="growl" showdetail="true" life="3000" />           <h:panelgrid columns="2" cellpadding="5">               <h:outputlabel for="username" value="username:" />               <p:inputtext value="#{login.email}" id="username" required="true" label="username"/>             <h:outputlabel for="password" value="password:" />               <p:inputtext value="#{login.password}" id="password" required="true" label="password" type="password" />               <f:facet name="footer">                   <p:commandbutton id="loginbutton" value="login" update="growl" action="#{login.dologin()}"/>               </f:facet>           </h:panelgrid>       </h:form>            </ui:define> 

so choose use spring manage of beans. here's i've done resolve problem (but still no result)

  1. i tried use inject jsf @managedbean logincontroller, , @managedproperty loginservice. got null pointer after invoke dologin(). said loginservice has null pointer.

  2. after tried use spring injection logincontroller can see above, got error.

    /login.xhtml @21,109 value="#{login.email}": target unreachable, identifier 'login' resolved null

anyone can me ? follow , try many suggestion in forum, nothing's work.

finally figured out, need remove @qualifier annotation , edit @component annotation @component("login").

what silly mistakes...


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -