If spring is included in the project every JSP must have a backing bean and
view.
---------------------------------------------------------------------------------
Key: SHALE-192
URL: http://issues.apache.org/struts/browse/SHALE-192
Project: Shale
Type: Bug
Components: Core, Tiger
Versions: 1.0.1
Environment: Linxu SUSE 10, Tomcat 5.5.17, Shale, Tiger, Tiles, Spring
Reporter: Martin Phee
I'm just starting an application and new to shale. I'm using shale with tiger
and incuded most of the libraries including spring. I created/copied a simple
jsp that had a managed bean and view. I then created a "Success" jsp that you
can see below in the navigation rule. If the success jsp didn't have a managed
bean associated with it then I'd get a 500 with the stack trace (which is at
the end). Once I removed the spring libraries (they weren't being used yet)
everything worked fine. Also, if I did associate a managed been with the
Success.jsp it worked fine.
This is from my post on the struts user list:
I'm using Shale with tiger.
JSP, subscribe (example from somewhere) that does a save. All this works fine,
but I made a change so that the return should send it to a "Success" page.
<navigation-rule>
<from-view-id>/subscribe.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/success.jsp</to-view-id>
</navigation-case>
</navigation-rule>
I kept getting a 500 error:
12:11:39,292 ERROR [faces]:253 - Servlet.service() for servlet faces threw
exception
java.lang.IllegalStateException: No WebApplicationContext found: no
ContextLoaderListener registered?
I then created a Success bean
@Bean(name="success", scope= Scope.SESSION)
@View
public class Success
{
}
And then everything worked. Do I always need a View behind my jsp's or am I
doing something wrong?
@Bean(name="subscrHandler", scope = Scope.REQUEST)
public class SubscriberHandler {
@Value("#{subscribe}")
private Subscriber subscriber;
public void setSubscriber(Subscriber subscriber) {
this.subscriber = subscriber;
}
public String saveSubscriber( ) {
subscriber.save( );
return "success";
}
}
Exception and Success.jsp
13:27:47,796 ERROR [faces]:253 - Servlet.service() for servlet faces threw
exception
java.lang.IllegalStateException: No WebApplicationContext found: no
ContextLoaderListener registered?
at
org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:78)
at
org.springframework.web.jsf.DelegatingVariableResolver.getWebApplicationContext(DelegatingVariableResolver.java:134)
at
org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:112)
at
org.apache.shale.spring.WebApplicationContextVariableResolver.resolveVariable(WebApplicationContextVariableResolver.java:87)
at
org.apache.shale.view.faces.ViewViewHandler.setupViewController(ViewViewHandler.java:285)
at
org.apache.shale.view.faces.ViewViewHandler.createView(ViewViewHandler.java:130)
at
org.apache.shale.tiles.TilesViewHandler.createView(TilesViewHandler.java:184)
at
org.apache.myfaces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:145)
at
org.apache.shale.dialog.faces.DialogNavigationHandler.handleNavigation(DialogNavigationHandler.java:196)
at
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
at
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:275)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Succes.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Rejected!</TITLE>
</HEAD>
<BODY>
<CENTER>
<TABLE BORDER=5>
<TR><TH CLASS="TITLE">Success!</TH></TR>
</TABLE>
<H2>You have been successfully registered.</H2>
</CENTER>
</BODY></HTML>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira