Windows Impersonation Java from *nix - java

I want to replace a legacy application running on Windows server by rewriting it in Java. This application is now connecting to a bunch of Windows servers (which are unavailable for installing another services and it is impossible to change them) via Windows Impersonation API.
I have come up with two libraries JNA and Waffle. To my understanding, Waffle uses JNA, and JNA provides calls to Windows API from java code.
The thing is, I will have my java application running on a redhat server which obviously does not have win32 api. Is there a *nix binding for Impersonation API? At least I may consider writing JNI over that binding.
I think there should be a way, because Mono and Wine provide similar abstractions on different platforms.

Have you checking on Mono or Wine to see it is supports impersonation? I don't believe it supports.
I think remote impersonation is encapsulated a lot of technologies, and some of it maybe undocumented. It might be very hard task to writing the client application to support server impersonation without using Windows API. The best way should be continue running on Windows. But if you really want to move the system to run on *nix, the best way should be create a proxy between *nix and Windows. Then later you can completely running on *nix when you don't need the services that running on Windows.

Related

Is it possible to invoke a .NET Core app in Java?

I have a .NET Core (console) app that I would like for a Java app to depend on. Essentially I would like to be able for the Java app to invoke a multi variable method in the .NET Core app and then pass the result back to the Java app. It would be nice if the .NET Core app could be embedded in the Java app. I have previously seen .NET Framework specific solutions to this problem, but since this would only be relevant on Windows, I would like a solution that also works on Linux.
In the past there were some technologies such as IKVM.NET and COM Interop wrappers but the former is defunct and the latter probably wouldn't work on Linux.
Since you own the .net core code, I would take a more modern microservice approach. I would design the .net core app to be a REST API running as a console app listening on a port. I'd have the Java application spin up the console app, invoke the methods passing JSON back and forth and then spit it down when complete.
From my actual knowledge this nuget package JCOBridge is able to do what you are asking for.
Until now it supports linux for x64 architecture.
I tried the templates available on Templates and them works on my Ubuntu 18.04. The same templates works on Windows.

Installer for Java Spring Boot service

I have a Java Spring Boot application which I would like to run as a service, ideally in Mac, Windows and Linux. It should run 24/7 and be robust i.e. restart itself if it crashes.
Does anyone know the current best practice way of achieving this?
In order to make an app as a service it should confront to some Interface defined by Microsoft. Here it is:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms685942(v=vs.85).aspx
This is not the easiest solution and will make you app platform dependent. There are some wrappers that make what you want possible.
Check the Java Service Wrapper
https://wrapper.tanukisoftware.com/doc/english/introduction.html
It has options to wrap the app as windows service and unix daemon. I am not sure about macOs. There are other similar wrappers too
Best practice1 is to use the best practice solution for each platform. Unfortunately, that means different things for different platforms; e.g.
on Window, use the Windows Service mechanism
on UNIX / Linux, write a service script that uses the distro's native "init" framework
on Mac OSX, you typically use something like Automator to create a ZIP file that implements the service.
Unfortunately, in the UNIX / Linux case there are a number of different init frameworks, depending on the vintage; see this Wikipedia page.
Another answer mentions the Java Service Wrapper. I don't know how well it works with different Linux "init" frameworks, but it looks like it provides a one-size-fits-all init script written in "sh". It should be usable with systemd, though you won't get the full benefits of that framework.
1 - But read James Bach's No Best Practices article.

Reading MSMQ messages with Java Library on Unix machine?

I am looking for a java library that can handle MSMQ incoming messages on a Unix machine.
When searching the web for a solution a found almost nothing, and the few I did found are accessing MSMQ on windows OS.
In my case, my application is running on Unix and I want to transfer MSMQ messages directly to it from a Windows machine.
I guess I need some kind of a bride/listener/receiver for that.
The closest thing I could find was a service that offers a full solution and not a development tool.
Is there something out there that I missed which will serve my purpose?
what is the effort of writing it on my own? Is this even doable?

Setting up server for android app

I have developed an android application and i need to set a server for sending and receiving data from clients. The server must also be able to run python script for data mining.I want to code the server in java(for analysing the data obtained from mining and handling the client requests).
what will be the way to set the server for my purpose. I have read that servers can be set up in eclipse or installing apache in linux in a virtual machine. will anyone of them fit my need or is there any other better alternative.
Well, it depends on your needs. If you want to run Python scripts from Java, I don't really see why you would code your server-side logic in Java and then use Python data-mining scripts (you might have some problems with execution of Python scripts through Java and server setup). I know that Python is much better in data-mining, so stick with it. Consider Python for server-side logic. In case you want to run data-mining script manually that doesn't really mater, so you can separate the languages.
In case you want to separate it into two languages, then you must install an application server for Java. There are plenty of options for that, even open-sourced (Wildfly, Glassfish, ...):
https://blog.idrsolutions.com/2015/04/top-10-open-source-java-and-javaee-application-servers/
You can set most of them in Eclipse for development, for production releases they can be installed either on Unix or Windows. The Apache option you mentioned is probably Apache Tomcat application server. You can read more about Java application server set-up in Eclipse:
http://www.eclipse.org/webtools/community/education/web/t320/Configuring_an_Application_Server_in_Eclipse.pdf
Depending upon the requirement, you can setup the server in many ways in any operating system like linux (fedora, ubuntu), windows, mac osx etc. There are many java web frameworks to follow to make your own server and provide API for mobile.
These are some java web frameworks:
playframework
Spring MVC
Grails
You can setup above and other frameworks and can setup in any enviorment. For initial, you can setup in your local system, then later you can upload into your remote server.
For setup, please see the respective framework's documentation.
It would be wise to choose json for communication between mobile and server. You can consume the API in android using default HttpURLConnection or you can follow other opensource http connection library like retrofit, asynchttp etc.

Executing .vmx file using java code

I want to run .vmx file using java program.Basically I want to start my virtual machine on vmware workstation using java code..
Have you considered http://labs.vmware.com/flings/vix-java-toolkit
It claims
The VIX Java Toolkit allows Java developers to take advantage of the
VMware VIX API. This is a powerful API that allows for performing
in-guest operations on VMs running with vSphere, Workstation, Server,
and Player. Java developers who are writing code with the vSphere/VI
APIs will find this particularly useful as the vSphere API does not
currently provide any functionality for interacting with the guest
operating system. In addition, this is helpful for software testing as
well as systems administration.

Categories

Resources