Hi dev, Do not worry about the Simple exception, it is due to some clean-up task in the connector. Next version of Restlet 1.0 and 1.1 will lower the level of this message so it doesn't appear by default.
Best regards, Jerome > -----Message d'origine----- > De : dev dev [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 7 février 2008 08:56 > À : [email protected] > Objet : Re: Jaxb representation (HELP!) > > Thanks Florian. It works after i change it to test_binding. > Now i got this exception right after the following statement > got executed but it seems to go through fine. > > Customer customer = new Customer("foo", "bar"); > return new JibxRepresentation(MediaType.APPLICATION_XML, > customer, "test_binding"); > > ============================================= > Here is the exception > INFO: Exception intercepted > java.io.IOException: Stream closed > at > simple.http.ResponseStream.ensureOpen(ResponseStream.java:286) > at > simple.http.ResponseStream.flushBuffer(ResponseStream.java:204) > at simple.http.ResponseStream.flush(ResponseStream.java:190) > at > com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServe > rCall.java:368) > at > com.noelios.restlet.http.HttpServerConverter.commit(HttpServer > Converter.java:152) > at > com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHel > per.java:95) > at > com.noelios.restlet.ext.simple.SimpleProtocolHandler.handle(Si > mpleProtocolHandler.java:67) > at simple.http.Dispatcher.run(Dispatcher.java:83) > at simple.util.process.Daemon.execute(Daemon.java:121) > at simple.util.process.Daemon.run(Daemon.java:106) > > > > > On Feb 6, 2008 10:51 AM, dev dev <[EMAIL PROTECTED]> wrote: > > > Error in the code. It should be as follows. I will try > with you recommend and let you know. So you don't need the > full path to the binding filename (e.g. > src/main/java/com/mycompany/test/test_binding), how > does jibx know where to find that file without a full path? > > Also, in your code, you use a combination of > bindingName + bindingclass.tostring() as the key. It's bad > IMO if you're toString() is long. It should be just > bindingName + bindingClass.getName(). > > IBindingFactory jibxBFact = bindingFactories.get(bindingName > + bindingClass.toString()); > > ++++++++++++++++++++++++++++++++++++++++ > > Customer customer = new Customer("foo", "bar"); > return new > JibxRepresentation(MediaType.APPLICATION_XML, customer, > "test_binding"); > > > On Feb 6, 2008 10:31 AM, Florian Schwarz > <[EMAIL PROTECTED]> wrote: > > > could you try to replace "test-binding.xml" > with "test_binding" (and "test-binding"): > > return new > JibxRepresentation(MediaType.APPLICATION_XML, Customer.class, > "test_binding"); > > (I think either the plugin or JiBX self has > proplems with the '-' and I think the '.xml' should be removed) > > > If that does not work I recommend to check > wheter the bytecode of the Customer class has been enhanced. > For this purpose you could try to marshal/unmarhal it with > JiBX by hand or use Reflection to see whether JiBX has added > some methods. > > dev dev schrieb: > > what is the definition of binding name > or bindingClass? We have the binding file test-binding.xml > under /src/main/java/com/mycompany/test and our Customer > class i under src/main/java/com/mycompany/test/data/. > > In the Representation represent(Variant > variant) method { > etc... > > return new > JibxRepresentation(MediaType.APPLICATION_XML, Customer.class, > "test-binding.xml"); > } > > Thanks > dev > > > > On Feb 6, 2008 12:41 AM, Florian > Schwarz <[EMAIL PROTECTED]> wrote: > > > Hi dev, > > your integration of the > JiBX-Maven2-Plugin looks good so far. Please > send the code of the test case > and the JJiBX-Binding that uses the > JibxRepresentation. > > I think, that you have not > specified the bindingClass, that should bes used. > > Cheers > Flo. > > > dev dev schrieb: > > > Finally got every integrated > to our maven 2 build. However, we got > > this exception when running > one of our test cases (mvn test > > -Dtest=testjibx). We define > the jiBX binding in our pom.xml. What did > > we do wrong? > > > > <plugin> > > > <groupId>org.jibx</groupId> > > > <artifactId>maven-jibx-plugin</artifactId> > > > <version>1.1.5</version> > > <configuration> > > > <directory>src/main/java</directory> > > <includes> > > > <includes>*-binding.xml</includes> > > </includes> > > <excludes> > > > <exclude>template-binding.xml</exclude> > > </excludes> > > > <verbose>true</verbose> > > </configuration> > > <executions> > > <execution> > > > <phase>compile</phase> > > <goals> > > > <goal>bind</goal> > > </goals> > > </execution> > > </executions> > > </plugin> > > > > Output > > > -------------------------------------------------------------- > ----------------------------------------------- > > INFO: Exception intercepted > > java.io.IOException: Unable > to access binding information for class > > java.lang.Class > > Make sure the binding has > been compiled > > at > > > org.restlet.ext.jibx.JibxRepresentation.write(JibxRepresentati > on.java:219) > > at > > > com.noelios.restlet.http.HttpServerCall.writeResponseBody(Http > ServerCall.java:407) > > at > > > com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServe > rCall.java:361) > > at > > > com.noelios.restlet.http.HttpServerConverter.commit(HttpServer > Converter.java:152) > > at > > > com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHel > per.java:95) > > at > > > com.noelios.restlet.ext.simple.SimpleProtocolHandler.handle(Si > mpleProtocolHandler.java:67) > > at > simple.http.Dispatcher.run(Dispatcher.java:83) > > at > simple.util.process.Daemon.execute(Daemon.java:121) > > at > simple.util.process.Daemon.run(Daemon.java:106) > > > > > > On Feb 4, 2008 1:56 PM, dev > dev <[EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > Thanks much Jerome. > > > > > > On Feb 2, 2008 9:57 AM, > Jerome Louvel <[EMAIL PROTECTED] > > > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > Hi dev, > > > > I've just updated the > build script to include JiBX and > > generate its Maven > > artifacts. It will be > distributed with 1.1 M2, hopefully next > > week. > > > > Best regards, > > Jerome > > > > > -----Message d'origine----- > > > > De : dev dev > [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>] > > > > Envoyé : samedi 2 > février 2008 03:10 > > > À : > [email protected] > > > > <mailto:[email protected]> > > > > Objet : Re: Jaxb > representation (HELP!) > > > > > > After playing with > it a bit, we will go with jibx instead > > > (Thanks Florian) > mainly because of performance and its > > > java-centric XML > mapping approach. That said, how come we > > > don't see jibx on > http://maven.restlet.org/org/restlet/. I do > > > see jaxb there. > > > > > > Thanks > > > dev > > > > > > > > > On Jan 27, 2008 > 10:22 AM, dev dev <[EMAIL PROTECTED] > > > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > > > > Great help > Florian. We will definitely take a look at > > > Jibx representation > before considering JAXB. > > > > > > Thank you. > > > dev > > > > > > > > > On Jan 27, > 2008 1:17 AM, Florian Schwarz > > > <[EMAIL PROTECTED] > > > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > > > > Hi dev, > > > > > > the > usage of JaxbRepresentation is quite simple: > > > > > > Java -> XML > > > > > > > public Representation represent(Variant variant) { > > > > > > ... > > > > Flight flight = ... > > > > JaxbRepresentation jaxbRepOfMyFlight = new > > > > JaxbRepresentation(MediaType.TEXT_XML, flight); > > > ... > > > > return jaxbRepOfMyFlight > > > } > > > > > > > > > XML -> Java > > > > > > > JaxbRepresentation jaxbRep = new > > > > JaxbRepresentation(response.getEntity(), > > > > "com.mycompany.entity.jaxb"); > > > try { > > > > Flight flight = (Flight) jaxbRep.getObject(); > > > } > catch (IOException e) { > > > ... > > > } > > > > > > where > the package com.mycompany.entity.jaxb is > > > the JAXB-context-path > > > with > the existing Java domain objects > > > (eventually created > vom xsd). > > > > > > If > you start from your domain objects and not > > > from your xsd, I recommend > > > using > JIBX instead of JAXB. See also: > > > > > > > http://article.gmane.org/gmane.comp.java.restlet/3858/match=ji > > > bxRepresentation > > > > > > There > is an performance comparison between > > > different XML binding > > > frameworks at: > > > > http://www.ibm.com/developerworks/xml/library/x-databdopt2/ > > > > > > Cheers > > > Florian > > > > > > dev > dev schrieb: > > > > > > > Hi folks, > > > > > > > > has > anybody already used the JAXB XML binding > > > framework with Restlet? > > > > Are > there any sample codes we can take a look > > > at on how it's being > > > > > used in Restlet? Any performance issues we > > > should seriously consider > > > > > before using JAXB? > > > > > > > > > Thanks in advance for all the help. > > > > > > > > dev > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >

