Re: Tiles errors in Struts versions > 6.3.0.2
There is a bug cause the error you get at 6.4.0 https://issues.apache.org/jira/plugins/servlet/mobile#issue/WW-5419 You can set init param at web.xml or change where you store tiles.xml to fix issue if you want to use 6.4.0 But Im not sure what cause you get error at 6.6.0 You might need turn struts.xml devMode to true and open log to trace for more detail Maybe other people can help you Best regards Heikki Hyyrö 於 2024年10月1日 週二 下午6:38 寫道: > Our web application based on Struts 2 + Tiles framework starts to give > errors on some jsp pages if I try to use a newer Struts version than > 6.3.0.2. > > Exactly the same codebase works fine on previous Struts versions (the > only changes are in the pom file and concern the versions of > struts2-core, struts2-tiles-plugin, struts2-config-browser-plugin and > strutrs2-json-plugin). > > On 6.6.0 the stacktrace has snippets like: > > > Caused by: org.apache.tiles.request.render.CannotRenderException: > > java.io.IOException: JSPException including path 'xyz.jsp'. > > at > > > org.apache.tiles.core.impl.BasicTilesContainer.render(BasicTilesContainer.java:395) > > ... > > Caused by: java.io.IOException: java.io.IOException: JSPException > > including path 'xyz.jsp'. > > at > > > org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:56) > > at > > org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:118) > > ... > > Caused by: java.lang.NullPointerException > > at > > > org.apache.struts2.components.IteratorComponent.start(IteratorComponent.java:309) > > at > > > org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:51) > where xyz is a path to a jsp file of ours. > > Curiously, Struts 6.4.0 stacktrace for the very same page gives a > different error: > > > HTTP ERROR 500 Cannot find definition named 'nodeGradesView.page' > > Caused by: org.apache.tiles.core.definition.NoSuchDefinitionException: > > Cannot find definition named 'xyz.page' > > at > > > org.apache.tiles.core.impl.mgmt.CachingTilesContainer.render(CachingTilesContainer.java:108) > > ... > > where xyz.page is a tiles definition of the view that xyz.jsp would > belong to. > > These errors are a bit cumbersome and have left as stuck at Struts > version 6.3.0.2. > > Best regards > > Heikki > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: The different output with Date whether the Http request have application/json
After few more hours searching I figure out that struts2-rest-plugin is using jacksion for parsing lib And the ObjectMapper will turn Date Object into millionseconds So struts2-rest-plugin will be first pick after access action when responsing (if no application/json header its will be pass not process) then struts2-json-plugin (using DefaultJsonWriter) in struts2-rest-plugin its first into DefaultContentTypeHandlerManager choosing which ContentTypeHandler to use (in this case the result is JacksonJsonHandler ) Then in JacksonJsonHandler its will use ObjectMapper transfer Date I believe which is reason why change my default date format string into millionseconds and all other ContentTypeHandlers may also cause issue due to also use jacksion lib Is this some kinds of Feature or Bug? If this is bug can someone help me report this issue? 哈哈哈哈 於 2023年12月4日 週一 下午8:58寫道: > > HI Thanks for reply > Yes its does change to what i format > but not with if the request with application/json > app still return millionseconds > > and after a day for testing > I finally find out its nothing about struts2-json-plugin > > > its struts2-rest-plugin cause the issue !! > > > if i add this plugin > The Date Object will turn to millionseconds > But I didnt see any word about it at official page > https://struts.apache.org/plugins/rest/ > > here is my action code === > > import java.util.Date; > import com.opensymphony.xwork2.Action; > import com.opensymphony.xwork2.ModelDriven; > public class TmpAction implements ModelDriven { > private Date model = new Date(); > public Date getModel() { > return model; > } > public void setModel(Date model) { > this.model = model; > } > public String index() { > return Action.SUCCESS; > } > } > > === > here is my struts.xml === > > "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" > "http://struts.apache.org/dtds/struts-2.5.dtd";> > > > > namespace="/api"> > class="TmpAction" method="index"> > > model > > > > > > > here is part of maven pom.xml the dependencies i have use === > > > org.apache.struts > struts2-core > 6.3.0 > > > org.apache.struts > struts2-json-plugin > 6.3.0 > > > org.apache.logging.log4j > log4j-core > 2.17.0 > > > org.apache.logging.log4j > log4j-api > 2.17.0 > > > org.apache.struts > struts2-rest-plugin > 6.3.0 > > > com.fasterxml.jackson.dataformat > jackson-dataformat-xml > 2.16.0 > > > === > > If still need more information > I can offer github repository to reporduce this issue > Best regards > > Yasser Zamani 於 2023年12月4日 週一 上午3:24寫道: > > > > Hi, > > > > Thanks for reaching out! > > > > Could you please try setting your desired value to Struts constant > > "struts.json.dateformat" and see if any change happens? Or try > > https://stackoverflow.com/a/59471917? > > > > Regards, > > Yasser > > > > > > > > From: > > Sent: Saturday, December 2, 2023 4:21 PM > > To: user@struts.apache.org > > Subject: The different output with Date whether the Http request have > > application/json > > > > Hi all: > > > > I am new of use struts framework , and when I have a request with no > > application/json to my app which use Struts framework having json > > plugin , The Date Object return is something like > > “2015-05-04T10:08:15+00:00” which is RFC 3339 format , Its fine . > > > > But when I have request with header have application/json , The Date > > Object return is something like 1701522508943 . I believe which > > represent the millionseconds since January 1, 1970, 00:00:00 GMT . But > > how ? I didn’t see any article mention it . And I didn’t get any tips > > from source code . The DefaultJSONWriter seems not doing this ? > > > > Can someone tell me how and which java class turn the Date Object to > > number and sent to front ? > > > > - > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > - > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: The different output with Date whether the Http request have application/json
HI Thanks for reply Yes its does change to what i format but not with if the request with application/json app still return millionseconds and after a day for testing I finally find out its nothing about struts2-json-plugin its struts2-rest-plugin cause the issue !! if i add this plugin The Date Object will turn to millionseconds But I didnt see any word about it at official page https://struts.apache.org/plugins/rest/ here is my action code === import java.util.Date; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ModelDriven; public class TmpAction implements ModelDriven { private Date model = new Date(); public Date getModel() { return model; } public void setModel(Date model) { this.model = model; } public String index() { return Action.SUCCESS; } } === here is my struts.xml === http://struts.apache.org/dtds/struts-2.5.dtd";> model here is part of maven pom.xml the dependencies i have use === org.apache.struts struts2-core 6.3.0 org.apache.struts struts2-json-plugin 6.3.0 org.apache.logging.log4j log4j-core 2.17.0 org.apache.logging.log4j log4j-api 2.17.0 org.apache.struts struts2-rest-plugin 6.3.0 com.fasterxml.jackson.dataformat jackson-dataformat-xml 2.16.0 === If still need more information I can offer github repository to reporduce this issue Best regards Yasser Zamani 於 2023年12月4日 週一 上午3:24寫道: > > Hi, > > Thanks for reaching out! > > Could you please try setting your desired value to Struts constant > "struts.json.dateformat" and see if any change happens? Or try > https://stackoverflow.com/a/59471917? > > Regards, > Yasser > > > > From: > Sent: Saturday, December 2, 2023 4:21 PM > To: user@struts.apache.org > Subject: The different output with Date whether the Http request have > application/json > > Hi all: > > I am new of use struts framework , and when I have a request with no > application/json to my app which use Struts framework having json > plugin , The Date Object return is something like > “2015-05-04T10:08:15+00:00” which is RFC 3339 format , Its fine . > > But when I have request with header have application/json , The Date > Object return is something like 1701522508943 . I believe which > represent the millionseconds since January 1, 1970, 00:00:00 GMT . But > how ? I didn’t see any article mention it . And I didn’t get any tips > from source code . The DefaultJSONWriter seems not doing this ? > > Can someone tell me how and which java class turn the Date Object to > number and sent to front ? > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
The different output with Date whether the Http request have application/json
Hi all: I am new of use struts framework , and when I have a request with no application/json to my app which use Struts framework having json plugin , The Date Object return is something like “2015-05-04T10:08:15+00:00” which is RFC 3339 format , Its fine . But when I have request with header have application/json , The Date Object return is something like 1701522508943 . I believe which represent the millionseconds since January 1, 1970, 00:00:00 GMT . But how ? I didn’t see any article mention it . And I didn’t get any tips from source code . The DefaultJSONWriter seems not doing this ? Can someone tell me how and which java class turn the Date Object to number and sent to front ? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org