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.
Related
I have run into an issue developing a HTTP client with the use of BouncyCastle libraries.
Target versions (but the error is also reproducible in Java 1.8.0_91 with the same version of BouncyCastle.)
JRE 1.6.0_45-b06
BouncyCastle jdk15to18 167 (bcprov-jdk15to18-167.jar, bcpkix-jdk15to18-167.jar, bctls-jdk15to18-167.jar)
HTTPClient code:
String strURL = "https://www.<WEBSITE>.com";
// CODE to set default TrustStore, KeyStore to be used
// setup BC as SecurityProvider and SSLSocketFactoryProvider
/*
Security.insertProviderAt(new BouncyCastleProvider(), 1);
Security.insertProviderAt(new BouncyCastleJsseProvider(), 2);
Security.setProperty("ssl.KeyManagerFactory.algorithm", "PKIX");
Security.setProperty("ssl.TrustManagerFactory.algorithm", "PKIX");
Security.setProperty("ssl.SocketFactory.provider", "org.bouncycastle.jsse.provider.SSLSocketFactoryImpl");
System.setProperty("jdk.tls.trustNameService", "true");
*/
URL url = new URL( strURL );
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("GET");
InputStream is = null;
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
System.out.println("OK");
is = conn.getInputStream();
} else if (conn.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
System.out.println("ERROR");
is = conn.getErrorStream();
} else {
System.out.println( conn.getResponseCode() );
System.out.println( conn.getResponseMessage() );
}
if (is != null) {
System.out.println( readFullyAsString(is, "UTF-8") );
}
conn.disconnect();
Accessing data on a website with TLS 1.2 without client_auth works fine (there are some issues with specific sites that return handshake_failure(40), but luckily not in our case). But when client_auth is required the code fails with the following (a little cryptic) error:
nov. 27, 2020 5:23:10 PM org.bouncycastle.jsse.provider.ProvTlsClient notifyAlertRaised
WARNING: Client raised fatal(2) internal_error(80) alert: Failed to read record
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
nov. 27, 2020 5:23:10 PM org.bouncycastle.jsse.provider.ProvTlsClient notifyAlertRaised
WARNING: Client raised fatal(2) internal_error(80) alert: Failed to read record
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.bouncycastle.tls.RecordStream$Record.fillTo(RecordStream.java:429)
at org.bouncycastle.tls.RecordStream$Record.readHeader(RecordStream.java:468)
at org.bouncycastle.tls.RecordStream.readRecord(RecordStream.java:201)
at org.bouncycastle.tls.TlsProtocol.safeReadRecord(TlsProtocol.java:768)
at org.bouncycastle.tls.TlsProtocol.readApplicationData(TlsProtocol.java:731)
at org.bouncycastle.jsse.provider.ProvSSLSocketDirect$AppDataInput.read(ProvSSLSocketDirect.java:603)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at HttpsClient.main(HttpsClient.java:109)
As expected the code runs just fine in Java 1.8 without BC as Security Provider ... but in Java 1.6 BC is needed for TLS 1.2 support.
I looked at the packets with Wireshark, but I don't have enough knowledge to analyze what's happening (failing) with the SSL handshake operation with the server.
What am I missing here? Or it's just a known limitation of BC?
Thanks for any suggestions.
After extensive research and testing (we set up our own dev environment that replicated the endpoint, we were trying to connect to with client cert) we have found a solution (posted below) that works for us in our dev environment, but couldn't be configured on the endpoint. That's why we went to plan B - TLS termination proxy and it worked like a charm in our case, when we didn't have control of the server environment.
Solution for IIS
In our case the web service requiring client auth was running on Microsoft IIS. As stated "Unfortunately our TLS libraries do not support renegotiation (and we do not plan to add it, although there are corresponding TLS 1.3 features that we will)." in this open issue (https://github.com/bcgit/bc-java/issues/593). After reading the IIS documentation and some testing we successfully configured the environment in a way that TLS sessions could be established with BC TLS lib:
Step 1:
Create an IIS site with default settings
Run IISCrypto with the "Best practices" template:
Step 2:
Enable SSLAlwaysNegoClientCert
Save the following text to a file called "Enable_SSL_Renegotiate.js"
var vdirObj=GetObject("IIS://localhost/W3svc/1");
// replace 1 on this line with the number of the web site you wish to configure
WScript.Echo("Value of SSLAlwaysNegoClientCert Before: " + vdirObj.SSLAlwaysNegoClientCert);
vdirObj.Put("SSLAlwaysNegoClientCert", true);
vdirObj.SetInfo();
WScript.Echo("Value of SSLAlwaysNegoClientCert After: " + vdirObj.SSLAlwaysNegoClientCert);
Run the following command from an elevated / administrator command prompt:
cscript.exe enable_ssl_renegotiate.js
I posted the same answer on BouncyCastle Github - #847
This question already has answers here:
InetAddress.getLocalHost() throws UnknownHostException
(9 answers)
Closed 6 years ago.
To develope a client applications, I need to read and modify worksheets and data in Google Sheets. I am facing with below issue:
SpreadsheetService service = new SpreadsheetService("sheet1");
String sheetUrl = "https://spreadsheets.google.com/feeds/list/1XP3KQTboWCArbvH99XYEGsVOldc97NqFzKD MiEepXRA/default/public/values"; //Sheet url
URL url = new URL(sheetUrl); // Get Feed of Spreadsheet url
ListFeed lf = service.getFeed(url, ListFeed.class); //Error statement
Issue:
java.net.UnknownHostException: spreadsheets.google.com 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.(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.plainConnect(Unknown
Source) at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown
Source) at
sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown
Source) at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:503)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135) at
com.google.gdata.client.Service.getFeed(Service.java:998) at
com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017) at
test_project.test_demo.main(test_demo.java:35)
As stated here, UnknownHostException means that your device was not able to resolve the host name. It emerges when you are trying to connect to a remote host using its host name, but the IP address of that host cannot be resolved. From this blog, you should check the input of Socket (or any other method that throws an UnknownHostException), and validate that it is the intended one. If you are not sure whether you have the correct host name, you can launch a terminal and use the nslookup command to see if your DNS server can resolve the host name to an IP address successfully.
If that doesn’t work, you should check if the host name you have is correct and then try to refresh your DNS cache. If that doesn’t work either, try to use a different DNS server, eg Google Public DNS is a very good alternative.
You can also check on this link. Hope this helps!
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.
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");
I have a simple GUI program that does some interactions with a database then once its completed ftps up some files to a server. This has worked perfectly until I added a SwingWorker thread to keep the GUI responsive.
The code I am using works fine if I put it in its standalone project but inside this project (SwingWorker thread) it gives me the following error:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at sun.nio.cs.StreamDecoder.read0(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at it.sauronsoftware.ftp4j.NVTASCIIReader.readLine(NVTASCIIReader.java:105)
at it.sauronsoftware.ftp4j.FTPCommunicationChannel.read(FTPCommunicationChannel.java:142)
at it.sauronsoftware.ftp4j.FTPCommunicationChannel.readFTPReply(FTPCommunicationChannel.java:187)
at it.sauronsoftware.ftp4j.FTPClient.openActiveDataTransferChannel(FTPClient.java:3511)
at it.sauronsoftware.ftp4j.FTPClient.openDataTransferChannel(FTPClient.java:3475)
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2641)
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2550)
at it.sauronsoftware.ftp4j.FTPClient.upload(FTPClient.java:2421)
at GUI$MatchFiles.doInBackground(GUI.java:1602)
at GUI$MatchFiles.doInBackground(GUI.java:1)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Any ideas?
EDIT:
I assume you mean something like this? Please note this is a very trimmed down version, I have removed a lot of superfluous code. I cant see any of it affecting this.
class Worker extends SwingWorker<Integer, Integer>{
protected Integer doInBackground() throws Exception{
FTPClient client = new FTPClient();
client.connect(url);
client.login(username, password);
client.setPassive(false);
client.changeDirectory(uploaddirectory);
client.upload(new File(fileuploadpath));
client.disconnect(true);
}
protected void done() {
System.out.println("Done");
}
}
As said, I take this code inside the swingworker and put it in its own class and it runs perfect.
It looks like your socket is cut-off by your firewall or anti-virus... Try disabling the firewall and anti-virus and re-run your program...