Issue with JacORB connection? - java

I'm new to CORBA and JacORB. I'm struggling with my first Hello World app using CORBA with JacORB.
This is the newest error I got:
Nov 04, 2013 9:52:19 AM com.sun.corba.se.impl.transport.SocketOrChannelConnectionIm <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 7070"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
This is my server causes to that error:
Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitialPort","7070");
props.put("org.omg.CORBA.ORBInitialHost","localhost");
ORB orb = ORB.init(args, props);
try {
//
POA poa = POAHelper.narrow(orb
.resolve_initial_references("RootPOA"));
poa.the_POAManager().activate();
// Servant
HelloVnImpl hello = new HelloVnImpl();
// get servant reference
Object o = poa.servant_to_reference(hello);
HelloVn hVnRef = HelloVnHelper.narrow(o);
// Get root naming context
Object objRef = orb.resolve_initial_references("NameService");//Error
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
Look around on the internet, the issue is apparently my nameservice, but I think I start it.
C:\Users\Paul>ns -ORBInitRef.NameService=corbaloc::localhost:7070/NameService
Nov 04, 2013 9:38:25 AM org.jacorb.config.JacORBConfiguration <init>
WARNING: no properties found for configuration jacorb
Nov 04, 2013 9:38:25 AM org.jacorb.orb.ORBSingleton <init>
INFO: created ORBSingleton
Nov 04, 2013 9:38:27 AM org.jacorb.orb.giop.CodeSet getTCSDefault
WARNING: Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1
Nov 04, 2013 9:38:27 AM org.jacorb.naming.NameServer main
INFO: NS up
Nov 04, 2013 9:38:27 AM org.jacorb.orb.ORB run
INFO: ORB run
Now, I have no idea to do next. Please give me an advice. Thank you. :)
UPDATE:
This line code give me a null value:
System.out.println(System.getProperty("org.omg.CORBA.ORBClass"));
What does it mean?. Does it tell me that there is something wrong with my nameserver?.
Hope to see your advice. Thanks

There are a couple of problems with the way that you setup your server and the Naming Service (NS):
1) The two properties (org.omg.CORBA.ORBInitialPort and org.omg.CORBA.ORBInitialHost) that you set in the server code are not JacORB properties. Assuming that you want your server to listen for requests on port 7070,then you want to set the "OAAddress" property like this:
props.put("OAAdress", "iiop://localhost:7070");
2) The option -ORBInitRef.NameService=corbaloc::localhost:XXX/NameService should be for the server to locate the NS and is not the NS. Please note that "XXX" is the listen port of the NS and is should not be "7070".
I would recommend that you take a look at the hello demo which includes both a working server and client and they are much simpler.

Related

Application does not stop after AWSIotMqttClient disconnected

I'm working with AWSIotMqttClient to subscribe and publish to topics. After I received all messages I want to stop my application. But it works infinitely long. Here a simple code which works infinitely, even without subscribes:
SampleUtil.KeyStorePasswordPair keyStorePasswordPair =
SampleUtil.getKeyStorePasswordPair("certificate.pem", "privateKey.pem");
AWSIotMqttClient client = new AWSIotMqttClient(
"mqtt-broker.address",
"deviceID",
keyStorePasswordPair.keyStore,
keyStorePasswordPair.keyPassword);
client.connect();
client.disconnect();
Here is my logs:
> Task :Application.main()
Cert file:certificate.pem Private key: privateKey.pem
????. 20, 2019 11:56:45 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionSuccess
INFO: Connection successfully established
????. 20, 2019 11:56:45 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionSuccess
INFO: Client connection active: 5dcd561596c30e0001e4b5d5
????. 20, 2019 11:56:53 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionClosed
INFO: Connection permanently closed
????. 20, 2019 11:56:53 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionClosed
INFO: Client connection closed: 5dcd561596c30e0001e4b5d5
I can stop my application with System.exit(0) but it is undesirable for me. I expect that after all code is passed, the application will stop.
Found here . Updating aws-iot-device-sdk to 1.3.4 version
implementation 'com.amazonaws:aws-iot-device-sdk-java:1.3.4'
implementation 'com.amazonaws:aws-iot-device-sdk-java-samples:1.3.4'
resolved the problem.

