SilkTest base state unrecognized after consecutive tests run - java

In my testing environment, we have classes that perform certain actions, some of them using SilkTest stuff. The test procedures are defined by XML files that we parse, turn into ActionImpl classes, and perform stuff with. For example, the following will login to our app, switch users, and then restart the server:
<Script refBean="validateState" retry="false">
<DataGroups>
<Step action="log" mod="5.10.13 - Step 1" />
<Step action="switchUsers" target="mlane" />
<Step action="restartServer" />
</DataGroups>
</Script>
In the case of the restartServer action, the code eventually calls the following method, which creates a BaseState using the currently running eclipse.exe that the test is running in.
private PassFail restartServerInEclipse() {
Desktop desktop = new Desktop();
BaseState eclipseBaseState = new BaseState("*eclipse.exe", "/Shell[#caption='Java EE*']", TechDomain.SWT, TechDomain.XBROWSER, TechDomain.WIN32);
desktop.executeBaseState(eclipseBaseState);
// Do some stuff, like finding CTabItem objects, clicking them, etc.
return passFail;
}
Let's say I'm running the first test of the day. I just got to work, and decided to run a test. If the code gets to a restartServer action, and calls restartServerInEclipse(), it'll recognize the currently running eclipse.exe, and successfully perform any Silk methods on any Silk objects that I tell it to.
However, without exiting Eclipse or Open Agent, after a test has finished, if I run the same test again, as in, entirely new objects, entirely new test thread, the test ran and stopped, and I clicked the green run button in Eclipse again, I get the following error when it gets to the BaseState eclipseBaseState = new BaseState(...) code:
com.borland.silktest.jtf.common.LaunchApplicationFailedException: Failed to start application '*eclipse.exe' in working directory 'null'. The system cannot find the file specified.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.borland.silktest.jtf.agent.ExceptionTranslatorUtil.createException(ExceptionTranslatorUtil.java:60)
at com.borland.silktest.jtf.agent.ExceptionTranslatorUtil.translate(ExceptionTranslatorUtil.java:37)
at com.borland.silktest.jtf.agent.JtfModule.executeBaseState_aroundBody39$advice(JtfModule.java:121)
at com.borland.silktest.jtf.agent.JtfModule.executeBaseState(JtfModule.java:1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy24.executeBaseState(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
at org.springframework.remoting.rmi.RmiBasedExporter.invoke(RmiBasedExporter.java:72)
at org.springframework.remoting.rmi.RmiInvocationWrapper.invoke(RmiInvocationWrapper.java:72)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at org.springframework.remoting.support.RemoteInvocationUtils.fillInClientStackTraceIfPossible(RemoteInvocationUtils.java:47)
at org.springframework.remoting.rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:351)
at org.springframework.remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java:258)
at com.borland.silktest.startservice.RmiConnectionUtil$1.invoke(RmiConnectionUtil.java:134)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy0.executeBaseState(Unknown Source)
at com.borland.silktest.jtf.Agent.executeBaseState(Agent.java:452)
at com.borland.silktest.jtf.BaseState.execute(BaseState.java:298)
at com.borland.silktest.jtf.Desktop.executeBaseState(Desktop.java:69)
at scripts.misc.validation.action.RestartServerActionImpl.restartServerInEclipse(RestartServerActionImpl.java:62)
at scripts.misc.validation.action.RestartServerActionImpl.evaluate(RestartServerActionImpl.java:25)
at scripts.misc.validation.ValidateState.evaluateStep(ValidateState.java:108)
at scripts.misc.validation.ValidateState.script(ValidateState.java:131)
at scripts.base.BaseScript.runWithRetries(BaseScript.java:204)
at scripts.base.BaseScript.runIt(BaseScript.java:312)
at suite.MainThread.script(MainThread.java:667)
at suite.MainThread.run(MainThread.java:281)
The base state that worked completely fine two seconds previous is now incorrect. As if something about Eclipse changes once the base state is initially set, so it can't re-recognize it.
The only way to get around this is to restart Eclipse and Open Agent, but even that doesn't work sometimes, and I run into some license server issues with OA occasionally, which requires a computer reboot.

From the log file you posted, I can see that you are switching between testing eclipse.exe and iexplore.exe. The way your script is currently built it is either one or the other. This means that as soon as you switch to Internet Explorer, Silk Test is detaching from Eclipse and will no longer recognize the window.
Since you are starting your applications through other mechanisms anyway, I suggest the attach method, which is cumulative and will add the pattern instead of replacing it, so you'll avoid switching between the applications.
Desktop desktop = new Desktop();
desktop.attach("*\\eclipse.exe", TechDomain.SWT, TechDomain.XBROWSER, TechDomain.WIN32);
desktop.attach("*\\iexplore.exe", TechDomain.SWT, TechDomain.XBROWSER, TechDomain.WIN32);
Shell eclipse = desktop.find("/Shell[#caption='Java EE*']");
BrowserApplication browserApp = desktop.find("/BrowserApplication");

