edtFTPj Java Error when retrieving directories - java

I want to connect to a FTP Server, in this case FileZilla Server, with Java. I've download edtFTPJ/free and I've been trying the examples that they sent in that package. Connecting to the server, deleting folder/files, renaming, creating folders works, but when I want to get the directory list, the connection gets closed. (This also happens with another library called FTP4J.) Here is the code:
package ftp_classes;
import com.enterprisedt.net.ftp.FileTransferClient;
import com.enterprisedt.net.ftp.FTPFile;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;
public class GetDirectoryListing {
public static void main(String[] args) {
String host = "localhost";
String username = "user";
String password = "password";
// set up logger so that we get some output
Logger log = Logger.getLogger(GetDirectoryListing.class);
Logger.setLevel(Level.INFO);
FileTransferClient ftp = null;
try {
com.enterprisedt.util.debug.Logger.setLevel(com.enterprisedt.util.debug.Level.DEBUG);
// create client
log.info("Creating FTP client");
ftp = new FileTransferClient();
// set remote host
log.info("Setting remote host");
ftp.setRemoteHost(host);
ftp.setUserName(username);
ftp.setPassword(password);
// connect to the server
log.info("Connecting to server " + host);
ftp.connect();
log.info("Connected and logged in to server " + host);
log.info("Getting current directory listing");
FTPFile[] files = ftp.directoryList(".");
for (int i = 0; i < files.length; i++) {
log.info(files[i].toString());
}
// Shut down client
log.info("Quitting client");
ftp.disconnect();
log.info("Example complete");
} catch (Exception e) {
e.printStackTrace();
}
}
}
here is the console output:
INFO [ftp_classes.GetDirectoryListing] 1 Jun 2012 14:05:00.151 : Setting remote host
INFO [ftp_classes.GetDirectoryListing] 1 Jun 2012 14:05:00.151 : Connecting to server localhost
DEBUG [FileTransferClient] 1 Jun 2012 14:05:00.151 : Configured client
DEBUG [FTPClient] 1 Jun 2012 14:05:00.159 : Connecting to localhost/127.0.0.1:21
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.175 : 220-FileZilla Server version 0.9.41 beta
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.175 : 220-written by Tim Kosse (Tim.Kosse#gmx.de)
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.177 : 220 Please visit http://sourceforge.net/projects/filezilla/
DEBUG [FileTransferClient] 1 Jun 2012 14:05:00.179 : Client connected
DEBUG [FileTransferClient] 1 Jun 2012 14:05:00.180 : Logging in
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.180 : ---> USER user
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.180 : 331 Password required for user
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.181 : ---> PASS ********
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.181 : 230 Logged on
DEBUG [FileTransferClient] 1 Jun 2012 14:05:00.181 : Logged in
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.181 : ---> TYPE I
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.182 : 200 Type set to I
INFO [ftp_classes.GetDirectoryListing] 1 Jun 2012 14:05:00.182 : Connected and logged in to server localhost
INFO [ftp_classes.GetDirectoryListing] 1 Jun 2012 14:05:00.182 : Getting current directory listing
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.189 : ---> SYST
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.189 : 215 UNIX emulated by FileZilla
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.194 : ---> PWD
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.194 : 257 "/" is current directory.
DEBUG [FTPClient] 1 Jun 2012 14:05:00.194 : setupDirDetails(.) returning: /
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.195 : ListenOnAllInterfaces=true
com.enterprisedt.net.ftp.ControlChannelIOException: Software caused connection abort: socket write error
at com.enterprisedt.net.ftp.FTPControlSocket.writeCommand(FTPControlSocket.java:1020)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:997)
at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:813)
at com.enterprisedt.net.ftp.FTPControlSocket.sendPORTCommand(FTPControlSocket.java:669)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketActive(FTPControlSocket.java:616)
at com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:583)
at com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2648)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3664)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3756)
at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3583)
at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:647)
at ftp_classes.GetDirectoryListing.main(GetDirectoryListing.java:52)
DEBUG [FTPControlSocket] 1 Jun 2012 14:05:00.197 : ---> PORT 127,0,0,1,201,168
Can anyone help me? I really don't know why this is happening.

The error is happening when the client tries to open a listening socket for the server to connect to and send the directory listing. I'm not sure why that would happen, but I do recommend changing the connection-mode from 'active' to 'passive', which may bypass the problem. You can do that as follows:
ftp.getAdvancedFTPSettings().setConnectMode(FTPConnectMode.PASV);

Related

Smack FileTransferManager.addFileTransferListener is never called

I 'm developing a standalone Java test application using smack 4.3.4. I use In-Band for file transfers:
FileTransferManager fileTransferManager = FileTransferManager.getInstanceFor(connection);
FileTransferNegotiator.IBB_ONLY = true;
OutgoingFileTransfer fileTransfer = null;
try {
fileTransfer = fileTransferManager.createOutgoingFileTransfer(JidCreate.entityFullFrom(buddyJID + "/Spark"));
} catch (XmppStringprepException ex) {
LOG.log(Level.SEVERE, null, ex);
}
if (fileTransfer != null) {
OutgoingFileTransfer.setResponseTimeout(500);
...
try {
fileTransfer.sendFile(file, "sending attachment...");
} catch (SmackException ex) {
LOG.log(Level.SEVERE, null, ex);
}
...
I monitor the file transfer and it is sent correctly.
INFO: Initializing connection to server localhost port 5222 [Wed Apr 29 15:36:25 CEST 2020]
INFO: Connected: true [Wed Apr 29 15:36:45 CEST 2020]
INFO: user001 authenticated? true [Wed Apr 29 15:36:46 CEST 2020]
...
INFO: Sending attachment 'test.txt' to user user002#localhost [Wed Apr 29 15:36:55 CEST 2020]
INFO: status is:Initial [Wed Apr 29 15:36:55 CEST 2020]
INFO: status is:Initial [Wed Apr 29 15:36:55 CEST 2020]
INFO: File transfer status: Negotiating Transfer, progress: 0.0 [Wed Apr 29 15:36:55 CEST 2020]
INFO: test.txt has been successfully transferred. [Wed Apr 29 15:36:56 CEST 2020]
INFO: The file transfer is done. [Wed Apr 29 15:36:56 CEST 2020]
INFO: Attachment test.txt sent from user001#localhost to user002#localhost [Wed Apr 29 15:36:56 CEST 2020]
When my user(s) connect and login to Openfire, even before the start sending attachments, I add a listener to listen to file transfers:
final FileTransferManager manager = FileTransferManager.getInstanceFor(connection);
// FileTransferNegotiator.setServiceEnabled(connection, true);
manager.addFileTransferListener((FileTransferRequest request) -> {
// Check to see if the request should be accepted
if (request.getFileName() != null) {
try {
// Accept it
IncomingFileTransfer transfer = request.accept();
// monitorFileTransfer(transfer, "");
try (InputStream fileReceived = transfer.receiveFile();
BufferedInputStream bis = new BufferedInputStream(fileReceived)) {
...
} else {
try {
// Reject it
request.reject();
LOG.warning("File rejected " + request.getFileName());
} catch (SmackException.NotConnectedException | InterruptedException ex) {
LOG.log(Level.SEVERE, null, ex);
}
}
However, the listener is never called. Do I need to add the listener at a specific moment? Is there something else I 've been missing? The results is that the file transfers are being sent to Openfire and are never consumed.
Last stanzas:
<iq xmlns="jabber:client" to="user001#localhost/aktuu2n806" from="localhost" id="679-1085" type="get">
<query xmlns="jabber:iq:version"/>
</iq>
<iq xmlns="jabber:client" to="localhost" id="679-1085" type="error">
<error xmlns="jabber:client" type="modify">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
My code is based on the documentation example. Do I need to configure something else? Since they are transferred as in-band I shouldn't.
Thank you in advance for your prompt reply.
The file transfer was not actually happening this is why the listener was listening but wa receiving nothing.
To send a file you need the full JID of the recipient. If you use smack, there is no physical XMPP client (like spark). In that case you use “Smack” or “Resource” (see here).
fileTransfer = fileTransferManager.createOutgoingFileTransfer(JidCreate.entityFullFrom(buddyJID + "/Smack")));
However, I still get an error:
XMPP error reply received from user002#localhost/Smack: XMPPError: not-allowed - cancel
and the file is not sent.
UPDATE: And of course the problem had nothing to do with smack. The issue was that the tool I have created was reading and writing to the same file, as a result, the file was erased and the error was because smack was requested to transfer an empty file. So, if you see this error, check the file you try to transfer first; it might have 0 bytes.

how overcome this error "com.mongodb.diagnostics.logging.JULLogger log"

I am working with java program connected with MongoDB when I run the program it will show an error but code is working.
MongoDB has a database called MongoDB and inside that, there is a collection called seatbooking with two columns(name,seatnumber).
This is my code:
MongoClient mongoClient = new MongoClient("localhost", 27017);
System.out.println("connection is established");
MongoDatabase mongoDatabase = mongoClient.getDatabase("MongoDB");
MongoCollection mongoCollection = mongoDatabase.getCollection("seatbooking");
Document document = new Document("name","shenal");
document.append("seatnumber",20);
mongoCollection.insertOne(document);
when I run this code my output is:
> Mar 09, 2020 12:41:36 PM
> com.mongodb.diagnostics.logging.JULLogger log INFO: Cluster created
> with settings {hosts=[localhost:27017], mode=SINGLE,
> requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms',
> maxWaitQueueSize=500}
> **connection is established** Mar 09, 2020 12:41:36 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Cluster
> description not yet available. Waiting for 30000 ms before timing out
> Mar 09, 2020 12:41:36 PM com.mongodb.diagnostics.logging.JULLogger log
> INFO: Opened connection [connectionId{localValue:1, serverValue:309}]
> to localhost:27017 Mar 09, 2020 12:41:36 PM
> com.mongodb.diagnostics.logging.JULLogger log INFO: Monitor thread
> successfully connected to server with description
> ServerDescription{address=localhost:27017, type=STANDALONE,
> state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2,
> 2]}, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216,
> logicalSessionTimeoutMinutes=30, roundTripTimeNanos=5168100} Mar 09,
> 2020 12:41:36 PM com.mongodb.diagnostics.logging.JULLogger log INFO:
> Opened connection [connectionId{localValue:2, serverValue:310}] to
> localhost:27017
The logging output doesn't show any result for the insertOne operation.
If you are using MongoDB Java Driver version prior to 4.0, there is no acknowledgement object returned. But, the version 4's insertOne method returns a InsertOneResult object. This is a new feature in 4.0 (in prior version's the method returned a void).
You can use the following code to check the insert's outcome as follows (with version 4.0):
try {
InsertOneResult insertResult = collection.insertOne(document);
System.out.println("Document inserted with ID: " + insertResult.getInsertedId());
}
catch(MongoWriteException e) {
// write failure happened, handle it here...
}

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 ?

Issue with JacORB connection?

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.

Categories

Resources