how to get rid of errors in VersionInspectorLinker using GWTP? - gwt

When starting my first GWTP application I got this error message:
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at com.gwtplatform.common.rebind.VersionInspectorLinker.fetchArtifactVersion(VersionInspectorLinker.java:178)
at com.gwtplatform.common.rebind.VersionInspectorLinker.checkLatestVersion(VersionInspectorLinker.java:154)
I could configure a proxy in the jvm args of the gwt-maven-plugin, but the problem is that other developers would need to use different proxies and we also don't have Internet connection in our continuous integration servers.
How can this checking be disabled?

This is very simple. Add this to your .gwt.xml file:
<set-configuration-property name="verifyNewerVersion" value="false"/>

Related

Connecting to an OPC-UA server using Eclipse Milo, fails on BadHostUnknown

I am new to OPC-UA and Eclipse Milo and I am trying to construct a client that can connect to the OPC-UA server of a machine we have just acquired.
I have been able to set up a simple OPC-UA server on my laptop by using this python tutorial series: https://www.youtube.com/watch?v=NbKeBfK3pfk. Additionally, I have been able to use the Eclipse Milo examples to run the subscription example successfully to read some values from this server.
However, I have been having difficulty connecting to the OPC-UA server of the machine we have just received. I have successfully connected to this server using the UaExpert client, but we want to build our own client using Eclipse Milo. I can see that some warnings come up when using UaExpert to connect to the server which appear to give clues about the issue but I have too little experience in server-client communications/OPC-UA and would appreciate some help. I will explain what happens when I use the UaExpert client as I have been using this to try and diagnose what is going on.
I notice that when I first launch UaExpert I get the following errors which could be relevant:
Discovery FindServersOnNetwork on opc.tcp://localhost:4840 failed (BadTimeout), falling back to FindServers
Discovery FindServers on opc.tpc://localhost:4840 failed (BadTimeout)
Discovery GetEndpoints on opc.tcp://localhost:4840 failed
I am really new to networking so not sure exactly what this means.
I will outline the process I have followed when trying to get the SubscriptionExample of Eclipse Milo working with this machine's server. Firstly, I change the getEndpointUrl() method to the ip address of the device we are using: return "opc.tcp://11.23.1.1:4840". I can successfully ping the device using ping 11.23.1.1 from my laptop. When I try to run the SubscriptionExample with this address I get the following error:
[NonceUtilSecureRandom] INFO o.e.m.o.stack.core.util.NonceUtil - SecureRandom seeded in 0ms.
18:36:23.879 [main] ERROR o.e.m.e.client.ClientExampleRunner - Error running client example: java.net.UnknownHostException: br-automation
java.util.concurrent.ExecutionException: java.net.UnknownHostException: br-automation
at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.util.concurrent.CompletableFuture.get(Unknown Source)
at org.eclipse.milo.examples.client.SubscriptionExample.run(SubscriptionExample.java:50)
at org.eclipse.milo.examples.client.ClientExampleRunner.run(ClientExampleRunner.java:120)
at org.eclipse.milo.examples.client.SubscriptionExample.main(SubscriptionExample.java:42)
Caused by: java.net.UnknownHostException: br-automation
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:148)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:145)
at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:43)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:63)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:55)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:57)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:32)
at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:108)
at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:180)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:166)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:984)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:504)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Unknown Source)
18:36:23.881 [ForkJoinPool.commonPool-worker-1] ERROR o.e.m.e.client.ClientExampleRunner - Error running example: java.net.UnknownHostException: br-automation
java.util.concurrent.ExecutionException: java.net.UnknownHostException: br-automation
at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.util.concurrent.CompletableFuture.get(Unknown Source)
at org.eclipse.milo.examples.client.SubscriptionExample.run(SubscriptionExample.java:50)
at org.eclipse.milo.examples.client.ClientExampleRunner.run(ClientExampleRunner.java:120)
at org.eclipse.milo.examples.client.SubscriptionExample.main(SubscriptionExample.java:42)
Caused by: java.net.UnknownHostException: br-automation
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(Unknown Source)
at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:148)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:145)
at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:43)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:63)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:55)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:57)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:32)
at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:108)
at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:180)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:166)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:984)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:504)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Unknown Source)
When using UaExpert, "opc.tcp://11.23.1.1:4840" is the address of the server that I input when adding a new server when using Custom Discovery. When I enter this, a device appears as a dropdown of this server called B&R Embedded OPC-UA Server as the OPC-UA server is hosted on a B&R device in the machine. When I select this device to connect to, I get the following message:
The hostname of the discovery URL used to call GetEndpoints (br-automation) was replaced by the hostname used to call FindServers (11.23.1.1). Do you also want to replace the hostnames of the EndpointURLs with this hostname?
I have to accept this message for the server to be found, but I am confused exactly what is going on. I assume there is a difference in the endpoint used to find the server and the endpoint used for something else? I have found the resources online very difficult to understand. In the UaExpert logs there are three lines of logs in a row which report "Adding Url: ocp.tcp://br-automation:4840". It also then reports the endpoint: "ocp.tcp://br-automation:4840", the application Uri and the security policy (none). If I try change the address in the client's getEndpointUrl method to ocp.tcp://br-automation:4840 then I get the following error:
[main] INFO o.e.m.opcua.sdk.client.OpcUaClient - Eclipse Milo OPC UA Client SDK version: 0.4.3-SNAPSHOT
18:37:46.035 [main] ERROR o.e.m.e.client.ClientExampleRunner - Error getting client: java.util.concurrent.ExecutionException: java.net.UnknownHostException: br-automation
org.eclipse.milo.opcua.stack.core.UaException: java.util.concurrent.ExecutionException: java.net.UnknownHostException: br-automation
at org.eclipse.milo.opcua.sdk.client.OpcUaClient.lambda$create$1(OpcUaClient.java:204)
at java.util.Optional.orElseGet(Unknown Source)
at org.eclipse.milo.opcua.sdk.client.OpcUaClient.create(OpcUaClient.java:204)
at org.eclipse.milo.opcua.sdk.client.OpcUaClient.create(OpcUaClient.java:201)
at org.eclipse.milo.examples.client.ClientExampleRunner.createClient(ClientExampleRunner.java:73)
at org.eclipse.milo.examples.client.ClientExampleRunner.run(ClientExampleRunner.java:94)
at org.eclipse.milo.examples.client.SubscriptionExample.main(SubscriptionExample.java:42)
Caused by: java.util.concurrent.ExecutionException: java.net.UnknownHostException: br-automation
at java.util.concurrent.CompletableFuture.reportGet(Unknown Source)
at java.util.concurrent.CompletableFuture.get(Unknown Source)
at org.eclipse.milo.opcua.sdk.client.OpcUaClient.create(OpcUaClient.java:180)
... 4 common frames omitted
Caused by: java.net.UnknownHostException: br-automation
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:148)
at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:145)
at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:43)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:63)
at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:55)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:57)
at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:32)
at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:108)
at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:180)
at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:166)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:984)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:504)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Unknown Source)
I don't know if this is enough information to diagnose the problem, but I would appreciate any help on how I can get the Eclipse Milo server to perform the same process and connect to the machine's server.
The issue is that the computer you're running the client on can't resolve the hostname "br-automation" into an IP address.
The solution if you can't configure your server to return an IP address instead is to manually rebuild the EndpointDescriptions you get from the GetEndpoints service call so they have an endpoint URL that contains the IP address instead of the hostname. This is what UaExpert is doing behind the scenes when it warns you about replacing the hostname.
You can use EndpointUtil#updateUrl to build a new EndpointDescription before it gets passed to the OpcUaClientConfig.
You can find correct Hostname/URL to connect server by using server log.
Once server logs starts it print all valid UR
We were able to solve our problem, by manually overwriting the hostname returned from the OPC UA Server with the hosts IP and port. (see second line of the try statement)
public class OpcUaConnection {
OpcUaClient client;
final int NAMESPACEINDEX = 6;
private static final AtomicLong clientHandles = new AtomicLong(1L);
public OpcUaConnection() {
try {
List<EndpointDescription> endpoints = DiscoveryClient.getEndpoints("opc.tcp://192.168.0.122:4840").get();
EndpointDescription configPoint = EndpointUtil.updateUrl(endpoints.get(0), "192.168.0.122", 4840);
OpcUaClientConfigBuilder cfg = new OpcUaClientConfigBuilder();
cfg.setEndpoint(configPoint);
this.client = OpcUaClient.create(cfg.build());
client.connect().get();
} catch (Throwable ex) {
ex.printStackTrace();
}
}
Hope this can help out others!

How to fix error 'Failed to initialize connector [Connector[HTTP/1.1-443]]' when starting tomcat

I'm trying to deploy my java backstage on a remote tomcat server (8.5.39). In order to use https, I changed these lines on /conf/server.xml
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" keystoreFile="xxx" keystorePass="xxx">
</Connector>
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
I can run the tomcat on remote server and I can access it by domain name(https). But when I use eclipse to run java code on remote server, it comes with error like
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-443]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-443]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:875)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:309)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:995)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 12 more
Caused by: java.lang.IllegalArgumentException: C:\Users\Administrator\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\cert\server.jks (No such file or directory)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:100)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:72)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:244)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1105)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:224)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:581)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:68)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:993)
... 13 more
Caused by: java.io.FileNotFoundException: C:\Users\Administrator\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\cert\server.jks (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:155)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:110)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.tomcat.util.file.ConfigFileLoader.getInputStream(ConfigFileLoader.java:89)
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:190)
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:206)
at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:272)
at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:239)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:98)
... 20 more
Someone told me to stop tomcat on remote server and run the code. I tried but it doesn't work.
Your most deep exception cause is:
Caused by: java.io.FileNotFoundException: C:\Users\Administrator\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\cert\server.jks (No such file or directory)
Which is trying to find certificate to start service with SSL enabled.
In order to do that you'll have to either provide certificate file for SSL or remove https enpoint to start without any encription

Spring Boot MongoDB with shared Domain Object

I have 3 services(3 different projects eg ClientService, AggregationService, DataService) that share same domain object and only one of them(DataService) connects to MongoDB and sends back the data to other 2 services.
All these services are spring boot based
When I was keeping separate java file of the domain object kept in the respective project then it all worked fine as the domain object in ClientService and AggregationService didn't have mongodb annotations eg #Document, #Field.
But when I kept the domain object in a common module so that i don't have to maintain 3 copies, ClientService and AggregationService started throwing exception during start up. Though these services do start up and returns the response correctly but the exception also comes up when these services start up.
Below is the domain object:
#Document(collection = "transformed_categories")
public class Category extends ResourceSupport {
#Field("id")
private String customId;
private String name;
private String type;
}
Exception:
2017-02-27 15:10:41.098 INFO 9052 --- [ main] c.c.delivery.CleintServiceApplication : Started CleintServiceApplication in 3.47 seconds (JVM running for 3.918)
2017-02-27 15:10:41.895 INFO 9052 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongo-java-driver-3.4.1.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongo-java-driver-3.4.1.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongo-java-driver-3.4.1.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_05]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_05]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) ~[na:1.8.0_05]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_05]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_05]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_05]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_05]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_05]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongo-java-driver-3.4.1.jar:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongo-java-driver-3.4.1.jar:na]
... 3 common frames omitted
I found the exact place which is causing the issue.
The issue is caused by maven dependency that I added into my common-library project where I intend to keep all my domain objects.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.10.0.RELEASE</version>
</dependency>
If I remove this dependency then the exception doesn't come. What should be the approach in keeping domain objects which are shared across the projects?
This is an old post but requires answers.
First thing, Microservices should not be sharing code. When there are domain objects which need to be sent across, we should use DTO pattern which should be owned by every microservice and that code should not be shared across. This is a recommended practice.
Coming to MongoDB exception, this is a normal behavior of a spring boot application. When it sees MongoDB in the class path and no configuration in properties file, it would look for a MongoDB instance at localhost:27017
So if we don't intend to connect to MongoDB from a Microservice then MogoDB driver should not be present in the class path.

