I've traced through the Restlet 2.0rc4 code for both the success case
(no GWT) and the failure case (gwt-dev.jar in on classpath).  The
issue is how DomRepresentation.createTransformer() creates the
necessary javax.xml.transform.TransformerFactory instance.

In the success case, we end up in FractoryFinder.findJarService() at
the line 255,

is = ss.getResourceAsStream(cl, serviceId);

and the result is null.  Therefore, the code returns and uses the
fallback class
("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"),
which works.

In the failure case (when gwt-dev.jar in on the classpath), line 255
DOES return a class, the code that immediately follows is then able to
read the factoryClassName from the class, which ends up being,
"org.apache.xalan.processor.TransformerFactoryImpl".  Later, the
attempt to instantiate this class fails with a ClassNotFoundException.

So it seems that the gwt-dev.jar file contains some configuration that
tricks Restlet into attempting to instantiate the wrong
TransformerFactory implementation.

How would I go about making Restlet ignore this Jar.  Note that this
is only an issue in the development environment, because gwt-dev.jar
is not copied to the production server.  However, it's still a show
stopper bug for me, because I can't debug my client application with
my rest services.

Does anyone on the GWT team know that this may be about?  Any help
would be welcome.  I will pass it on to the Restlet team.  Thanks.



On Jul 7, 10:01 am, emurmur <[email protected]> wrote:
> I have an Java App Engine project using SDK 1.3.5 and the latest
> Restlet GAE 2.0rc4 to implement some restful services.  Everything
> worked well (this has been in production for 6 months) until I added
> GWT 2.0.4 to the project.  As soon as I check use GWT on in the
> control panel in Eclipse (without even adding a module) my services
> start to fail in the development server with the following class not
> found exception:
>
> Couldn't write the XML representation: Provider
> org.apache.xalan.processor.TransformerFactoryImpl not found
>
> This exception happens on the way out of my Restlet, after a GET of a
> lists of entities, as it tries to turn my DomRepresentation into the
> response payload.  I've found that if I remove the gwt-dev.jar, the
> exception does not happen.  Of course, I can't use the development
> server if I do that.   Again, this all works fine without GWT.
>
> Here is the relevant parts of the trace:
>
> SEVERE: An exception occured writing the response entity
> java.io.IOException: Couldn't write the XML representation: Provider
> org.apache.xalan.processor.TransformerFactoryImpl not found
>         at
> org.restlet.ext.xml.DomRepresentation.write(DomRepresentation.java:
> 287)
>         at
> org.restlet.representation.WriterRepresentation.write(WriterRepresentation. 
> java:
> 104)
>         at
> org.restlet.engine.http.ServerCall.writeResponseBody(ServerCall.java:
> 502)
>         at org.restlet.engine.http.ServerCall.sendResponse(ServerCall.java:
> 439)
>         at
> org.restlet.ext.servlet.internal.ServletCall.sendResponse(ServletCall.java:
> 451)
>         at
> org.restlet.engine.http.adapter.ServerAdapter.commit(ServerAdapter.java:
> 198)
>         at
> org.restlet.engine.http.HttpServerHelper.handle(HttpServerHelper.java:
> 151)
>         at
> org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1037)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>         at
> org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.jav
> a:1166)
>         at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFi 
> lter.
> java:51)
>         at
> org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.jav
> a:1157)
>         at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans 
> actio
> nCleanupFilter.java:43)
>         at
> org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.jav
> a:1157)
>         at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFile 
> Filte
> r.java:122)
>         at
> org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.jav
> a:1157)
>         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 388)
>         at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>         at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 182)
>         at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>         at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEn 
> gineW
> ebAppContext.java:70)
>         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>         at
> com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.han
> dle(JettyContainerService.java:349)
>         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>         at org.mortbay.jetty.Server.handle(Server.java:326)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to