22 Apr 2009, 21:57
Danhaywood-2011-282x282_pragsmall

Dan Haywood (133 posts)

Hi, I’m Dan Haywood, the author of this book. Thanks for your interest in the book, in DDD, and in Naked Objects. And if you’re reading the beta, then thanks also for helping me improve the content.

If you have any questions or suggestions, please post them here, and I’ll do my best to respond promptly.

Cheers Dan

08 May 2009, 02:01
M_458499f9_pragsmall

Alexander Krasnukhin (8 posts)

Hi, Dan

Im really enjoying reading your book. But sometimes I feel puzzled how information is given there. Maybe Im wrong reader but anyway you asked for suggestions :)

For example at page 44 there is no word about icons, only about persistor store or @Named. I turn next page 45 and reading “An Icon?! Now?!” and feel surpised. Really surprised because I have no idea what icons you are talking about - there wasn’t any word about them till now! Only after Ive explored page I understood everything. But I swear Ive read gray box three times! And only then realised that I should pass it first time and return to the top of the page only after reading its bottom!

You think its OK? No, I solved this mini puzzle as Ive already know what icons you are about. But what about readers that hadn’t used Naked Objects before?

PS Im talking about beta2

08 May 2009, 09:33
Danhaywood-2011-282x282_pragsmall

Dan Haywood (133 posts)

Hi the.malkolm, Glad to hear you’re enjoying the book! And thanks for this feedback, really appreciate it.

To answer your point: because this is a beta, there hasn’t been any fine-tuning of the location of sidebars and figures; so they come out in approximately the right place. Which means the top of the page where I wrote the sidebar. So, yes, this sidebar should probably appear at the top of page 46 to avoid confusion.

I’ll add a note to the manuscript to make sure we adjust this when we get to final typesetting (though I think it’ll get picked up anyway).

In the meantime, you might well notice slightly misplaced sidebars elsewhere. Don’t get hung up on it, skip on a few paragraphs and the reason for the sidebar ought to become clear.

Cheers Dan

27 Jul 2009, 22:40
Generic-user-small

Niall Barry (1 post)

Hi, Dan

I thought I’d work through the book even though it’s been a long time since I developed anything and I haven’t a clue about the ‘open source environment’. A few comments for what they’re worth (only got through the first two chapters so far):

Biggest issue I have so far is setting up dev environment (though I don’t think there’s anything you can/should do about that) in Vista. Book says use JRE or JDK - Eclipse/Maven doesn’t seem to like JRE (lots of warning msgs, although everything so far eventually works). I had to set up environment variables as System before they’d work.

P29 says enter any Group ID - I think this gives problems for next projects, which seem to need same Group ID (though maybe I just need to run Eclipse as Admin)

P31 says navigate to http://localhost:8080/ - took me a while to figure out I needed logon.app there too.

p35 DDD Box belongs in the next page (I know you said not to worry about this but just in case)

Ch2 setup of carserv project failed but seemed to work when I used the same groupID as first proj

p41 path should read Window (not ‘Windows’)

p44 first time I came across template (nop) so took me a while to figure it out but I presume others will be more familiar with environment

p45 typo “framework will called them”

p50 typo in box “we were asked us all” (btw, I like boxes)

p51 refers to “nakedobjects-icons archetype” - the one I picked up had a different name

p53 I had to import org.nakedobjects.applib.annotation.* to make @Named and @DescribedAs annotations work.

I don’t know whether any of the above is of any use but it’s been fun so far - best of luck with the book.

Niall

13 Aug 2009, 19:05
Danhaywood-2011-282x282_pragsmall

Dan Haywood (133 posts)

Hi Niall, Sorry for not replying back sooner … been in the midst of getting the next (final) beta ready.

Many thanks for the numerous points you’ve raised, and all have been addressed in aforesaid beta. If you hit any other minor errata then perhaps you could raise them on the errata page (http://www.pragprog.com/titles/dhnako/errata)?

Meanwhile, you might want to know that in the next beta I’ve beefed up the section on “the DSFA Naked Objects app” in the last section (anyone else reading this: Niall is the CIO for the big flagship project we have at the DSFA, ie the Social Welfare department for the Irish government), and - I presume you don’t mind since it’s already on public record - I’ve quoted your comment from a few years back about how happy you were with the system.

In the meantime, good luck with your domain-driven development!

Cheers Dan

05 Jan 2010, 07:18
Generic-user-small

Desai Sweta Y. (14 posts)

Hi Dan,

I am using the REST provided in startobjects. I have installed it successfully. The testapp coming with the distribution is working fine with the REST viewer. But then when I tried the code of the carserv-restful in case study in the downloadable code from this site, it is giving me the following error.

0 [main] INFO org.starobjects.restful.applib.AbstractRestfulClient - getting from ‘http://localhost:8080/services’ Exception in thread “main” org.starobjects.restful.applib.RestfulClientException: java.net.ConnectException: Connection refused: connect at org.starobjects.restful.applib.AbstractRestfulClient.get(AbstractRestfulClient.java:50) at com.pragprog.dhnako.carserv.restful.FindCustomer.findCustomer(FindCustomer.java:62) at com.pragprog.dhnako.carserv.restful.FindCustomer.main(FindCustomer.java:49) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:837) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:778) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1026) at org.starobjects.restful.applib.UrlConnectionUtils.readDocFromConnectionInputStream(UrlConnectionUtils.java:37) at org.starobjects.restful.applib.AbstractRestfulClient.get(AbstractRestfulClient.java:42) ... 2 more

Can you please help me understand what the problem is and what is that I am making wrong?

Thanks in advance, Sweta.

05 Jan 2010, 18:26
Danhaywood-2011-282x282_pragsmall

Dan Haywood (133 posts)

Hi Sweta,, That looks like you aren’t running the server.

In the carserv/commandline/ide/eclipse/launch there is the exploration#viewer_restful.launch launch configuration. This will run up the server in a jetty servlet container.

Then (as you’ve found), in carserv-restful/ide/eclipse/launch there are the various client launch configurations.

Hope that helps, Dan

06 Jan 2010, 04:50
Generic-user-small

Desai Sweta Y. (14 posts)

Thanks for the very quick response Dan,

That helped. Actually the problem was, the launch configuration file in carserv application for restful is named exploration#viewer_restful.launch0000064, therefore the ide wasnt showing this in the option.. renaming it.. it atleast showed me the glimpse of starting the jetty server.. but then it is again giving the error as mentioned below..

Exception in thread “main” java.lang.NoClassDefFoundError: javax/ws/rs/core/Application at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at org.starobjects.restful.viewer.embedded.EmbeddedWebViewerRestful.getWebAppSpecification(EmbeddedWebViewerRestful.java:19) at org.nakedobjects.runtime.NakedObjects$1.evaluate(NakedObjects.java:111) at org.apache.commons.collections.CollectionUtils.filter(CollectionUtils.java:406) at org.nakedobjects.runtime.NakedObjects.findWebViewers(NakedObjects.java:108) at org.nakedobjects.runtime.NakedObjects.bootstrapViewers(NakedObjects.java:99) at org.nakedobjects.runtime.NakedObjects.bootstrapNakedObjects(NakedObjects.java:69) at org.nakedobjects.runtime.NakedObjectsAbstract.run(NakedObjectsAbstract.java:107) at org.nakedobjects.runtime.NakedObjects.main(NakedObjects.java:33) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Application at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) … 32 more

Is this jdk version problem?

Hope you will help again, Sweta.

06 Jan 2010, 06:22
Generic-user-small

Desai Sweta Y. (14 posts)

Hi Dan,

Thank you so much for the help. The problem I just mentioned in the previous post is been solved. The application was running short of important jars in the classpath.

Thanks a lot Dan, Sweta.

02 Feb 2010, 06:53
Generic-user-small

Desai Sweta Y. (14 posts)

Hi Again,

I have successfully created the RESTful HotelBooking application. In that I have an action called checkAvailability(java.lang.String,org.hotel_booking.roomtype.RoomType,org.nakedobjects.applib.value.Date,org.nakedobjects.applib.value.Date) on Customer object. Now as this is having for parameters to be passed.. whenever I invoke the service from the REST viewer the URL turns out to be.. http://localhost:8080/object/OID:27/action/checkAvailability(java.lang.String,org.hotel_booking.roomtype.RoomType,org.nakedobjects.applib.value.Date,org.nakedobjects.applib.value.Date)

But when i m invoking the same URL in the client to use this service. Its giving me the error as i m not passing the parameters it seems. I am unaware how do i pass parameters to the function checkAvailability from my client application.

Please help, Sweta

02 Feb 2010, 07:54
Danhaywood-2011-282x282_pragsmall

Dan Haywood (133 posts)

Hi Desai,

First, could you create a new thread for new questions? It makes it easier for others browsing the forum to see when there’s new content.

Second, though, to answer your question. For the String and Dates, these are value types and so are parseable from string formats. Whatever format works in the DnD viewer should also work for the Restful viewer.

For the RoomType, this is (I presume) not a value type, instead it is a reference to a RoomType entity. So you need to provide the (string format of the ) OID of this object. Note that the OID is created ultimately by the Object Store, so the precise format will depend on which object store you are running with.

These values are all passed as parameters named arg0, arg1, arg2 etc. So for example you would have: * arg0=valueOfFirstStringArg * arg1=oidOfRoomType * arg2=valueOfFirstDateArg * arg3=valueOfSecondDateArg

Lastly, when you invoke the URI you should perform a POST.

There is some further detail in the online user guide, see http://restfulobjects.sourceforge.net/m2-site/main/documentation/docbkx/html/user-guide/ch03s03.html#sec.Actions (It doesn’t, admittedly, describe the format of the arguments, though … I must fix that).

Dan

  You must be logged in to comment