Error Deploying WAR file via jboss-cli

I am trying to deploy a war file using jboss-cli to Wildfly 8.
The command I'm using is as follows,
jboss-cli.bat --connect --command="deploy --force E:\Projects\CD&CI\portal.war"
That gives me an exception like below,
org.jboss.as.cli.CliInitializationException: Failed to connect to the controller
at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:278)
at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:253)
at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.modules.Module.run(Module.java:292)
at org.jboss.modules.Main.main(Main.java:455)
Caused by: org.jboss.as.cli.CommandLineException: The controller is not available at localhost:9990
at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:1020)
at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:832)
at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:811)
at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:276)
... 8 more
Caused by: java.io.IOException: java.net.ConnectException: JBAS012144: Could not connect to http-remoting://localhost:9990. The connection timed out
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:129)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71)
at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:997)
... 11 more
Caused by: java.net.ConnectException: JBAS012144: Could not connect to http-remoting://localhost:9990. The connection timed out
at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:120)
at org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256)
at org.jboss.as.protocol.ProtocolConnectionManager.connect(ProtocolConnectionManager.java:70)
at org.jboss.as.protocol.mgmt.FutureManagementChannel$Establishing.getChannel(FutureManagementChannel.java:204)
at org.jboss.as.cli.impl.CLIModelControllerClient.getOrCreateChannel(CLIModelControllerClient.java:169)
at org.jboss.as.cli.impl.CLIModelControllerClient$2.getChannel(CLIModelControllerClient.java:129)
at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:117)
at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:92)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141)
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:127)
... 13 more
I also tried changing jboss-cli.xml's default controller to 9999 where it takes protocol as remote instead of it's default value http-remote, but nothing worked.
I tried to connect to the jboss management console, but it also didn't work.
jboss-cli.bat -c
Can someone please help me with this.
I was using a native-interface instead of a http-interface so it won't use the correct protocol.
I had to change the management interface in standalone-full.xml file as below.
<management-interfaces><!--
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket-binding http="management-http" />
</http-interface>-->
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket interface="management" port="${jboss.management.http.port:9990}" secure-port="${jboss.management.http.port:9993}"/>
</http-interface>
</management-interfaces>

