Saurabh. Arora

Greenhorn
+ Follow
since Apr 27, 2011
Saurabh. likes ...
Mac Eclipse IDE Firefox Browser
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Saurabh. Arora

The best book for JSP and Servlets as per me is Head First JSP and Servlets. I referred that book and scored 94% in SCWCD.
10 years ago
To print currency symbols, use unicode character as follows:



Just search for the appropriate unicode character and use it this way.
10 years ago
I marshaled a class having an inner class (non-static) using Jackson library which worked absolutely fine. However, I am getting problem while un-marshaling the object. Reason being my inner class doesn't have any default constructor. I have copied sample code here:



On executing the code, I get an exception as:
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.tnsi.cnam.batch.utilities.Person$Student]: can not instantiate from JSON object (need to add/enable type information?)
at [Source: java.io.StringReader@1abab88; line: 1, column: 41] (through reference chain: com.tnsi.cnam.batch.utilities.Person["student"])


Is there any way around for this problem... I can't put default constructor because the actual class comes from thirdparty jar.

Thanks in advance...
10 years ago
Hi,

I am stuck with following RMI timeout problem and need urgent help,

1) Is there any way for configuring dynamically different RMI timeout values at RMI client depending upon some criteria.
2) Is there any way to override "sun.rmi.transport.tcp.responseTimeout" value at RMI client depending upon some criteria.


I tried below ways, but none of them worked. Is there any genius who can let me out of this problem.

1) I tried setting "sun.rmi.transport.tcp.responseTimeout" dynamically, but it only accept values that is set very first time.
System.getProperties().setProperty("sun.rmi.transport.tcp.responseTimeout",
rmiTimeout);

2) To override system properties dynamically, I tried way as below but that did not work
FileInputStream propFile = new FileInputStream("myProperties.txt");
Properties p = new Properties(System.getProperties());p.load(propFile);
p.setProperty("sun.rmi.transport.tcp.responseTimeout",rmiTimeout); System.setProperties(p);

3) I created rmiclientSocketFactory and pass it to LocateRegistry.getRegistry … but that did not work.
GUIClientSocketFactory guiClientSocketFactory = new GUIClientSocketFactory(Integer.parseInt(rmiTimeout));
public Socket createSocket(String host, int port) throws IOException {
Socket socket = new Socket(host, port);
socket.setSoTimeout(timeout);
return socket;
}
Registry reg = LocateRegistry. getRegistry(props.getProperty("rmiIpAddress"), (new Integer(props.getProperty("rmiPort"))) .intValue(),guiClientSocketFactory);

Any help will be extremely appreciated.

Thanks.
10 years ago