Metro+Jetty+Jsonwebservice issues

152 views
Skip to first unread message

minami

unread,
Jul 2, 2012, 5:07:14 AM7/2/12
to jsonweb...@googlegroups.com
Hi.

I've tried to implement simple standalone application that exposes same api via json-rpc and soap. Please find sources attached, they are ultimately simple.

So, SOAP works smoothly, but json-rpc is not.

Here is two problems I'm stuck on:

1) When I'm calling http://localhost:8080/web/json?js , I'm obtaining the following stacktrace:

16:04:02.130 [pool-1-thread-3 - /web/json?js] DEBUG org.eclipse.jetty.server.Server - REQUEST /web/json on AsyncHttpConnection@2d69b054,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=9,c=0},r=1
java.lang.StackOverflowError
    at java.util.LinkedHashMap.access$000(LinkedHashMap.java:147)
    at java.util.LinkedHashMap$Entry.recordAccess(LinkedHashMap.java:350)
    at java.util.LinkedHashMap.get(LinkedHashMap.java:300)
    at java.io.ExpiringCache.entryFor(ExpiringCache.java:102)
    at java.io.ExpiringCache.get(ExpiringCache.java:77)
    at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:395)
    at java.io.File.getCanonicalPath(File.java:589)
    at java.io.FilePermission$1.run(FilePermission.java:221)
    at java.io.FilePermission$1.run(FilePermission.java:209)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.io.FilePermission.init(FilePermission.java:209)
    at java.io.FilePermission.<init>(FilePermission.java:285)
    at sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:227)
    at sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:153)
    at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:123)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:80)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
    at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150)
    at java.net.URL.openStream(URL.java:1035)
    at com.sun.xml.ws.util.ServiceFinder.parse(ServiceFinder.java:310)
    at com.sun.xml.ws.util.ServiceFinder.access$200(ServiceFinder.java:145)
    at com.sun.xml.ws.util.ServiceFinder$LazyIterator.hasNext(ServiceFinder.java:365)
    at com.sun.xml.ws.util.ServiceFinder.toArray(ServiceFinder.java:229)
    at com.jaxws.json.codec.doc.JSONHttpMetadataPublisher.handleMetadataRequest(JSONHttpMetadataPublisher.java:55)
    at com.sun.xml.ws.transport.http.HttpAdapter.handleGet(HttpAdapter.java:270)
    at com.sun.xml.ws.transport.http.HttpAdapter.invokeAsync(HttpAdapter.java:465)
    at com.sun.xml.ws.transport.http.HttpAdapter.invokeAsync(HttpAdapter.java:460)
    at com.jaxws.json.codec.doc.JSONHttpMetadataPublisher.handleMetadataRequest(JSONHttpMetadataPublisher.java:69)
...

2) When I'm trying to call method, I'm obtaining the following stacktrace:

16:05:15.109 [pool-1-thread-3 - /web/json] DEBUG org.eclipse.jetty.server.Server - REQUEST /web/json on AsyncHttpConnection@213fdeca,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=2,l=8,c=21},r=3
июл 02, 2012 4:05:15 PM com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit handle
SEVERE: com.sun.net.httpserver.Headers cannot be cast to com.sun.xml.ws.transport.Headers
java.lang.ClassCastException: com.sun.net.httpserver.Headers cannot be cast to com.sun.xml.ws.transport.Headers
    at com.jaxws.json.codec.JSONCodec.decode(JSONCodec.java:482)
    at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:336)
    at com.sun.xml.ws.transport.http.HttpAdapter.access$400(HttpAdapter.java:96)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:591)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
    at com.sun.xml.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:110)
    at com.sun.xml.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:95)
    at org.eclipse.jetty.http.spi.HttpSpiContextHandler.doScope(HttpSpiContextHandler.java:81)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
    at org.eclipse.jetty.server.Server.handle(Server.java:347)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:931)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:870)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:238)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:615)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

16:05:15.125 [pool-1-thread-3 - /web/json] DEBUG org.eclipse.jetty.server.Server - RESPONSE /web/json  500

It's interesting that pretty GUI at http://localhost:8080/web/json? works and addresses like ?config , ?jsonmodel works too.

Could anybody help me to resolve these issues please?
jaxws-jetty-json.zip

minami

unread,
Jul 2, 2012, 5:23:10 AM7/2/12
to jsonweb...@googlegroups.com
I've fixed the second issue with patch attached.

