Occasions may arise where the recognition of the Java AUT (Application Under Test) is lost in SilkTest and the only way to retrieve recognition is to re-enable extensions via the “Application Configuration” wizard. When this behaviour occurs it is often accompanied by errors in the Open Agent log file (for log file location see: Where are the SilkTest Open Agent log files?) similar to the following example:

<?xml:namespace prefix = log4j /><log4j:event thread="Start Level Event Dispatcher" level="ERROR" timestamp="1309865093596" logger="org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext">
<log4j:throwable><![CDATA[org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean

The reason why this behaviour can occur is if you try to start the Open Agent while a half terminated instance of the Open Agent is still running because either the Agent became unstable and was improperly terminated or most likely because AUT did not release all components of the Open Agent which were loaded into it for recognition.

To resolve the problem immediately the best approach is to restart the machine and this will unload the Open Agent.

Subsequently if you ever need to restart the Open Agent then the recommended approach is to first stop the SilkTest Open agent, then stop the AUT before finally restarting the Open Agent again. Some additional tips for dealing with this behaviour include:

• In some instances even though the AUT is closed the java or javaw.exe process may still be running in the background. Therefore in situations like these, it is recommend you kill the java process either manually from Task Manager or by using a function call at the end of your testcase, like so: Sys_Execute( "TASKKILL /F /IM java.exe")

• Some Java Applications contain dynamic command line patterns, in such instances this can cause recognition to be dropped every time the AUT is restarted as the command line used to start the AUT will have changed. Therefore to avoid this problem, instead of hooking of all the command line parameter you should modify the frame.inc file to force SilkTest to hook all of the active java processes on the system instead, thus ensuring that the SilkTest Open Agent will capture all java traffic regardless if a dynamic command line pattern is used. This process will not have a negative effect on the test and the snippet below shows how you can implement the changes:

Initial command line pattern used with dynamic value “34197741981”

[ ] // The command line used to invoke the application
[ ] const sCmdLine = "C:\WINDOWS\system32\java.exe -D__jvm_launched=34197741981 -Djava.library.path=""lib/swt/3.6""
-cp SwtTestApp.jar;lib/swt/3.6/swt.jar qapswttest.TestApp"

Modified command line pattern which hooks only the java.exe

[ ] // The command line used to invoke the application
[ ] const sCmdLine = "C:\WINDOWS\system32\java.exe”</log4j:throwable>