How to deploy tutorial project on GAE - java

I am completely new to GAE and maybe this question could be quite trivial, anyway I present my case.
I followed the "Try Google App Engine Now" tutorial without any problems (I choose the java project and I use Chrome).
When I try to deploy the project on GAE something goes wrong, I can create the project on GAE but I don't know what to do next:
What command should I use to deploy?
Thanks

Assuming that you have been able to create your application and have been successful in running it locally, please follow the instructions over here for uploading your application.
https://developers.google.com/appengine/docs/java/tools/uploadinganapp#Uploading_the_App

Basically, you should do some configuration such as filling the project-ID at app.yaml.
Then you can use the terminal to change to your project directory, afterwards you can invoke Maven as 'mvn appengine:update'
You can follow the instructions at the following link:
https://cloud.google.com/appengine/docs/java/gettingstarted/uploading

Related

Export GitHub Repository Files to a Usable JAR executable file, issues

I am an enthusiast attempting to play around and add things to an app that I have been using for the past year which the source codes are available in GitHub. Problem is when I clone or download the repository and open it in Eclipse, I get a ton of error codes whenever I try to 'run as' Java app (in particular I am unable to find the 'main class/starting point' there's way too many files to chose from to find it and most don't work) and when I try to extract the files to an executable jar it gives me a JAR exe that is unusable :-(. I know that the files are workable since I do use the executable jar that is available from the developer and others have also toyed around with the source codes.
Can anyone assist me with this? Maybe I am using the wrong Java manipulator/application. The program I am using for opening these files is Eclipse IDE for Java Developers and my operating system is 64bit Windows 10.
Also, here is the GitHub URL for the repository, in case anyone asks: https://github.com/DraqueT/PolyGlot.
I thank anyone who can be of some assistance as I have been working on this forever and can't seem to find a solution.
The github project looks a lot like a utility library than a full application. But the following could help:
Try to study the README file attached to the github project. (There is one in the source code according to the author). This would help you to setup the project.
Make sure to download all the dependencies for that project. Again, the author has provided some of them in the github project (I could see some Apache POI libraries in there somewhere), but getting the required jars on the maven repository isn't that difficult.
It would also help to know what type of project it is. For example, having a main method in a web application doesn't do much for you, but a Java SE project would need a main method to run. So try to find out what kind of project it is.
If all else fails, you could try to contact the owner of the repository or one of its contributors to assist you.
Cheers!

Using In-memory Database With Hibernate tutorial how to execute?

I'm new in Java and Hibernate as well. I'm following this tutorial # http://howtodoinjava.com/2014/09/03/hibernate-4-using-in-memory-database-with-hibernate/
I managed to compile the code and understood the concept as well. But the problem is that I don't know how to execute the code to debug some stuff. When I start app as java application in eclipse. I have a long list to of option. But I don't see my actual test class to run. So How to run it and debug this app? Also I tried this # https://gist.github.com/twasink/2881461. Same is issue. No idea how to run.
Please check the screen shoot of eclipse list while:-
There is a main() method in TestHibernate.java. Use it.
The tutorial that you are following is maven project.
Try creating a simple maven project in eclipse and move the required artifacts to thelocation
as specified in the screenshot in the tutorial.
It will be a good learning curve to you.
As a hint use archetype as maven-archetypes-quickstart while creating maven project.
Hope this helps.

How to display changes in web browser when Building a RESTful Web Service using Spring?

I am following this tutorial:
https://spring.io/guides/gs/rest-service/
After completing the tutorial I run everything in my web browser on my local host and everything seems to work.However when I make changes in the java code (I made errors on purpose) I can still run everything in the web browser. What do I need to do in order for it to change due to my code changes? I guess I should mention that I am using eclipse and have installed maven as a plugin.
You are changing the source code, but not the compiled files. Your service is using the created "gs-rest-service-0.1.0.jar" file. This is not affected by your code changes.
Jump into the tutorial again where it says:
"Build an executable JAR"
This will rebuild your jar file. Afterwards you will have to restart your service like you did in the chapter "Run the service".
Instead of using maven as a plugin a choose to install it in order to use the command prompt.

Appengine: Backend API Tutorial, cannot build project

I have completed the Java Tutorial for Google App Engine.
Now I wanted to do the Backend API Tutorial, but I get errors..
I installed Maven and I was able to generate the project from the command line with maven as described in "Creating an Endpoints Backend Project". I have problems with the next step: Configuring the Maven Project for Endpoints.
Under the point "Setting required plugin configuration" it says "2. Locate and replace the default appengine-maven-plugin configuration entirely with the following: ", before they were talking about the pom file from "helloendpoints/helloendpoints-war".
--> But in that pom.xml-file from "helloendpoints/helloendpoints-war", I cannot locate that configuration... I found that in the pom file of "helloendpoints/helloendpoints-ear".
Question 1: Is this (in ear-folder) the pom-file that i shall edit or should there be that configuration in the pom from the war folder?
However, replacing that code there or not both gives me an error when I invoke maven with "mvn install".
The error-message is the following: "Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.3:war on project helloendpoints-war: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.3:war failed: basedir C:\Users...\helloendpoints\helloendpoints-war\target\generated-sources\appengine-endpoints does not exist".
And I can see that in "...\helloendpoints-war\target", there is no "generated-sources"-folder!
And this is where I am stuck now.
Question 2: Can all this be done without Maven and is there any tutorial for that? Because that is another source of errors and I had to deal with enough errors now... I just want to get an understanding of how the appengine works, how I can use it for my android app and then start from a WORKING basic-project, but I already had to deal with lots of errors. This is pretty frustrating, because I just wanted to do what is told in the tutorial and I still did not write any own code yet...
Question 3: In the next part of the tutorial, are they using the m2e-plugin or anything? Because that was mentioned nowhere, but somehow you have to import that maven project into eclipse...
Yes you can do it without Maven.This and this are simple tutorials from Google that shows you how to add a backend to an Android project.
I would suggest to delete this topic, because I switched to the tutorial without Maven, which has not much to do with my original post. That tutorial works now, but I cannot explain what solved it. I think this whole topic is more confusion and also wasted time for anyone else, who is trying to find an answer here.

How can I deploy web app on Tomcat from running app

I would like to develop updater app. Lets say I've got:
- Running Tomcat
- Running Updater App on the Tomcat
- Running old version of the app on the same Tomcat
I would like to
- Stop old app
- Undeploy old app
- Deploy new version of app (lets assume that I've got new app war file somewere in Updater app resourcess.
Is it possible to do such remote deployment on Tomcat from another app at all?
To deploy a project to your Tomcat Server from another app you need to:
Add a library into your project “catalina-ant.jar” from the folder: {TOMCAT_PATH}\lib
And in your project to deploy a war file you need to only do:
org.apache.catalina.ant.DeployTask task = new org.apache.catalina.ant.DeployTask();
task.setUrl("http://localhost:8084/manager");
task.setUsername("managerLogin");
task.setPassword("managerPassword");
task.setPath("/UrlToYourDeploadingProject");
task.setWar(new File("c:/Project.war").getAbsolutePath());
task.execute();
Thanks to this solution I'm able to develop project that can update automatically my apps.
Yes. There's a set of tools (well, a .jar) released with Tomcat that's usually used by ant but that can be used by anyone willing to call the code. There are tasks for starting and stopping applications, deploying, undeploying, listing applications and so forth; essentially it's an API that wraps the functionality of the manager servlet.
One moment while I try to dig up the name or a link for you...
Here's Apache's information on this stuff: http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing Manager Commands With Ant
... and here's a user, elsewhere, describing in detail how he uses these tasks: http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks
You may object that you're not ant. That's true, but there's nothing magic about ant, it's just calling code inside the jar. That code can be called from anywhere else that follows the API.
Here's a tutorial on writing ant tasks: http://ant.apache.org/manual/tutorial-writing-tasks.html
Not quite the same, but it should give you an idea of how the API works.
I see no reason why you shouldn't be able to call this API from within a servlet if you want to.
Alternatively, you could run the manager servlet in your Tomcat and simply access the manager application like a Web service: Use your browser or WireShark to snoop on the traffic between your browser and Tomcat when you deploy an app, and then duplicate that to remote control manager. Me, I think using the tools jar is simpler.
If you use a "project lifecycle" tool, this undeploy/deploy can be automatized in the development cycle.
Saying that, I think about Maven2 and his "maven-deploy" plugin :
mvn compile : java compilation
mvn package : creation of the war file (for a webbapp project)
mvn deploy : stop, undeploy the old application, deploy and start the new version !
After, you can couple this automatization with a continous integration server (like Hudson).

Categories

Resources