Related

Microsoft Translator API error retrieving translation

I'm simply trying to run this sample code below:
import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;
public class Translator {
public static void main(String[] args) throws Exception {
Translate.setClientId("ID GOES HERE");
Translate.setClientSecret("SECRET GOES HERE");
String translatedText = Translate.execute("Bonjour le monde",
Language.FRENCH, Language.ENGLISH);
System.out.println(translatedText);
}
}
and I'm getting the following Exception:
Exception in thread "main" java.lang.Exception: [microsoft-translator-api] Error retrieving translation : datamarket.accesscontrol.windows.net
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveString(MicrosoftTranslatorAPI.java:202)
at com.memetix.mst.translate.Translate.execute(Translate.java:61)
at Translator.main(Translator.java:10)
Caused by: java.net.UnknownHostException: datamarket.accesscontrol.windows.net
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at com.memetix.mst.MicrosoftTranslatorAPI.getToken(MicrosoftTranslatorAPI.java:133)
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveResponse(MicrosoftTranslatorAPI.java:160)
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveString(MicrosoftTranslatorAPI.java:199)
... 2 more
I know it seems like I'm not even trying to figure this out on my own but I'm a complete beginner and can't really understand the Exception trace at all by myself. I'm pretty sure I got the right client Secret. In my azure account I only see an application ID and an Object ID. I'm using the application ID as the client ID.
Does anyone have any ideas on what might be causing this? Any help is greatly appreciated.
Thank you!
The third party Java wrapper boatmeme/microsoft-translator-java-api for MS Azure Translator API is too old & unavailable, because it wrappered the old Microsoft Translator - Text Translation which is old & unavailable now.
There is a notice at the page top of the site Azure datamarket.
DataMarket and Data Services are being retired and will stop accepting new orders after 12/31/2016. Existing subscriptions will be retired and cancelled starting 3/31/2017. Please reach out to your service provider for options if you want to continue service.
For using the new Azure Translator API on Azure portal, you need to refer to the document Announcements: Microsoft Translator Moves to the Azure portal to know how to create the new one on Azure portal and use it via the new REST APIs. Meanwhile, just as reference, you can see my answer in Java for the other SO thread Microsoft Translator API Java, How to get client new ID with Azure.
Hope it helps.

Null pointer exception in an XML parsing story system with a java based combat system and a nimbus GUI

I currently have two halves of a video game; a storyboard system that reads in a scene from an XML file then displays a description of the scene and a list of choices that the player interacts with, and a combat system that works in a similar way only with the players prompts coming directly from the java system and not the XML. I am having trouble putting these two things together. I have combined the code of both but, in combining two working programs I have ended up with two NullPointerExceptions coming off of a DefaultListModel that in every instance has at least one value added. I can't figure out why it's still being thrown as NULL.
I cant enter my code here because it exceeds 30000 characters so here is a link to a version control repository:
https://github.com/jpinaz92/Itc303-textAdventure/commit/59a24a677b85ec237d9270c75592e09fd43cb9e6
If some one could figure out what is causing all of these problems it would rally help me, and if there is a way to post my code here even though it is longer than 30000 characters let me know and I will do it.
Here is the full output:
java.lang.NullPointerException
at textadventure.TextAdventureGUI2.initComponents(TextAdventureGUI2.java:199)
at textadventure.TextAdventureGUI2.<init>(TextAdventureGUI2.java:150)
at textadventure.TextAdventureGUI2$1.run(TextAdventureGUI2.java:107)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "main" java.lang.NullPointerException
at textadventure.TextAdventureGUI2.initComponents(TextAdventureGUI2.java:199)
at textadventure.TextAdventureGUI2.<init>(TextAdventureGUI2.java:150)
at textadventure.TextAdventureGUI2.main(TextAdventureGUI2.java:146)
I fixed it the issue was in the initialization the list model needed arguments.

SOAP web service not working for EJB calls

