Re: IllegalStateException: setStateManager may not be executed after a lifecycle request has been completed
Hi guys, We understood why the exception was thrown when deploying on the Solaris Server. Our Solaris server is running in GMT timezone, our local environment is GMT+2, when deploying the application in PROJECT_STAGE = Development the FacesConfigurator class is going to check whether there are new files in the application, as the files are created in GMT+2 it just try to update the application again but for some reason it has to setManager which was already set. We fixed the problem by deploying the application PROJECT_STAGE = Production, in that case it doesn't make the update mechanism. Cheers, Alf. On Mon, Sep 5, 2011 at 10:14 PM, junk mail junkmailto...@gmail.com wrote: Hi guys, We have been struggling for weeks with an IllegalStateException send by * org.apache.myfaces.application.ApplicationImpl* class It works pretty well in a local environment, but when we deployed the application in a Solaris server with Tomcat 6 or 7 and with any of myfaces versions from 2.0.5 to 2.1.1 the exception is thrown when we * reload* the home page* or we go no another view *of the application. The application it's a simple page that display static text an a h:commandButton, only a *ManagedBean/SessionScoped* with a method that redirects to another page when button is pressed. Could you guys help me with this issue, it's becoming desperated. Many thanks, Alf. *Error stackTrace:* * * 2011-09-05 17:09:03,145 [TP-Processor3] ERROR alhost].[/omt].[Faces Servlet]#invoke():281 - Servlet.service() for servlet Faces Servlet threw exception java.lang.IllegalStateException: setStateManager may not be executed after a lifecycle request has been completed at org.apache.myfaces.application.ApplicationImpl.setStateManager(ApplicationImpl.java:1755) at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:516) at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:401) at org.apache.myfaces.config.FacesConfigurator.update(FacesConfigurator.java:349) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:112) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)* *** at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:294) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:554)* *** at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Unknown Source) ** ** ** ** *web.xml config:* ** ** ?xml version=1.0 encoding=UTF-8? web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns= http://java.sun.com/xml/ns/javaee; xmlns:web= http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; xsi:schemaLocation= http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5
Re: Popup calendar javascript - loadPopupScript not defined
Hi, thank you for the idea. I followed the thread discussing that the extension filter needs a head or body tag to be able to add the neccessary javaScripts. I do indeed work with a non standalone JSF application, but it's not in a portal environment. The thing is called Sakai and is a sort of classroom management software using frames. I did check the rendered response and there are proper body and head tags and additionally there are some javaScript extensionFilter entries defined. Just to show two examples: script type=text/javascript src=/sakai-ecgviewer-tool/faces/myFacesExtensionResource/tree2.HtmlTreeRenderer/11302665/javascript/cookielib.js script type=text/javascript!-- jscalendarMonthName = new Array(January,February,March,April,May,June,July,August,September,October,November,December);jscalendarMonthName2 = new Array(January,February,March,April,May,June,July,August,September,October,November,December);jscalendarDayName = new Array(Sun,Mon,Tue,Wed,Thu,Fri,Sat);jscalendarStartAt = 0; jscalendarTodayString = Today is: ; jscalendarWeekString = Wk; if (!document.layers) { document.write('img src=/sakai-ecgviewer-tool/faces/myFacesExtensionResource/calendar.HtmlCalendarRenderer/11302665/images/calendar.gif style=vertical-align:bottom; onclick=jscalendarPopUpCalendar(this,document.getElementById(\'dateOfDiagnosisForm:_id63\'),\'M/d/yy\') /'); } //--/script Take care, Kurt Quoting CD [EMAIL PROTECTED]: Hi Kurt, Are you working in a portal environment perhaps? I don't think that has any bearing on the issue I'm dealing with as you are getting the same problems I am, but it would be comforting to know :) On 12/21/05, Kurt Edegger [EMAIL PROTECTED] wrote: Hi, I posted the same issue couple of weeks ago and couldn't resolve it. I'm still stuck with an JavaScript error: jscalendarPopUpCalendar is not defined I do have the extensionsFilter declared in my web.xml, both mapped to /faces/* and *.jsf as shown by this snipplet of my web.xml: filter filter-nameMyFacesExtensionsFilter/filter-name filter-class org.apache.myfaces.component.html.util.ExtensionsFilter /filter-class init-param param-namemaxFileSize/param-name param-value20m/param-value /init-param /filter filter-mapping filter-nameMyFacesExtensionsFilter/filter-name url-pattern*.jsf/url-pattern /filter-mapping filter-mapping filter-nameMyFacesExtensionsFilter/filter-name url-pattern/faces/*/url-pattern /filter-mapping servlet servlet-nameFaces Servlet/servlet-name servlet-classjavax.faces.webapp.FacesServlet/servlet-class load-on-startup2/load-on-startup /servlet servlet-mapping servlet-nameFaces Servlet/servlet-name url-pattern*.jsf/url-pattern /servlet-mapping It seems that some javaScripts are not loaded in the head or body of the page. Thanks for any help! Kurt
Re: h:selectOneMenu question
Simon, thank you for your answer, I modified the getter/setter to handle SelectItem.getValue().toString() instead of the selectItem itself. But had you ever the chance to take a look at the jsftags-guide examples (http://www.exadel.com/tutorial/jsf/jsftags-guide.html)? They are using the SelectItems directly. Where's the difference? Kurt Quoting Simon Kitching [EMAIL PROTECTED]: Kurt Edegger wrote: Hi everybody, I'd like to use a dropdown menu in my jsp page, therefor I added h:selectOneMenu id=selectModifier value=#{bean.currentItem} f:selectItems value=#{bean.itemList} / /h:selectOneMenu to my page. The bean provides getter and setters for both properties, whereby currentItem is of type SelectItem and itemList is an ArrayList containing SelectItems. I believe #{bean.currentItem} has to return a string that matches SelectItem.getValue() of one of the SelectItems in the list. And when an item in the list is selected, that property will be updated to contain the getValue() value of the chosen SelectItem, not a reference to the complete SelectItem object. Regards, Simon
Re: naming conventions in faces-config.xml
Mike, thank you for your patience and effort trying to resolve this issue. I just changed the essential parts to reproduce the error. Here's the setter in CasesJdbcDAO: public void setDataSource(JDBCDataSource dataSource) { if (log.isDebugEnabled()) log.debug(setting dataSource in casesDAO); this.ds = dataSource; //the dataSource has to be updated after the bean has been injected this.setDataSource(this.ds.getDs()); } and the correlating snipplet of the faces-config.xml configuration file: managed-bean descriptionthis one retrieves the cases/description managed-bean-namecasesDAOBean/managed-bean-name managed-bean-classcom.edegger.dao.springJDBC.CasesJdbcDAO/managed-bean-class managed-bean-scopesession/managed-bean-scope managed-property property-namedataSource/property-name value#{jdbcDataSourceBean}/value /managed-property /managed-bean Since the field ds is only used within the class CasesJdbcDAO, I don't need an getter for this property. And finally the signature of the class is: public class CasesJdbcDAO extends JdbcDaoSupport implements CasesDAO { whereas CasesDAO is the interface defining a methode to get all the cases as a list. With this configuration, I'm getting the 'javax.servlet.jsp.el.ELException: Attempt to coerce a value of type com.edegger.dao.springJDBC.JDBCDataSource to type javax.sql.DataSource' exception. To get rid off this exception, I'll need to apply the following chances: public void setDs(JDBCDataSource dataSource) { if (log.isDebugEnabled()) log.debug(setting dataSource in casesDAO); this.ds = dataSource; //the dataSource has to be updated after the bean has been injected this.setDataSource(this.ds.getDs()); } and the correlating snipplet of the faces-config.xml configuration file: managed-bean descriptionthis one retrieves the cases/description managed-bean-namecasesDAOBean/managed-bean-name managed-bean-classcom.edegger.dao.springJDBC.CasesJdbcDAO/managed-bean-class managed-bean-scopesession/managed-bean-scope managed-property property-nameds/property-name value#{jdbcDataSourceBean}/value /managed-property /managed-bean The signature stays the same. I know something's not adding up - but I can't explain it. Enjoy, Kurt Quoting Mike Kienenberger [EMAIL PROTECTED]: Kurt, what does both your setter and getter code and method signatures look like on CasesJdbcDAO when you're getting this error? 'javax.servlet.jsp.el.ELException: Attempt to coerce a value of type JDBCDataSource to type javax.sql.DataSource' indicates an attempt to inject a JDBCDataSource into a value binding expecting a javax.sql.DataSource. Something's not adding up here. On 12/5/05, Kurt Edegger [EMAIL PROTECTED] wrote: Hi Mike, thank you for your help, but I don't think that your answer is correct. We are talking about two different classes. The first one is CasesJdbcDAO with the setter taking an JDBCDataSource Object and the second on is the JDBCDataSource class having a getDs() method to return the actual javax.sql.DataSource object. To clearify: The JDBCDataSource object is injected to CasesJdbcDAO using the setter in CasesJdbcDAO which takes the correct type of JDBCDataSource. I don't think this is an issue of a misscasted type since it works if the field in CasesJdbcDAO (marked as [1] in my former postings) isn't named 'dataSource'. In that case the JSF implementation seems to interpret the name as a type and causing the exception. In the case it isn't named 'dataSource' (e.g. 'ds' in my example) the injection is done without any problems. I'm appreciating your help and thoughts. Kurt on 12/5/2005 8:54 AM Mike Kienenberger stated: Your setter and getter return different types. public DataSource getDs() needs to be public JDBCDataSource getDs() { On 12/2/05, Kurt Edegger [EMAIL PROTECTED] wrote: Hi Mike, thank you for your response. on 12/2/2005 7:30 AM Mike Kienenberger stated: Can you post the setter method for ds in CasesJdbcDAO? Here are the crucial parts of CasesJdbcDAO: /* the field definition [1]*/ private JDBCDataSource ds; /* the setter*/ public void setDs(JDBCDataSource dataSource) { this.ds = dataSource; this.setDataSource(this.ds.getDs()); } Also can you post the class definition line for JDBCDataSource? The JDBCDataSource class is very simple and just holds an javax.sql.DataSource object. Here are the interesting parts: /*the class definition */ public class JDBCDataSource{ /*the javax.sql.DataSource*/ private DataSource ds; private String jndiLookup; ... public DataSource getDs() { doLookup(); return ds; } } The issue again: If I change the name of the field in CasesJdbcDAO at position [1] to dataSource, and adjust the injection in faces-config.xml accordingly the application crashes
Re: jsCalendarPopupCalendar not embedded
Hi, I agree that there is missing JavaScript Code, but is there anything else to configer except the myfaces extension filters described at http://myfaces.apache.org/tomahawk/extensionsFilter.html All the documentation I found stated, that installing the filter and adding the taglib to the jsp page is sufficient. Any more thoughts? Thanks, Kurt Quoting \R. Müller\ [EMAIL PROTECTED]: Hi, [EMAIL PROTECTED] wrote: [...] I'm still getting the jscalendarPopUpCalendar is not defined JavaScript error. But there is another one, while rendering the page: 'loadPopupScript is not defined' it seems that there is some javascript-code missing (function 'loadPopupScript') in rendered page. make sure that your web is proper configurated, especially filter- and servletmappings. Ronald
Re: jsCalendarPopupCalendar not embedded
Hi Bobby, thank you for your response, but I do have the following dependancies defined in my project: dependency groupIdmyfaces/groupId artifactIdmyfaces-all/artifactId version1.1.1/version properties war.bundletrue/war.bundle /properties /dependency dependency groupIdcommons-lang/groupId artifactIdcommons-lang/artifactId version2.1/version properties war.bundletrue/war.bundle /properties /dependency I'm still getting the jscalendarPopUpCalendar is not defined JavaScript error. But there is another one, while rendering the page: 'loadPopupScript is not defined' Anyone knows whats going on here? Thank you in advance, Kurt Quoting Bobby Rosenberger [EMAIL PROTECTED]: I just checked my calendar code... and found this: The trick here is that you must include commons-lang-2.1.jar in your classpath if you want the calendar to work as a popup. Bobby On 11/29/05, Kurt Edegger [EMAIL PROTECTED] wrote: Hi, I would like to use the inputCalender element on one of my jsf pages. I'd like to have the element rendered to use the javaScript popup to display the calendar. But when I add the following to my jsp document, I only get an jsCalendarPopupCalendar is not defined JavaScript Error after clicking on the calendar icon next to the input field. h:form id=dateOfDiagnosisForm t:inputCalendar monthYearRowClass=yearMonthHeader weekRowClass=weekHeader currentDayCellClass=currentDayCell value=#{ecgViewer.diagDate} renderAsPopup=true popupTodayString=#{msg['calendarpopup_today_string']} popupWeekString=#{msg['calendarpopup_week_string']} renderPopupButtonAsImage=true / /h:form I did add the extension filter entries to my web.xml and I can use other elements correctly. I found a former thread in this group relating to the same issue, but there the issue was that the jsp document had no body nor head elements, which I do have both in my jsp. Any ideas? Kurt