Connection immediately is aborted when trying to connect to remote cluster-node

I am trying to connect to an Elasticsearch cluster form a Java application by using the TransportClient.
I have successfully tested connected to a cluster running locally.
Now we have set up a remote cluster in the EC2-Cloud. Accessing it via REST intefaces work, also Kibana works.
I can run my application on the Elasticsearch Node directly successfully.
However when I try to connect remotely from another host, the log indicates that the connection succeeds, but then immediately fails with "An established connection was aborted by the software in your host machine".
I have verified that both server and client run the same version of Elasticsearch. Also the firewall configuration should allow communication on port 9300 as this is also needed for the cluster-nodes to communicate between each other.
Okt 21, 2015 6:50:24 PM com.example.elasticsearch.visit.nativescript.ElasticsearchTest main
INFO: Setting adress to myhost.com:9300
Okt 21, 2015 6:50:24 PM org.elasticsearch.client.transport.TransportClientNodesService addTransportAddresses
FINE: [Master Man] adding address [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]]
Okt 21, 2015 6:50:24 PM org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler doSample
FINEST: [Master Man] connecting to listed node (light) [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]]
Okt 21, 2015 6:50:24 PM org.elasticsearch.transport.netty.NettyTransport connectToNode
FINE: [Master Man] connected to node [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]]
Okt 21, 2015 6:50:24 PM org.elasticsearch.common.breaker.ChildMemoryCircuitBreaker addWithoutBreaking
FINEST: [Master Man] [REQUEST] Adjusted breaker by [16440] bytes, now [16440]
Okt 21, 2015 6:50:24 PM org.elasticsearch.transport.TransportService$Adapter traceRequestSent
FINEST: [Master Man] [0][cluster:monitor/nodes/info] sent to [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]] (timeout: [5s])
Okt 21, 2015 6:50:24 PM org.elasticsearch.common.breaker.ChildMemoryCircuitBreaker addWithoutBreaking
FINEST: [Master Man] [REQUEST] Adjusted breaker by [-16440] bytes, now [0]
Okt 21, 2015 6:50:24 PM org.elasticsearch.transport.netty.NettyTransport exceptionCaught
FINEST: [Master Man] close connection exception caught on transport layer [[id: 0xd938d867, /x.x.x.x:60058 => myhost.com/1.1.1.1:9300]], disconnecting from relevant node
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:64)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Okt 21, 2015 6:50:24 PM org.elasticsearch.transport.netty.NettyTransport disconnectFromNode
FINE: [Master Man] disconnecting from [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]], channel closed event
Okt 21, 2015 6:50:24 PM org.elasticsearch.transport.netty.NettyTransport disconnectFromNode
FINEST: [Master Man] disconnected from [[#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]]], channel closed event
Okt 21, 2015 6:50:24 PM org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler doSample
INFO: [Master Man] failed to get node info for [#transport#-1][LNZ123675N02][inet[myhost.com/1.1.1.1:9300]], disconnecting...
org.elasticsearch.transport.NodeDisconnectedException: [][inet[myhost.com/1.1.1.1:9300]][cluster:monitor/nodes/info] disconnected
Okt 21, 2015 6:50:24 PM com.example.elasticsearch.visit.nativescript.ElasticsearchTest main
INFO: Having: []
Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:167)
at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:370)
at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:166)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.example.elasticsearch.visit.nativescript.ElasticsearchTest.main(ElasticsearchTest.java:68)
My simple test looks like this:
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "cluster-name")
.build();
logger.info("Creating client");
try (final TransportClient client = new TransportClient(settings)) {
logger.info("Setting adress to " + host + ":" + port);
client.addTransportAddress(new InetSocketTransportAddress(host, port));
logger.info("Having: " + client.connectedNodes());
BulkRequestBuilder bulkRequest = client.prepareBulk();
String json= "{ id: \"12345678\", value: \"value\" }";
bulkRequest.add(client.prepareIndex(INDEX, TYPE, "12345678").
setSource(json));
BulkResponse bulkResponse = bulkRequest.execute().actionGet();
if (bulkResponse.hasFailures()) {
logger.info("Could not write bulk: " + bulkResponse.buildFailureMessage());
} else {
logger.info("Wrote");
}
}
I also tried to verify some common things like cluster-name not set and others.
Also when I use a completely different port, I get a timeout as expected, not this error-message. So the port is definitely behaving different.
Where would I start to look? Can this still be a firewall issue where connections are dropped only after a short while instead of being rejected immediately?
With more testing I actually found out that a company-firewall was interfering in a strange way. When I run the same client-code on a machine outside the company-netowrk, it works fine.