I am trying to create a SOAP based web service, which will call stateless EJB in other project. My configuration is Server: WAS 8.5,IDE: RAD 8.5,Java 1.6, EJB 3.1, and SOAP 1.1. When I write a simple addition method it properly create Web Service, WSDL and i can access the Web Service. But When i add another method which calls EJB it wont allows me to create service and WSDL, it throws below error popup :
Errors occurred during wsgen.
error: compilation failed, errors should have been reported
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
Note: ap round: 1
Problem encountered during annotation processing;
see stacktrace below for more information.
java.lang.NullPointerException
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(Unknown Source)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.process(Unknown Source)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(Unknown Source)
at com.sun.tools.apt.comp.Apt.main(Unknown Source)
at com.sun.tools.apt.main.AptJavaCompiler.compile(Unknown Source)
at com.sun.tools.apt.main.Main.compile(Unknown Source)
at com.sun.tools.apt.main.Main.compile(Unknown Source)
at com.sun.tools.apt.Main.processing(Unknown Source)
at com.sun.tools.apt.Main.process(Unknown Source)
at com.sun.tools.apt.Main.process(Unknown Source)
at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.buildModel(Unknown Source)
at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.run(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.jws22.v85.command.AbstractWsGenCommand.execute(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.command.WsGenCommand.execute(Unknown Source)
....
This is my code which works fine
public class Operations {
public int addition(int x, int y){
return x+y;
}
public String Greetings(String name){
return "happy birthday"+name;
}
}
when i add
#EJB
private transient StatusEJBBeanLocal statusEJBBeanLocal;
public Product StatusFromProductId(int ProdutoID) {
Product produto = null;
produto = this.statusEJBBeanLocal.StatusFromProductId(ProdutoID);
return produto;
}
It shows error. Please help me out here with some tutorial link or tell me whats wrong with my code, how to call EJB from Web services. Thanks in advance.

Getting StackOverFlow Error in Kettle(PDI)

everyone,when i use kettle to do loop,the error occured,the kettle's memory is 8G ,I used hundreds of cycles,Kettle to cycle 1500 times, when the cycle time to about 700 times the error occourd.how can i solve it
ERROR (version 5.0.1-stable, build 1 from 2013-11-15_16-08-58 by buildguy) : java.lang.StackOverflowError
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
at java.io.File.exists(File.java:772)
at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1057)
at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1024)
at sun.misc.URLClassPath.findResource(URLClassPath.java:172)
at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
at java.lang.ClassLoader.getResource(ClassLoader.java:1138)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:553)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:515)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:501)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2797)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2774)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2759)
at org.pentaho.di.job.entries.trans.JobEntryTrans.getTransMeta(JobEntryTrans.java:1166)
at org.pentaho.di.job.entries.trans.JobEntryTrans.execute(JobEntryTrans.java:634)
at org.pentaho.di.job.Job.execute(Job.java:678)
at org.pentaho.di.job.Job.execute(Job.java:815)
at org.pentaho.di.job.Job.execute(Job.java:815)
at org.pentaho.di.job.Job.execute(Job.java:815)
I'm no expert in Kettle. However, a StackOverflowError is NOT caused by running out of memory, so the fact that you have an 8Gb heap is not directly relevant. What is relevant is the size of the thread stack. That is controlled by the java command's -Xss command-line option.
I also don't know what you mean by "cycles" in the context of Kettle ... and Google isn't helping me. However, I guess it is something to do with Jobs that cause other Jobs to run. And since you hit the limit at ~700 and need to get to ~1500, you probably need to triple the current thread stack size ... whatever that may be.

ProGuard difficulties when obfuscating with libraries

While trying to use ProGuard (4.9) to obfuscate and optimise a desktop application everything works up until I use something from an external library such as JSoup.connect("http://google.com/").get();. I would get the following error:
Exception in thread "Thread-2" java.lang.ExceptionInInitializerError
at org.jsoup.b.l.<clinit>(Unknown Source)
at org.jsoup.b.f.<init>(Unknown Source)
at org.jsoup.b.e.<init>(Unknown Source)
at org.jsoup.c.bh.b(Unknown Source)
at org.jsoup.c.bh.a(Unknown Source)
at org.jsoup.c.b.a(Unknown Source)
at org.jsoup.c.D.a(Unknown Source)
at org.jsoup.a.a.a(Unknown Source)
at org.jsoup.a.i.e(Unknown Source)
at org.jsoup.a.e.a(Unknown Source)
at package.a.a(Unknown Source)
at package.a.b(Unknown Source)
at package.w.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load0(Unknown Source)
at java.util.Properties.load(Unknown Source)
at org.jsoup.b.k.d(Unknown Source)
at org.jsoup.b.k.<clinit>(Unknown Source)
... 14 more
I have tried searching for a solution but the answer would always be for an android application. With no luck I have attempted the following:
Turn off Use mixed-class names
Added to config -keep public enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
Recently, going through with this process using ProGuard 5.2, not much has changed. Here is the updated process to fixing the issue:
Go to the Obfuscation tab.
Go to the bottom for Keep additional class names and class member names
Click on Add... to the right
Go down to Extends/implements class and type in your library matching the examples below then press Ok. Repeat for every library.
For JSoup: org.jsoup.**
For Apache Commons Net: org.apache.commons.net.**
For SwingX: org.jdesktop.**
For GSON: org.google.gson.**
Go to the Information tab.
Turn off Skip non-public library class members
Turn on Ignore warnings about possibly erroneous input
Process!

Categories

Resources