Thanks for the feedback, glad to know you at least found a workaround. Stephen
On 1 November 2010 23:31, Perfect, Richard <richard.perf...@anz.com> wrote: > Sigh, since the approach of using DateTime worked, I've now changed all of > the code to use DateTime rather than LocalDateTime. This shouldn't cause too > many issues, since here in NZ we only have the one (practical) timezone. > > I'm not sure about changing Glassfish's serialization, there might be a > technique. My understanding is that around about J2EE 3 or so the standard > changed to specify RMI/IIOP so that J2EE application servers could > inter-operate with other Corba servers. Glassfish being a Sun thing was/is > pretty good about following the standards. For example WebLogic uses it's own > T3 protocol by default as a point of differentiation. > > Time constraints mean I've had to move on but thanks anyway for the feedback. > > - Richard P. > > > -----Original Message----- > From: Stephen Colebourne [mailto:scolebou...@joda.org] > Sent: Tuesday, 2 November 2010 12:19 p.m. > To: Discussion of the Joda project > Subject: Re: [Joda-interest] LocalDateTime not able to traverse EJB calls > > I've had a look at the code, and it looks complex but reasonably sound at a > glance. Id' be surprised if nobody has used it in EJB. > > I thought EJB used serialization, not CORBA. Is there a switch to change it? > As you say, my tests show that regular serialization works fine. > > The only place it might go wrong that I could see is if readObject() isn't > called on AssembledChronology. Maybe you can breakpoint that. > > Stephen > > > On 30 September 2010 21:58, Perfect, Richard <richard.perf...@anz.com> wrote: >> Hi, >> >> Sorry for the long post, it's a complicated problem and just has me stumped. >> I have a situation where I can't seem to send a LocalDateTime across >> an EJB method call - something in the Cronology classes gets lost in >> the remote method calls. The other odd thing is that DateTime seems to >> be okay. Using Joda DateTime 1.6.2. >> >> Given the following simple service >> >> @Stateless >> public class ZDateServiceBean implements ZDateService { >> >> @Override >> public DateTime echoDateTime(DateTime dateTime) { >> return dateTime; >> } >> >> @Override >> public LocalDateTime echoLocalDateTime(LocalDateTime >> localDateTime) { >> return localDateTime; >> } >> } >> >> The following test code fails; >> >> public void testSerialization() { >> try { >> final DateTimeFormatter DATE_TIME_FORMATTER_WITH_SECS >> = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); >> >> ZDateService zdateService = >> ServiceLocator.find(ZDateService.class); >> >> DateTime dateTime1 = new DateTime(); >> DateTime dateTime2 = >> zdateService.echoDateTime(dateTime1); >> System.out.println("DateTime equals() = " + >> dateTime1.equals(dateTime2)); >> System.out.println("DateTime output = " + >> dateTime2.toString(DATE_TIME_FORMATTER_WITH_SECS)); >> >> LocalDateTime localDateTime = new LocalDateTime(); >> >> System.out.println(localDateTime.toString(DATE_TIME_FORMATTER_WITH_SEC >> S)); >> >> ByteArrayOutputStream bytesOut = new >> ByteArrayOutputStream(); >> ObjectOutputStream objectOut = new >> ObjectOutputStream(bytesOut); >> objectOut.writeObject(localDateTime); >> byte[] bytes = bytesOut.toByteArray(); >> String firstTime = Base64.encodeBytes(bytes); >> >> LocalDateTime localDateTime2 = >> zdateService.echoLocalDateTime(localDateTime); >> System.out.println("LocalDateTime equals() = " + >> localDateTime.equals(localDateTime2)); >> >> ByteArrayOutputStream bytesOut2 = new >> ByteArrayOutputStream(); >> ObjectOutputStream objectOut2 = new >> ObjectOutputStream(bytesOut2); >> objectOut2.writeObject(localDateTime2); >> byte[] bytes2 = bytesOut.toByteArray(); >> String secondTime = Base64.encodeBytes(bytes2); >> >> System.out.println(firstTime); >> System.out.println(); >> System.out.println(secondTime); >> >> System.out.println("base64 equals() = " + >> firstTime.equals(secondTime)); >> System.out.println("LocalDateTime output = " + >> localDateTime2.toString(DATE_TIME_FORMATTER_WITH_SECS)); >> } >> catch(Exception ex) { >> ex.printStackTrace(); >> } >> } >> >> With the following output; >> >> [#|2010-10-01T09:46:28.721+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|DateTime >> equals() = false|#] >> >> [#|2010-10-01T09:46:28.721+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|DateTime >> output = 2010-10-01 09:46:28|#] >> >> [#|2010-10-01T09:46:28.721+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|2010-10-01 >> 09:46:28|#] >> >> [#|2010-10-01T09:46:28.768+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|LocalDateTime >> equals() = false|#] >> >> [#|2010-10-01T09:46:28.768+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|rO0ABXNyABtvcmcuam9kYS50aW1lLkxvY2FsRGF0ZVRpbWX8RVNs9aWHEAI >> AAkoADGlMb2NhbE1p >> >> bGxpc0wAC2lDaHJvbm9sb2d5dAAaTG9yZy9qb2RhL3RpbWUvQ2hyb25vbG9neTt4cAAAAS >> tnL4Px >> c3IAJ29yZy5qb2RhLnRpbWUuY2hyb25vLklTT0Nocm9ub2xvZ3kkU3R1YqnIEWZxN1AnAw >> AAeHBz >> cgAfb3JnLmpvZGEudGltZS5EYXRlVGltZVpvbmUkU3R1YqYvAZp8MhrjAwAAeHB3BQADVV >> RDeHg=|#] >> >> [#|2010-10-01T09:46:28.768+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|rO0ABXNyABtvcmcuam9kYS50aW1lLkxvY2FsRGF0ZVRpbWX8RVNs9aWHEAI >> AAkoADGlMb2NhbE1p >> >> bGxpc0wAC2lDaHJvbm9sb2d5dAAaTG9yZy9qb2RhL3RpbWUvQ2hyb25vbG9neTt4cAAAAS >> tnL4Px >> c3IAJ29yZy5qb2RhLnRpbWUuY2hyb25vLklTT0Nocm9ub2xvZ3kkU3R1YqnIEWZxN1AnAw >> AAeHBz >> cgAfb3JnLmpvZGEudGltZS5EYXRlVGltZVpvbmUkU3R1YqYvAZp8MhrjAwAAeHB3BQADVV >> RDeHg=|#] >> >> [#|2010-10-01T09:46:28.768+1300|INFO|glassfish3.0.1|javax.enterprise.s >> ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadName >> =Thread-1;|base64 >> equals() = true|#] >> >> [#|2010-10-01T09:46:28.768+1300|SEVERE|glassfish3.0.1|javax.enterprise >> .system.std.com.sun.enterprise.v3.services.impl|_ThreadID=25;_ThreadNa >> me=Thread-1;|java.lang.NullPointerException >> >> at >> org.joda.time.LocalDateTime.isSupported(LocalDateTime.java:519) >> at >> org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber.printTo(Dat >> eTimeFormatterBuilder.java:1364) >> at >> org.joda.time.format.DateTimeFormatterBuilder$Composite.printTo(DateTi >> meFormatterBuilder.java:2492) >> at >> org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java: >> 452) >> at >> org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:51 >> 4) >> at >> org.joda.time.base.AbstractPartial.toString(AbstractPartial.java:418) >> at >> nz.co.anz.eccp.web.profiles.group.search.GroupSearchController.testSer >> ialization(GroupSearchController.java:163) >> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j >> ava:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess >> orImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:597) >> at >> nz.co.anz.eccp.framework.util.ReflectionUtils.invoke(ReflectionUtils.j >> ava:49) >> at >> nz.co.anz.eccp.web.framework.action.ZActionCommand.performAction(ZActi >> onCommand.java:78) >> at >> nz.co.anz.eccp.web.framework.action.ZActionCommand.invokeActionMethod( >> ZActionCommand.java:58) >> at >> nz.co.anz.eccp.web.framework.action.ZMenuBarCommand.menuSelected(ZMenu >> BarCommand.java:26) >> at com.vaadin.ui.MenuBar.changeVariables(MenuBar.java:173) >> at >> com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVari >> ables(AbstractCommunicationManager.java:1094) >> >> at >> com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUi >> dlRequest(AbstractCommunicationManager.java:590) >> >> at >> com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest( >> CommunicationManager.java:266) >> at >> com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(Abst >> ractApplicationServlet.java:476) >> at >> javax.servlet.http.HttpServlet.service(HttpServlet.java:847) >> at >> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java: >> 1523) >> at >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa >> lve.java:279) >> at >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa >> lve.java:188) >> at >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java >> :641) >> at >> com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) >> at >> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessi >> onLockingStandardPipeline.java:85) >> at >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja >> va:185) >> at >> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.ja >> va:325) >> at >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java >> :226) >> at >> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerM >> apper.java:165) >> at >> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:79 >> 1) >> at >> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) >> at >> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) >> at >> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilt >> er.java:170) >> at >> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProt >> ocolChain.java:135) >> at >> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java >> :102) >> at >> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java >> :88) >> at >> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java: >> 76) >> at >> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTa >> sk.java:53) >> at >> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.j >> ava:57) >> at com.sun.grizzly.ContextTask.run(ContextTask.java:69) >> at >> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPo >> ol.java:330) >> at >> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool. >> java:309) >> at java.lang.Thread.run(Thread.java:619) >> |#] >> >> Some talking points; >> - DateTime works, and LocalDateTime doesn't - "LocalDateTime equals() >> = false" and you get a NullPointerException if you try to print the >> echoed LocalDateTime. >> >> - Normal Java Serialization of the LocalDateTime works - "base64 >> equals() = true" >> - Calling an EJB uses Corba serialization. I'm not sure but I think >> the problem may be in and around setFields() of AssembledChronology. >> >> - Using Glassfish V3.01 >> >> Is this a limitation of LocalDateTime? Have people used it >> successfully on other EJB servers? >> >> Any help would be much appreciated. >> >> - Richard Perfect. >> >> >> >> >> >> "This e-mail and any attachments to it (the "Communication") is, >> unless otherwise stated, confidential, may contain copyright material >> and is for the use only of the intended recipient. If you receive the >> Communication in error, please notify the sender immediately by return >> e-mail, delete the Communication and the return e-mail, and do not >> read, copy, retransmit or otherwise deal with it. Any views expressed >> in the Communication are those of the individual sender only, unless >> expressly stated to be those of Australia and New Zealand Banking >> Group Limited ABN 11 005 357 522, or any of its related entities >> including ANZ National Bank Limited (together "ANZ"). ANZ does not >> accept liability in connection with the integrity of or errors in the >> Communication, computer virus, data corruption, interference or delay >> arising from or in respect of the Communication." >> >> ---------------------------------------------------------------------- >> -------- Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and accelerate >> your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> Joda-interest mailing list >> Joda-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/joda-interest >> >> > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > > "This e-mail and any attachments to it (the "Communication") is, unless > otherwise stated, confidential, may contain copyright material and is for > the use only of the intended recipient. If you receive the Communication in > error, please notify the sender immediately by return e-mail, delete the > Communication and the return e-mail, and do not read, copy, retransmit or > otherwise deal with it. Any views expressed in the Communication are those of > the individual sender only, unless expressly stated to be those of Australia > and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its > related entities including ANZ National Bank Limited (together "ANZ"). ANZ > does not accept liability in connection with the integrity of or errors in > the Communication, computer virus, data corruption, interference or delay > arising from or in respect of the Communication." > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Joda-interest mailing list > Joda-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/joda-interest > ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest