Monday, May 13, 2013

Adding system property to point NonDefault FireFox in selenium

When we start selenium server for firefox, it would try to lauch firefox from default location. To enable us to lauch firefox from different location we need to set the system property firefoxDefaultPath with the LOCATION/firefox.exe
 To add this in ant script we need to do something like below
<property location="C:/Program Files (x86)/Mozilla Firefox-3.6.18/firefox.exe" name="browserExe"></property>
<exec executable="cmd.exe" os="${os.name}" spawn="true">
 <arg line="start">
 <arg value="java">
 <arg value="-jar">
 <arg value="${sel.server.path}${sel.server.jar}">
 <arg value="-DfirefoxDefaultPath=${browserExe}">
</exec>

Tuesday, March 12, 2013

JBoss startup time with Spring and Struts

After migrating to JBoss 6.1.0, Spring 3.0.6 (were are using Struts 2) our application server started slowing down on strut-up. Before the migration if I am correct it used to take about around less then a minute and after migration it was taking around 3 mins.
 Recently I got new lappy at work, with new configuration the boot up was good but not so good, now it took me around 1min 30secs to boot.
 To know the startup issue, I profile the jvm with jvisualvm and profile data showed that time was taken by spring to initialize itself. Then to make things to initialize lazily, changed the xml configuration of spring and set default-lazy-init to true for every "beans" tag.
 Now I started JBOSS expecting it to start in secs, but then it again had the same story, it took same amount of time. Then again I profiled the jvm and saw there was no difference, then to trace down I noticed that even if beans were marked as lazy there were being initialized by struts by method
 com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(String) [This is found in xwork jar we have 2.0.4 version]

By looking at the method it suppose to get the class instance only and not create bean, but the code does have a call like below

clazz = appContext.getBean(className).getClass();

The above code is actual culprit, to get class instance the call is creating bean and then getting the class, the code should have been as

clazz = appContext.getType(className);

As our is web application I create a copy of this class with same package name and placed it in our WEB-INF\Classes dir (as this would be first to get loaded and then *.jar) this made sure that our customized class (SpringObjectFactory) would be loaded first by jboss server and not SpringObjectFactory from xwork.jar (other way's we can do is add agents to manipulate the class method using BCEL or Javassist)

After this changes, I started JBOSS, now it takes me about 37 to 39 secs too boot (still slow but its ok for now).
Wanted to give a patch for above fix in SpringObjectFactory, but found that xwork site is in RIP state, and I could not find any other version system to give above fix.

Saturday, February 16, 2013

OpenJDK 8 Build Ubuntu

Just done with OpenJDK 8 Build Ubuntu, it was easiest of all builds then done on Windows system. Had to run "configure" and it gave all the required commands to install required software for build....

Friday, February 15, 2013

Exporting and Importing Oracle Dump into XE

Today I was struggrlnig with exporting and importing Oracle dump into Oracle XE, at the end the site which came handy was stackoverflow-howto-import-an-oracle-dump-in-an-different-tablespace

Thursday, January 31, 2013

Daily activities Day 1 ;)

Will try to post my daily activities technically, as it would brush up things for me once I revist what I had done and it would give me to rethink on furture of wat I should do...

So as of now I was goin through parrallel classloading, acutaly was goin through openJDK 8 mail list and saw its being drop-off from Jdk 8.

6.37 Am
Parallel classloading

8:42 Am
A nice blog Now vs. 5 Years ago

NPE issue (my stupidity)
Was working on something and when I deployed the changes and started jboss it was ending up in NPE, I had this code change made as below


Properties props = new Properties();
props.put("mail.smtp.auth", "true");
System.setProperties(props); // this is the bug....we are overriding every thing :(


And when I was starting jboss, jboss server was ending up with NPE and was not able to user.dir.

Sum of two or more independent count querries

I got a situation where I needed sum of two independent table counts, had too search and got a querry as below.


Select count1 + count2 as total from
(Select count(*) as count1 from TABLE1 an where ....),
(Select count(*) as count2 from TABLE2 atf where ....)