Basit
Basit

Reputation: 8606

getting error cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl'

I am new to spring web flow. I am practicing spring web flow and JSF. When i run the project i get the following error

SEVERE: Servlet.service() for servlet [appServlet] in context with path 
[/ch18_SpringWebFlowAndJSF] threw exception [Request processing failed; nested 
exception is org.springframework.webflow.execution.ActionExecutionException: 
Exception thrown executing [AnnotatedAction@6e72e380 targetAction = 
[EvaluateAction@38b62126 expression = contactController.newContactListBean(), 
resultExpression = viewScope.contactListBean], attributes = map[[empty]]] in state 
'start' of flow 'contacts' -- action execution attributes were 'map[[empty]]'] with 
root cause

org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or 
property 'contactController' cannot be found on object of type 
'org.springframework.webflow.engine.impl.RequestControlContextImpl'

Here is my controller

@Component("contactController")
public class ContactController {

    private static final Logger logger = LoggerFactory.getLogger(ContactController.class);

    @Autowired
    private ContactService contactService;

    @Autowired
    private HobbyService hobbyService;

    public ContactListBean newContactListBean() {

        ContactListBean contactListBean = new ContactListBean();
        contactListBean.setContacts(contactService.findAll());
        return contactListBean; 
    }

} //end of class ContactController

Here is my flow.xml

<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
                    http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="start" >

<view-state id="start" view="list.xhtml">
    <on-entry>
        <evaluate expression="contactController.newContactListBean()" result="viewScope.contactListBean"/>
    </on-entry>

    <transition on="view" to="show">
        <set name="requestScope.contactId" value="contactListBean.selectedContact.id"/>
    </transition>

    <transition on="add" to="add-step-1">
        <evaluate expression="contactController.newContactBean()" result="flowScope.contactBean"/>
    </transition>
</view-state>

...

<global-transitions>
    <transition on="exit" to="start"/>
</global-transitions>


</flow>

When i debug my code, then it comes to newContactListBean() method. But after that it gives the error.

What i am doing wrong ?

Thanks

Upvotes: 2

Views: 5752

Answers (1)

Inayathulla
Inayathulla

Reputation: 1721

Make sure to use

<context:annotation-config />
<context:component-scan base-package="your base package" />

in your applicationContext.xml file

Upvotes: 1

Related Questions