Java - Access to MongoDB server running on Windows Azure - java

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.

Related

How do you develop with Intellij on Windows and Java and deploy to Azure Service Fabric

I'm using Intellij and Java, on a Windows development machine and Windows launch host target. The use of service Fabric has come into discussion but when I look at docs it presumes you're either using Visual Studio (and probably C#) and building/deploying to Service Fabric as SF project, or that your linux developer using eclipse and want to package to deploy to Service Fabric.
Intellij Azure tools doesn't look like it supports Service Fabric. The Eclipse Service Fabric plugin says it doesn't work in Windows (Linux only)
So how can a Windows/Java developer build and deploy to Service Fabric if you don't want to move to Visual Studio, change language, but you want to dev in Windows with Java?
Has any one found a simple way that this can be achieved?
I'd prefer NOT to have to jump off Intellij, definitely want to use Java (and Spring Boot), and interested in how I package and deploy to Service Fabric on Windows dev laptop (local 1 node cluster, Azure multinode cluster later).
Microsoft's documentation for Azure Service Fabric has a section on manually packaging an existing EXE (editing the XML configuration files) along with the Powershell scripts to push the package out to Azure.
I would think in most cases, the initial set up of the XML files and Powershell scripts would be a one-time thing and then you just re-use them for each deployment.

GAE multi-module, multi-language application on localhost

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.

Is there any other way to do a Hotswap without using Java IDE?

The Application is Running on Tomcat Server using java.I dont want to stop the Server everytime there is a Java change. The build System is heavily reliant on Shell Scripts, so i cannot use any Java IDE to do normal HotSwap.
Now, Is there any otherway i can Hot swap the file?
I have used JRebel for this purpose on several java projects. It can reduce redeploy times considerable.
One way would be to use the Tomcat Management Web User Interface. You can easily script commands to the WebUI using curl.
There are also Ant tasks for Tomcat management operations.
Reference:
http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
Examples:
Tomcat 7 tomcat-users manager-script example for /deploy
Tomcat manager remote deploy script
If you are looking for some kind of graceful update of your applications, you can take a look at Tomcat's Parallel deployment. With that option, you can update application without stopping current open sessions. The server will start new sessions on the new application versions while older one wont be renewed on the older.
What you are looking for is a Development Mode which allows you to swap the Application at runtime with a new version. This is usually useful for development while not practiced in the production, hence it is called "development mode".
See How to Install Apache Tomcat for Development Mode.
More on this also in Restart tomcat when a class file is changed?.
See the Documentation, search for reloadable:
reloadable
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

How to create a setup file for a project that was written in netbeans?

I have created a GUI application using Netbeans and it has a connection to a database( localhost).
Now I want to be able to distribute it as software.
Is there any way to produce a setup file for the Netbeans project? and how can I distribute a Netbeans project which uses a MySQL database?
how can I distribute a Netbeans project which uses a MySQL database?
You might want to get familiar with NSIS. NSIS will enable you to automate the installation process.
Your installation process will have to do the following:
Check that the Java Runtime Environment is the same version you used or higher.
Install your application JAR file somewhere.
Install the MySQL version that your application requires
Create and initialize the tables for your application.
Your installation process can do the following:
Create an uninstall executable.
Add an icon so that the user can start your application.
This installation process will take some time to develop and test.
You probably want to use an installer. Have a look at:
Install4j
Installshield (commercial)
Advanced installer if you target only windows platforms
There are many others but I hope this can help you...
Use the solution made by the suppliers of Java - Java Web Start.
The deployJava.js (described in the linked page) ensures the user has the minimum JRE needed to launch the app. & MySQL.
Launch the app. using Java Web Start.
Reference an installer-desc extension for installing the DB. Store any set-up details into the PersistenceService for later use.
JWS works on all major platforms for which J2SE is available and also provides..
..many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..

creating an installer for a java spring mvc app

any good tutorials on creating an installer that will install a spring mvc web application, namely setting up tomcat and postgresql on someones desktop?
Best thing is to create a directory containing all stuff (tomcat+ webapp, postgresql) and a cmd script firing up the DB and appserver. Zip this up. Than, you can use a tool like http://www.advancedinstaller.com/java.html to wrap it up in an MSI file, that unzips the application, installs Java (if necessary) and create shortcuts.
This is assuming the target platform is Windows. For other platforms you can use a similar approach.

Categories

Resources