Could you review it and apply to sources or make something similar?
headers.patch

Sundar Murthi

unread,
Jul 2, 2012, 5:34:18 AM7/2/12
to jsonweb...@googlegroups.com
Hi Minami,
Thanks for the patch. I will get back to you very soon with this update.

For first issue js client generation, Which json client your trying to use? (Jquery, yahoo ui or other)


On Jul 2, 2012, at 11:23 AM, minami wrote:

> I've fixed the second issue with patch attached.
>
> Could you review it and apply to sources or make something similar?
> <headers.patch>

minami

unread,
Jul 2, 2012, 5:55:14 AM7/2/12
to jsonweb...@googlegroups.com
Which json client your trying to use? (Jquery, yahoo ui or other)
I'm just trying to get this URL via browser.

Also I've found that if I open the following URL: http://localhost:8080/web/json?formsayHi , then click "Submit", the same stacktrace is generated.

minami

unread,
Jul 2, 2012, 6:07:37 AM7/2/12
to jsonweb...@googlegroups.com
1) When I'm calling http://localhost:8080/web/json?js , I'm obtaining the following stacktrace:

Any URL like this: http://localhost:8080/web/json?sayHi.arg0=xxx , xxx may be empty causes stacktrace.

Sundar Murthi

unread,
Jul 2, 2012, 8:42:05 AM7/2/12
to jsonweb...@googlegroups.com
Hi,
   Fix for second issue is in our svn, will be included in next release.

For first issue (java.lang.StackOverflowError) from meta data producer. I am trying to reproduce it, but I can't reproduce it.   Can you give more information on,

1) Java version?
2) Metro(jax-ws) version your using?


You simply try doing post insteed of get. You can do it quickly in end point document by pressing ">>" button.

minami

unread,
Jul 2, 2012, 8:58:11 AM7/2/12
to jsonweb...@googlegroups.com


On Monday, July 2, 2012 7:42:05 PM UTC+7, jsonwebservice wrote:
For first issue (java.lang.StackOverflowError) from meta data producer. I am trying to reproduce it, but I can't reproduce it.   Can you give more information on,

1) Java version?
1.7
2) Metro(jax-ws) version your using?
Copied from your pom.xml into my pom.xml
 

You simply try doing post insteed of get. You can do it quickly in end point document by pressing ">>" button.
There is NO problem with method calls, they are works.

But ?js service URL and your debug urls like ?sayHi.arg0=xxx are producing stack overflow.

Sundar Murthi

unread,
Jul 2, 2012, 10:21:15 AM7/2/12
to jsonweb...@googlegroups.com
Thanks Again,
    Indeed this is an issue with metro 2.1 and json codec.

Codec was tested with 2.0.1.


There is implementation change in metro, which always looping the get request.  This is fixed in codec.  Fix included in next release.



In 2.1.0

public void invokeAsync(WSHTTPConnection con, CompletionCallback callback) throws IOException
/*     */   {
/* 465 */     if (handleGet(con)) {
/* 466 */       callback.onCompletion();
/* 467 */       return;
/*     */     }
/*     */ 
/* 469 */     Pool currentPool = ge


// In 2.0.1

 public void invokeAsync(WSHTTPConnection con) throws IOException {
/* 401 */     Pool currentPool = getPool();
/* 402 */     HttpToolkit tk = (HttpToolkit)currentPool.take();
/*     */     Packet request;
/*     */     try {
/* 405 */       request = decodePacket(con, tk.codec);
/*     */     } catch (ExceptionHasMessage e) {
/* 407 */       LOGGER.log(Level.SEVERE, e.getMessage(), e);
Message has been deleted

minami

unread,
Jul 2, 2012, 10:49:23 AM7/2/12
to jsonweb...@googlegroups.com
Ok, so may I donate some $$ for your perfect work? :3

minami

unread,
Jul 2, 2012, 10:50:31 AM7/2/12
to jsonweb...@googlegroups.com
And just one more question. Could you upload your pretty codec into maven central? Or, at least, setup your own repository?

Sundar Murthi

unread,
Jul 2, 2012, 7:05:44 PM7/2/12
to jsonweb...@googlegroups.com
In central maven may available end of this week or latter. We are in progress of adding in central public maven repository.

Mean time you can download the 0.8 version and add it in your local repository.

jsonwebservice

unread,
Oct 3, 2012, 11:01:53 AM10/3/12
to jsonweb...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages