I am using retrofit 2.0.0-beta1 with SimpleXml. I want the retrieve a Simple (XML) resource from a REST service. Marshalling/Unmarshalling the Simple object with SimpleXML works fine. When using this code (converted form pre 2.0.0 code): Service: I get this exception: What am i missing? I know that wrapping t…
Tag: java
Logging JSON-RPC calls using jsonrpc4j
I’m sure that if you have used jsonrpc4j (outside a spring container) you will recognise the following standard pattern. I am trying to create a log file containing all the JSON requests and JSON responses. i.e. I’d like to log the incoming JSON RPC request before it is deserialised and log the ou…
Java “”(” expected” compiler error
I’m a beginner in Java and after a few time of studying this language by books, I decided to write a simple program that “encrypts” a string by replacing numbers with letters and vice versa. It is not finished yet and has some considerable restrictions, but it should work as is. The code: It…
Does proguard converts all enums to int or needs to be configured for this
Does proguard automatically converts enums to integer for memory optimization or I have to configure it to do this? If I do have to configure what is the configuration? Answer The optimization is listed on ProGuard’s optimizations page. It appears to be one of the default optimizations, but it (like oth…
Java 8: Lambda with variable arguments
I am looking for a way to invoke multiple argument methods but using a lambda construct. In the documentation it is said that lambda is only usable if it can map to a functional interface. I want to do something like: Is there any way one can do this elegantly without defining 10 interfaces, one for each argu…
javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
I am facing a problem while deploying a war on to tomcat instance, Tomcat version details, POM Dependency : I have created a war using maven plugin and tried to deploy on tomcat 7. I was able to deploy but unable to start the webapp. When I find the logs for it, it gave below stacktrace, Any help would be
Java 8 stream short-circuit
Reading up a bit on Java 8, I got to this blog post explaining a bit about streams and reduction of them, and when it would be possible to short-circuit the reduction. At the bottom it states: Note in the case of findFirst or findAny we only need the first value which matches the predicate (although findAny i…
Speed of custom Java classes vs. Maps
Which is faster: a Set whose elements are each an instance of CustomObject as defined below: a Set whose elements are each an instance of Map<String, String> where each Map is of the format {“A” : Avalue, “B” : Bvalue, “C” : Cvalue}? or any other data structure that y…
How do I trigger the default signal handling behavior?
In my Java application I want to capture SIGINTs, do some pre-processing, and then let the default behavior (process termination) run. I would think I could do something like this: However when I send at SIGINT to this application, I get a SEGV: It seems SignalHandler.SIG_DFL is not meant to be called directl…
Type mismatch: cannot convert from org.slf4j.Logger to org.apache.log4j.Logger
i configure my environment in eclipse Mars but i got an error with the log4j. I use spring 4 and maven as dependency manager. Hier some part of code: Eclipse show me an error on this line, the second part after the equals: The error: My propertyConfiguration is into the com.myapp.bootstrap and the xml file in…