Archive for the ‘programming’ Category.

exec – IllegalThreadStateException: process has not exited

This is one nasty exception I experienced today.

I execute one .executable file from java. Reading the inputstream and the error stream with two different threads (why). I wait till ‘join’ing the thread then I took the process exit value.

processLogThread.join();
errorLogThread.join();
 try {
 logger.info("Thread status:"+processLogThread.isAlive()+" "+errorLogThread.isAlive());
 logger.info("Process exit value:"+p.exitValue());
 } catch (Exception e) {
 logger.error("Error while reading process exit value", e);
 }

Unfortunately, it threw the following exception. The streams are closed. Threads are dead. But it says process has not exited. aaw!!

18:19:39,802         INFO Utilities:432 - Thread status:false false
18:19:39,805        ERROR Utilities:435 - Error while reading process exit value
java.lang.IllegalThreadStateException: process has not exited
 at java.lang.ProcessImpl.exitValue(Native Method)
 at com.eginnovations.license.util.Utilities.genLicense5(Utilities.java:433)

JVM Monitoring

Clojure’s Approach to Polymorphism: Method Dispatch

I came across the following article on Clojure’s Approach to Polymorphism: Method Dispatch. Still I couldn’t understand how it is more advantageous against single dispatch in terms of complexity, resource consumption!!!

http://www.developer.com/lang/other/article.php/10942_3878656_1/Clojures-Approach-to-Polymorphism-Method-Dispatch.htm

Still I feel adding more rules will consume similar man hours! any comments?

Clojure’s Approach to Polymorphism: Method Dispatch

problem with multiple tiles configuration files

This is an interesting problem for this newbie. I have one common tiles configuration file tiles.xml. I decided to split it into pieces based on modules. The syntax allows me to do it. the web.xml entry changed from

<context-param>
 <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
 <param-value>/WEB-INF/tiles.xml</param-value>
 </context-param>

to

<context-param>
 <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
 <param-value>/WEB-INF/tiles-license.xml,/WEB-INF/tiles-common.xml</param-value>
 </context-param>

Fortunately/Unfortunately, I declared all my basic templates in tiles-common.xml which is reused by tiles-license.xml. Pathetic. I ended up with annoying exception

org.apache.tiles.definition.NoSuchDefinitionException: licenseExpiryList
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:578)
    org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
    org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
    org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

We need to specify the tiles config files in ‘correct’ order. base definitions at first, children at the last.

Ref: http://old.nabble.com/How-can-I-separate-tiles.xml-in-several-files—td13216254.html

org.apache.tiles.definition.NoSuchDefinitionException: licenseExpiryList
	org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:578)
	org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
	org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
	org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)

Connecting to MySQL across Domain and workgroup

I have a mysql running in a box connected to a domain. I tried to connect it from a laptop not connected to the same domain. It is running as a workgroup. Though the parameters are correct, I got an error ‘Error Code: 1045′

An error occured while establishing the connection.
 Type: java.sql.SQLException   Error Code: 1045   SQL State: 28000
 Message:
 Access denied for user 'root'@'192.168.10.74' (using password: NO)

But I am able to connect to Oracle DB which is running in the same environment. Googling fetch me some results saying we need to give permissions suitable for the situation. I ran the following query which solved the connectivity issue.

GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'your_root_password';