Solved

Java Calling C++ in a different (remote) server

Posted on 2001-08-06
9
252 Views
Last Modified: 2010-05-18
Hi

Need some expert help on this.

Need to call existing C++ classes from my Java/Weblogic application :
1. The C++ classes resides in a separate/ remote server
2. The java application would pass some command in string over to the C++
3. The C++ would return result as data objects containing table/columns.

Not quite sure on how the connection between Java and C++.

Q1. Understand there is JNI - but JNI typically is for calling to C++ classes on same server right?

Q2. Remote server can be via socket call but what protocol would suit for call from Java to C++?

Q3. What would be a better implementation for such call?


Many Thanks

Rgds/chris
0
Comment
Question by:leechris
9 Comments
 
LVL 5

Accepted Solution

by:
Droby10 earned 50 total points
ID: 6358097
maybe with rmi as the transport with jni proxy/stubs for each local piece...?
0
 
LVL 3

Assisted Solution

by:dnoelpp
dnoelpp earned 50 total points
ID: 6358287
Or use Corba.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6358305
There are many possibilities:

1. RMI with JNI on the separate/remote server side to access the C++ classes. As Droby10 already suggested.

2. Corba but then your C++ classes need to have a Corba access/interface. As I already suggested.

3. HTTP where your C++ classes listen very much like a web server. In your case it might be very appropriate, because you said, you're transmitting strings. HTTP is a very simple protocol and rather easy to implement. The best of this is, it works through firewalls.

4. An own protocol with own ports. A variant of the HTTP solution. One limitation of HTTP is, that the server is not able to initiate a connection. This can be overcome with this solution. But I won't advise you to implement this. Because you mix up the client/server distinction. Your C++ classes should stay "server", your Java application should stay "client".

Other possibilities anyone?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Droby10
ID: 6359262
soap...?  (an implementation of you're #3 example)...

highly scalable and extensible...light on security.
0
 
LVL 3

Expert Comment

by:dnoelpp
ID: 6359338
How do you feel married, Droby?
0
 
LVL 1

Expert Comment

by:CyTG
ID: 6361591
1. write a little server program, u know ServerSocket, and host it on a free port. Use Object Input/Output Streams (saves u the hazzle with RMI, does what u need), use the .exec to execute whatever u need on the server upon request

2. incorporate the networking into ur existing application

that should be it. But this to work, u have to execute Java on the remote server as well.
If thats not an option, u could do telnet sessions instead, thats pretty easily programmed.
0
 
LVL 5

Expert Comment

by:Droby10
ID: 6361679
> use the .exec to execute whatever u need on
the server upon request

be sure to set limits (maybe a dictionary of allowed objects, commands, methods, etc. or a runtime security context)...

we had a hay-day during an audit a few months ago with an "enterprise" site that used remote instantiation/invokation such as this without any limits...

the funniest part was writing the "hacked by chinese" signia to client connections...i think it took a solid hour just for operations to verify that the solaris environment had not in fact been infected by the code-red worm.

---------------------

i guess i need to update my profile...

not to much has changed since the wedding...i still leave my underwear on the floor...she still erases my messages...but we're happy and that's the important thing.
0
 
LVL 5

Expert Comment

by:lwinkenb
ID: 8937329
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split points between droby10 and dnoelpp
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lwinkenb
EE Cleanup Volunteer
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to determine if a string is a valid SHA value 7 44
add projects t working set in maven 2 44
junit as external jar or library 7 40
Html split(text) 2 32
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question