Solved

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

Posted on 2001-08-06
9
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
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

Industry Leaders: 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!

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

707 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