Unable to connect perfecto mobile through eclipse

I am trying to test the cloud mobles using perfectomobiles though test case in eclipse for that i added Perfecto mobile add-in to eclipse and while creating a project i given below details
Cloud : mobilecloud.perfectomobile.com, username and password
after created the project we didn't get any MobileCloud views those MobileCloud Recording and MobileCloud Dashboard tabs are empty. i didn't under stand where we need to add mobiles(i am thinking like we are unable to connect to perfectomobile.com)
Then, i tried to connect through code like below
MobileDriver driver = new MobileDriver("mobilecloud.perfectomobile.com","username","password");
try {
// write your code here
IMobileDevice device = driver.getDevice("3152168C4EAA1E2A5DE93CF7B89222720E3A62E0");
device.open();
IMobileWebDriver webDriver = device.getDOMDriver("google.com");
webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
webDriver.findElement(By.xpath("(//input[#id=\"lst-ib\"])[1]")).sendKeys("Perfecto Mobile");
webDriver.findElement(By.xpath("(//button[#id=\"tsbb\"])[1]")).click();
}
But, I am getting exception like below
10:40:39.569 [main] ERROR c.p.selenium.util.EclipseConnector - Failed to connect to MobileCloud for Eclipse plugin on host: localhost and port: 3287. Possible reasons are: The code doesn't run in Eclipse or the user doesn't have ECLIPSE role or the MobileCloud recording view is not open. In these cases use the MobileDriver constructor that receives the host, user and password.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_55]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_55]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) ~[na:1.7.0_55]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_55]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.7.0_55]
at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_55]
at java.net.Socket.connect(Socket.java:528) ~[na:1.7.0_55]
at java.net.Socket.<init>(Socket.java:425) ~[na:1.7.0_55]
at java.net.Socket.<init>(Socket.java:208) ~[na:1.7.0_55]
at com.perfectomobile.selenium.util.EclipseConnector.<init>(EclipseConnector.java:34) ~[pm-selenium-3.5.0.000.jar:na]
at com.perfectomobile.selenium.MobileDriver.initWithEclipseParams(MobileDriver.java:79) [pm-selenium-3.5.0.000.jar:na]
at com.perfectomobile.selenium.MobileDriver.<init>(MobileDriver.java:64) [pm-selenium-3.5.0.000.jar:na]
at com.perfectomobile.selenium.MobileDriver.<init>(MobileDriver.java:60) [pm-selenium-3.5.0.000.jar:na]
at MobileTest.main(MobileTest.java:42) [bin/:na]
Can any one help me
I believe your Perfecto mobile account doesn't have the Eclipse Role (or license) added to it (yes, they have something like this for Eclipse). Contact support to get it added. I faced the same issue earlier.