Hi,
I think I've got something wrong, but I've been chasing my tail for an hour
here. The following stack trace always comes up no matter what I pass in for
the event.... Does anybody know what is going on?
16:10:51,192 ERROR ExceptionHandler:46 - No default handler could be found for
ActionBean of type: com.x.y.patient.PatientAction
net.sourceforge.stripes.exception.StripesServletException: No default handler
could be found for ActionBean of type: com.x.y.patient.PatientAction
at
net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getDefaultHandler(AnnotatedClassActionResolver.java:620)
at
net.sourceforge.stripes.controller.DispatcherHelper$2.intercept(DispatcherHelper.java:147)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
at
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
at
net.sourceforge.stripes.controller.DispatcherHelper.resolveHandler(DispatcherHelper.java:132)
at
net.sourceforge.stripes.controller.DispatcherServlet.resolveHandler(DispatcherServlet.java:253)
at
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:66)
at
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
at
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
at
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
at
net.sourceforge.stripes.mock.MockServletContext.acceptRequest(MockServletContext.java:255)
at
net.sourceforge.stripes.mock.MockRoundtrip.execute(MockRoundtrip.java:195)
at
test.com.x.y.unit.TestPatientAction.testGotoIndexPage(TestPatientAction.java:24)
at test.com.x.y.unit.TestPatientAction.testBody(TestPatientAction.java:17)
...
Here's the test
public class TestPatientAction extends TestFixture {
@Test
public void testBody() throws Exception {
testGotoIndexPage();
testPatientCreate();
}
private void testGotoIndexPage() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.execute(); // fail w/ no default handler
// trip.execute("createPatient"); gives same message
Assert.assertEquals(trip.getDestination(), Urls.PATIENT_CREATE);
}
private void testPatientCreate() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.addParameter("patient.name.first", "First");
trip.addParameter("patient.name.last", "Last");
trip.addParameter("patient.surgeon", "6");
trip.addParameter("patient.ctDate", "10/28/2011");
trip.execute(Events.PATIENT_CREATE);
Assert.assertNotNull(trip.getActionBean(PatientAction.class)
.getPatient().getId());
}
}
Here's the bean
@UrlBinding(ActionUrls.PATIENT)
public class PatientAction extends SecureActionBean<User, ActionBeanContext> {
@SpringBean
private PatientManager patientManager;
@ValidateNestedProperties({
@Validate(field="name.first", required=true),
@Validate(field="name.last", required=true),
@Validate(field="surgeon", required=true),
@Validate(field="ctDate", required=true)
})
private Patient patient;
@DontValidate
@DefaultHandler // there it is... only one occurrence
public Resolution gotoIndexPage() {
return forward(Urls.PATIENT_CREATE);
}
@HandlesEvent(Events.PATIENT_CREATE)
public Resolution createPatient() {
patientManager.create(getPatient(), getUser());
addMsg("patient.created");
return redirect(Home.class);
}
@HandlesEvent(Events.PATIENT_UPDATE)
public Resolution updatePatient() {
patientManager.update(getPatient(), getUser());
addMsg("patient.updated");
return redirect(Home.class);
}
public Patient getPatient() {
return this.patient;
}
public void setPatient(Patient patient) {
this.patient = patient;
}
}
???
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users