jnan77 / jsonrpc4j

Automatically exported from code.google.com/p/jsonrpc4j
0 stars 0 forks source link

Log rethrown InvocationTargetExceptions at a lower level than SEVERE in JsonRpcServer.handleObject() #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1) Throw a runtime exception in the service.
2) See the exception get rethrown to the client (good and expected)
3) See scary SEVERE log entry in server log

What is the expected output? What do you see instead?

I would except to see, at most, a WARNING level log entry (but would prefer 
INFO, since in the event the exception is re-thrown, this is really working as 
expected).

What I see instead is this:

SEVERE: Error in JSON-RPC Service
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.googlecode.jsonrpc4j.JsonRpcServer.invoke(JsonRpcServer.java:512)
    at com.googlecode.jsonrpc4j.JsonRpcServer.handleObject(JsonRpcServer.java:383)
    at com.googlecode.jsonrpc4j.JsonRpcServer.handleNode(JsonRpcServer.java:292)
    at com.googlecode.jsonrpc4j.JsonRpcServer.handle(JsonRpcServer.java:229)
    at com.googlecode.jsonrpc4j.JsonRpcServer.handle(JsonRpcServer.java:206)
    at com.googlecode.jsonrpc4j.spring.JsonServiceExporter.handleRequest(JsonServiceExporter.java:40)
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    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:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: net.bobshouse.login.api.LoginServiceException$EntityExists: Attempt 
to create duplicate domain with name = domain2
    at net.bobshouse.login.dao.DomainDao.createDomain(DomainDao.java:56)
    at net.bobshouse.login.LoginServiceImpl.createDomain(LoginServiceImpl.java:46)
    ... 35 more

What version of the product are you using? On what operating system?

0.27 on Mac OS/X 10.8 and Debian Linux.

Please provide any additional information below.

Original issue reported on code.google.com by lafehub...@gmail.com on 17 Feb 2013 at 8:18

GoogleCodeExporter commented 8 years ago
Sorry, I was being imprecise above.  The exception isn't getting rethrown in 
the server; what I meant was that the client receives the response and throws 
the correct exception.

After looking through the code some more, maybe add a property to 
AbstractJsonServiceExporter that lets us control the level at which 
InvocationTargetExceptions get logged in the server?

Original comment by lafehub...@gmail.com on 17 Feb 2013 at 8:53

GoogleCodeExporter commented 8 years ago
Will address for next release.

Original comment by brian.di...@gmail.com on 25 Feb 2013 at 7:29

GoogleCodeExporter commented 8 years ago
Thank you for including this in the next release because this issue is really 
polluting our server logs. Do you already have a approximate date planned for 
this next release? Thanks in advance.

Original comment by anael.fi...@gmail.com on 15 Mar 2013 at 1:43

GoogleCodeExporter commented 8 years ago
Changed log level for exceptions to WARNING

Original comment by brian.di...@gmail.com on 24 Mar 2013 at 8:10

GoogleCodeExporter commented 8 years ago
Scratch that, made it configurable.

Original comment by brian.di...@gmail.com on 24 Mar 2013 at 8:12

GoogleCodeExporter commented 8 years ago
Thanks a lot for this patch. Unfortunately I'm using jsonrpc4j in Spring via 
AutoJsonRpcServiceExporter and can't have directly access to the JsonRpcServer 
object to change this property (or I didn't found how).

I've done a patch so it's possible to use it as a bean property (like 
allowExtraParams or rethrowExceptions for instance). This way it is possible to 
simply modify the logging level when defining the bean like that :

<bean class="com.googlecode.jsonrpc4j.spring.AutoJsonRpcServiceExporter">
    <property name="exceptionLogLevel" value="FINE" />
</bean>

I've attached the patch to this comment, do you think it would be possible to 
include this feature in the next release?

Best regards and thank you very much for all the work you do on this library.

Original comment by anael.fi...@gmail.com on 28 Mar 2013 at 1:48

Attachments: