very interesting and unique problem , if you really have no choice other than node + existing java components. I recommend not to merge the two using a bridge which inject or adopts various objects and types between the two languages as it could be a mess and unmanageable going forward. I suggest a simpler approch 1. implement web app in node as usual 2. create runnable jar (or muliple .jar files based on your modules or components), which wraps your java functionality (EJB or Java specific calls) 3. execute that runnable jar using child process, you can pass data in arguments 4. now problem is how to get the result back , well you can try capturing stdout of child process if result must be processed inline of client's request and response AND/OR let that jar call back your server on localhost if its not inline :-)
Hope it helps, Amit On Thursday, September 22, 2016 at 11:39:44 PM UTC+5:30, O haya wrote: > > Hi, > > I am looking to port a project that we have to using node.js. The current > project consists mainly of a homegrown, standalone Java app as a threaded > web server. The thing is that this app also has to integrate with (call > out to) a COTS (commercial off-the-shelf) product, via a Java API that they > provide. In other words, my Java app calls out to the COTS Java API. > > Now, I want to try to re-implement that threaded web server using node.js, > but I also need the web server app to integrate with that COTS product's > Java API, so I've been researching how to do this. > > From what I've seen, there are a number of approaches, but the one that > seemed most interesting was node-java ( > https://github.com/joeferner/node-java), so I started trying to work with > that (I know that there's a separate group for node-java, but (a) I think > my question(s) are more generic and (b) there doesn't seem to be much > activity on that node-java group, so I am hoping it's ok to ask here). > > I had a heck of a time getting node-java to build, but I finally got it > working (I think) by standing up a new CENTOS 7 instance and building it > there, under Java JDK 1.7. > > Now, I am trying to port some of the Java interface part of my Java code > to node.js+node-java and having some problems. > > Is it ok to ask about that (those problems) here? > > Also, I'm kind of getting the feeling that node-java isn't the way to go, > because it's not supported, so I am thinking about what other approaches > that I can use instead of node-java? > > I've seen references to nashorn and rhino, but I am not clear what those > are vis-a-vis node.js? Are they replacements for node.js in whole? > > FYI, the reason for that last question is I am mandated to work with > node.js, so if they are replacements for node.js, that would be a no-go for > me now. > > Also, I have seen some references that rhino/nashorn use messaging, rather > than JNI, to provide the Javascript-to-Java bridge. Is that correct? The > reason for this question is that one of my requirements is > performance-related, and I would be concerned of performance if the > bridging was via messaging approach. > > Sorry for lots of questions :(!! > > Thanks, > Jim > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a81f7a35-29df-49dc-9f01-ee2cb5aa0ca3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
