GAE multi-module, multi-language application on localhost - java

I have a multi-module GAE Application that is structured like this:
a Python27 module, that is a regular web application. This Python app uses the Datastore API. Regular, boring web app.
a Java module (another web application) that hooks on the Datastore calls (calls made by the Python web app), and displays aggregated data about the recorded Datastore calls.
I have been able to deploy this application on the GAE cloud, and everything works fine.
However, problems arise when I want to run my application on localhost.
The Python module must be started using the Python SDK. The Java module must be started using the Java SDK.
However, the 2 SDK's do not seem to share the same datastore (I believe the 2 SDKs write/read to separate files on disk).
It seems to me that the 2 SDK's also differ in the advancement of the Development Console implementation.
The Python SDK sports a cleaner, more "recent-looking" Development Console (akin to the new console.developers.google.com console) than the Java SDK, which has the old-looking version of the Development Console (akin to the old appspot.com console)
So my question is, is there a way to boot 2+ modules (in different languages: Python, Java) that share the same Datastore files? That'd be nice, since it would allow the Java module to hook on the Python Datastore calls, which does not seem to be possible at the moment.

You might be able to do something similar by using "appscale" (an open source project that could be able to help you, if you setup Virtual Box and load the image on it). Look at community.appscale.com
Another way (mind you, this is tricky) would be to :
1- deploy your python as a standalone project on localhost:9000
2- deploy your java as a standalone project on localhost:8000
3- Change your python and java code so that when they are in Dev, they hit the right localhost (java
hits localhost:9000 and python hits localhost:8000)
4- Try, like #tx802 suggested, to specify a path to local_db.
I am not sure either method works, but I figure they are both worth trying at the very least.

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.

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.

GWT and google app engine : restricted Java libraries

I'm having a bit of trouble with deploying an application to google app engine.
I've got the google plugin set up in eclipse. I want to deploy to the app engine but a few of the classes are not allowed by the GWT compiler. javax.mail.* for instance.
However the GAE docs (https://cloud.google.com/appengine/docs/java/mail/usingjavamail) seem to be perfectly happy with using javamail (And I'm pretty sure I had an application working with it deployed before).
What am I doing wrong?
Is there really no way to use these classes?!
On using GWT you will code for two environment. The front-end (when the code will be translated to javascript) and the back-end that is a regular Servlet.
In the back-end you are free to use all jre/jdk API, for example, java-mail api. But in front-end you are limited to use classes describe in JRE emulation.
Check if your are not using a classes outside of JRE Emulation in front-end (generally an EntryPoint) and try to move the code to back-end (your servlet).

Java - Access to MongoDB server running on Windows Azure

I am developing an application that will use MongoDB running on Windows Azure. This page http://www.mongodb.org/display/DOCS/MongoDB+on+Azure on MongoDB refers to a VisualStudio solution that has helper classes to get access to the mongo server settings and for deploying/configuring mongo instances. Is there a Java based solution?
Out of the box, the 10gen-provided solution is only a .net / Visual Studio version, which creates a Replica Set with several Worker Role instances. You'd then need to add additional Roles to run your app (such as an IIS-based web app in a Web Role, or a Tomcat-based Java app in a Worker Role).
The issue you'll run into: You'd need to:
Do your Java development in Eclipse
Generate the WAR file
Create your java scaffolding in a Worker Role in visual Studio which unzips Tomcat and the JRE, copies your WAR file to the appropriate directory, sets up the environment, and launches Tomcat.
If you want to forego Visual Studio altogether, you'd need to configure and launch mongod.exe from your Java startup script. When you create a Windows Azure project from Eclipse, you'll see that there are several sample startup scripts: one for JBoss, one for Tomcat, etc. Pick the one that matches what you're using, copying it over the main project startup script. Then you can customize it to grab mongod.exe and launch it. This should be pretty straightforward to create a standalone MongoDB instance, but you'd have lots of work to construct a replicaset. 10gen doesn't have an out-of-the-box Java project built already for this.

Migrating Delphi App to Java or to Web App

We want to migrate UI rich application from delphi to java or Web Application.
Reason is that we want application to be portable on all Operating Systems.
Current Components and Modules of Application in Delphi :
In Delphi we are utilizing TWebBrowser component to display HTML content
We are playing mp3 that is extracted from FileStream on clicks in HTML.
All resources for HTML are retrieved from Embeded Database Firebird/Ms Access.
To sync some content we are doing HTTP post to PHP scripts to centralize the data on webserver.
Deployment:
- Application has to be deployed on CD and installed on Desktop computer on Mac OS, Linux, Windows.
I need your help how to approach this migration. Is better to go with Java UI or Web App that will be deployed with WAMP/XAMP and appropriate distributions on Linux and Mac's.
EDIT:
I have some specific requirements for audio functionality. Audio files are separate files distributed on CD or USB. Audio files are one solid file compiled from mp3's inside. Application will have to have ability to extract the mp3 based on offset and size of mp3 stored in index file and to play in real time... How this affects idea of Web App using this approach.
Why don't you give FreePascal a try? It uses the same language as Delphi, and can compile to a native application on Windows / Linux / Mac. Since you already have your app in Delphi, converting it shouldn't be too difficult.
Have a look at the freepascal website
If I had to deploy on a CD, I'd probably go with Adobe's AIR. It is really fulfilling the promise Java made 10 years ago in a reasonable way. It isn't perfect, but it does a pretty good job.
I've heard this internet thing is really taking off.
For all of the reasons that applications have gone online over the past 10 years, there really isn't much discussion to be had.
While Java is reliable, distributing and rolling out subsequent updates to those applications is heavy and time consuming.
I did Delphi development for over 9 years. I resisted the idea of distributing real applications over the web for quite some time. Today, I can't believe anyone would choose to continue in this way.
One nice thing, you can probably reuse some of your Delphi logic on the backend if you get creative. (I would only recommend this for the short term)
But, this answer doesn't really address your issue as you are saying that you must distribute it via CD.
The Java 6u10 release allows for distributing Java WebStart applications on media instead of from a Webserver, which might be exactly what you are looking for. You can also put the JRE installer for Windows on the CD too, if needed.
What exactly are your requirements crossplatformwise?
If most of the application is HTML-based, why not make it a full web application, using Ajax and Java?
I recommend NetBeans, and ICEFaces, which is a Java Server Faces implementation with Ajax support, including concurrent updates - if one user edits a record, all other users will see an update in their web page.
It is possible to package the whole application in a single jar file, including the servlet container (Jetty for example), so a simple java -jar myapp.jar will run the application.
NetBeans allows visual editing of the ICEFaces web pages, and even visual editing of the page relationships. The tutorials on NetBeans.org are excellent, and with tools like Maven, Hudson and others, code quality and development process can reach a very high level.
If you have some Delphi application using Datasnap : you can also re use your server made in Delphi with Datasnap in Delphi Prism and make Silverlight application.
And the same is true for DataAbstract

Categories

Resources