How to solve "java.net.SocketException: Connection reset" when using tigase.jaxmpp.j2se.Jaxmpp 3.0.0

I have written a JAXMPPClient.java program which uses tigase.jaxmpp.j2se.Jaxmpp 3.0.0
I have the following .jar files in my build path
jaxmpp-core-3.0.0
jaxmpp-j2se-3.0.0
and folder jaxmpp-all-3.0.0 containing many .jar files. The JAXMPPClient.java is as follows
Jaxmpp conn = new Jaxmpp();
conn.getConnectionConfiguration().setConnectionType(
ConnectionType.socket);
conn.getConnectionConfiguration().setDomain(IP_ADDRESS_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setPort(PORT_NUMBER_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setUserJID(FROM_USERID + "#" +
IP_ADDRESS_OF_XMPP_SERVER);
conn.getConnectionConfiguration().setUserPassword(FROM_PASSWORD);
String s = tigase.jaxmpp.j2se.connectors.socket.
SocketConnector.HOSTNAME_VERIFIER_DISABLED_KEY
conn.getSessionObject().setProperty(s, Boolean.TRUE);
try {
System.out.println("Before login");
conn.login();
System.out.println("After login");
} catch (final JaxmppException e) {
e.printStackTrace();
}
I am getting
Before login
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.Jaxmpp createConnector
INFO: Using SocketConnector
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
INFO: Resolving SRV recrd of domain '123.45.678.910'
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.SocketConnector start
INFO: Opening connection to /123.45.678.910:5222
Sep 29, 2015 5:17:12 PM tigase.jaxmpp.j2se.connectors.socket.Worker run
WARNING: Exception in worker
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at tigase.jaxmpp.j2se.connectors.socket.TextStreamReader.read(TextStreamReader.java:49)
at tigase.jaxmpp.j2se.connectors.socket.Worker.run(Worker.java:99)
After login
The IP Address, Port number, From JabberID and Password are correct and are working fine from iOS and Android Apps. Also I am able to successfully ping the Tigase server IP address.
From where is the java.net.SocketException being thrown ? How can I fix this problem ?

Websphere8 JMS jndi lookup error Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

I am new JMS, I have created sample JMS application.
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.PROVIDER_URL, "iiop://localhost:2809");
InitialContext context = new InitialContext(props);
QueueConnectionFactory qcf = (QueueConnectionFactory) context.lookup("jndi/testQF");
QueueConnection conn = qcf.createQueueConnection();
conn.start();
QueueSession session = (QueueSession) conn.createSession(false,Session.AUTO_ACKNOWLEDGE);
Queue t = (Queue) context.lookup("jndi/testQQ");
I have created buses testBus security is disabled , buses members, Queue Connection Factory testQF selected bus testBus. created queue as testQQ selected bus as testBus and selected testPP queue as queue name which was created service ingratiation Bus destination as point to point.
while running my app I am getting this error.
SEVERE: JSAS1480I: Security is not enabled because the ConfigURL property file is not set.
Apr 10, 2015 8:12:21 PM null null
WARNING: WSVR0072W: Ignoring undeclared override of interface, com.ibm.tx.jta.transactionManager, with implementation, com.ibm.ws.tx.jta.TranManagerSet
Apr 10, 2015 8:12:21 PM null null
WARNING: WSVR0072W: Ignoring undeclared override of interface, com.ibm.ws.transaction.TransactionInflowProxy, with implementation, com.ibm.ws.tx.jta.TransactionInflowProxyImpl
Apr 10, 2015 8:12:21 PM null null
WARNING: WSVR0072W: Ignoring undeclared override of interface, com.ibm.ws.transaction.UtxImpl, with implementation, com.ibm.ws.tx.jta.UserTransactionImpl
Apr 10, 2015 8:12:21 PM null null
WARNING: WSVR0072W: Ignoring undeclared override of interface, com.ibm.ws.transaction.XATerminator, with implementation, com.ibm.ws.tx.jta.TxXATerminator
Apr 10, 2015 8:12:21 PM null null
WARNING: WSVR0072W: Ignoring undeclared override of interface, com.ibm.ws.uow.UOWManager, with implementation, com.ibm.ws.uow.UOWManagerImpl
Apr 10, 2015 8:12:21 PM null null
INFO: Client code attempting to load security configuration
javax.naming.NameNotFoundException: Context: ADMINIB-3UJMQ4ENode01Cell/nodes/ADMINIB-3UJMQ4ENode01/servers/server1, name: jndi/testQF: First component in name testQF not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.ibm.ws.naming.jndicos.CNContextImpl.mapNotFoundException(CNContextImpl.java:4564)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1822)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1777)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1434)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:616)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at MySender.main(MySender.java:31)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:95)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:506)
at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2958)
at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2954)
at com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:871)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2952)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1818)
... 7 more
I am running my app from main method in j2ee project type is that an issue??
Please help me to fix this issue.
Thanks,
CVSR Sarma

InvalidName exception in jacorb

I am using Jacorb for corba implementation. I have started the NS on port 900.
When I am trying to start the server I am getting following exception
D:\eclipse_workspace\WorkSpace\corba\bin>jaco hello.MyServer -DORBInitRef.NameService=jacorb::localhost:900
org.jacorb.orb.ORB
Feb 14, 2013 4:00:07 PM org.jacorb.config.JacORBConfiguration <init>
WARNING: no properties found for configuration jacorb
Feb 14, 2013 4:00:07 PM org.jacorb.orb.ORBSingleton <init>
INFO: created ORBSingleton
Exception in thread "main" org.omg.CORBA.ORBPackage.InvalidName: IDL:omg.org/CORBA/ORB/InvalidName:1.0
at org.jacorb.orb.ORB.resolve_initial_references(ORB.java:1371)
at hello.MyServer.main(MyServer.java:15)
Code is as following
public static void main(String[] args) throws Exception{
Properties props = new Properties();
props.setProperty("ORBInitRef","NameService=jacorb::localhost:900");
System.out.println(System.getProperty("org.omg.CORBA.ORBClass"));
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);
org.omg.CORBA.Object o = orb.resolve_initial_references("NameService");
NamingContextExt nc = NamingContextExtHelper.narrow( o );
}
Could someone tell whats the problem here?
The NameService reference has to be either a reference to a file containing an IOR, e.g., file://tmp/NS_Ref or an URL, e.g., http://www.testme.not/NS_Ref or just a corbaloc/corbaname URL, e.g., corbaloc:iiop:1.2#host1:3075/NameService
The last one is most common. You can shorten it, for example, to corbaloc::localhost:900/NameService
More information to corbaloc could be found at http://www.ciaranmchale.com/corba-explained-simply/the-corbaloc-and-corbaname-urls.html

Categories

Resources