I'm just starting with App Engine, and am trying to get a basic Hello World running locally on my machine to test. I've been trying to follow the tutorial for Java here.
I get as far as running the following commands:
cd appengine-try-java
mvn package
At which point the tutorial insists that the server should be built and run and I should be ready to go, except I just get a "build success" and the server isn't running (The terminal output doesn't hang and wait for Ctrl+C, and I can't access localhost:8080).
I've tried figuring out myself how to use the .war file it gives me to run the server using the Apache Maven, but without any luck. I followed the rest of the tutorial exactly. Any advice on what I'm missing?
Thanks!
I think you forgot to run the last command:
dev_appserver.sh target/appengine-try-java-1.0
with cd you go to the folder, with mvn package you will build the project and with the dev_appserver.sh you will start the actual project.
Related
when we run a Rhapsody application via Jenkins.
My scenario:
1) I need to get details about various diagrams in a Rhapsody model.
2) I have written Java code using api provided by Rhapsody to get the details of various diagrams.
3) this java code is made into Jar and is run via command line, works fine by invoking Rhapsody in background.
4) when this same command is put in jenkins to run as windows command, the job fails,
The code is able to connect to Rhapsody Instance, but somehow unable to open a project.
Did anyone resolve this type of issue ??
Yes I faced this issue when running a plugin in jenkins where I was not able to open the rhapsody instance as it was throwing an examption.
To solve make user which runs the jenkins job has the license for rhapsody if yes try to open your rhapsody project manually and run the script from the job.
Hope these solution works for you
I have been given the task of developing code that generates an email when a user deploys new code to our servers. I already have the code to generate the email. However Im trying to run this code when we add new code to our servers. We currently deploy new code to our servers using the MAVEN Deploy command in Eclipse. I was wondering if there is a way to run a java main method or something along those lines when a user selects Maven Deploy in Eclipse?
Not sure of your actual use case or if this is the best approach, but you can run java programs using the maven exec plugin. See here for more details: http://www.mojohaus.org/exec-maven-plugin/examples/example-exec-for-java-programs.html
I am following this tutorial to see how Google App Engine (Java) works. I was able to successfully build the app:
cd appengine-try-java-master
mvn clean install
The issues happens at the last (deployment) stage on Windows. The tutorial says that it's necessary to run this command (the number 1111 is not the original one due to security reasons):
appcfg.cmd -A master-scanner-1111 update target\appengine-try-java-1.0
I opened cmd and pasted this command. The following message appears:
appcfg.cmd is not recognized...
Then I executed just update target\appengine-try-java-1.0, however this did not deploy the app.
The problem is that in the previous steps they give you instructions to download the Google App Engine SDK, but this is just a package of directories and not an installer (much like how java is packaged). The appcfg.cmd exists within that set of directories, so the user will need to add the "bin" folder in that package to their path (or, as suggested, use the full path in the command). The Google documentation is not specific enough for a person just starting out IMHO. I had the same problem.
Im following the tutorial on the App Engine website for 'Google Cloud Endpoints' in Java. Everything works fine and I can run the development server using mvn appengine:devserver. The problem is that when I make any changes to a file (for example, any java file) the dev server doesnt automatically recompile. I need to ctrl-c to kill the dev server and restart it for every code change I make.
Is there a way to have maven automatically detect changes to any files in my project and have it automatically rebuild and restart the dev server?
Unfortunately no. If you want this behavior on your dev server, you need to use Python.
I run in the same issue and there is no real workaround provided by the App Engine to help you doing this.
From the "Using The Google plugin for Eclipse":
With Eclipse, you can leave the server running in the debugger while you make changes to source code, JSPs, static files and appengine-web.xml. When you save changes to source code, Eclipse compiles the class automatically, then attempts to insert it into the running web server dynamically. In most cases, you can simply reload the page in your browser to test the new version of the code. Changes to JSPs, static files and appengine-web.xml are recognized by the development server automatically, and also take effect without restarting the server. If you change web.xml or other configuration files, you must stop and start the server for the changes to take effect.
(https://developers.google.com/appengine/docs/java/tools/eclipse#Running_the_Project)
There is NOTHING comparable in Java (link from "The Java Development Server") (https://developers.google.com/appengine/docs/java/tools/devserver)
There's currently nothing in the App Engine SDK to automatically restart when files change, but that's not to say you can't do it. I ran into the same problem and wrote up a script to listen for file changes as triggers to restart App Engine. It's in JavaScript, so you'll need to install Node.js if you haven't already.
// Install watch-exec
$ npm install -g watch-exec
// Watch the current directory
$ watch-exec --command "mvn appengine:devserver" --watch .
This will immediately start App Engine, and then restart it any time a file changes. If the app crashes for some reason, the script will wait for your next edit before trying to restart.
P.S. That entire script is about 40 lines of code, and you could probably do the same thing in other scripting languages. If you haven't tried writing your own automation before, I'd definitely recommend checking out the source code to see how this works.
I've found using Gradle, GAE, and Spring MVC, the assemble command will put the correct artifacts in place, and the server will re-init the app. It's a little quicker than a server restart.
Using App Engine standard with the cloud.tools appengine-maven-plugin hot swap works fine (most of the time, can be problems when setting up the workspace).
For a multi-module maven project: no need to stop the server or browser,
just push the code changes (maven command package -pl *-server)
& refresh the browser.
Debugging with a debug client currently works perfectly for changing / adding code within methods.
I have some ant scripts that create various things from the command line.
My command environment is complex, and we are doing some icky things I don't really want to do in eclipse, that won't really run from an ant script invoked inside eclipse. But if there is a way to have an ant script in eclipse start the server, that would be OK too.
Sometimes they take a while to run. It would be nice if when they were done, I could start my Java EE server inside eclipse. I happen to use JBoss 1.4.2 if that matters. I would like to start it in debug mode if possible. This way I could test without having to navigate to the server and start up debug from within eclipse as soon as my code finishes building. Is there any easy way to do this?
You can always manage your Application Server externally. by calling <JBOSS_HOME>/bin/run.(sh|bat) -b <ip_address> (JBoss 5) or <JBOSS_HOME>/bin/standalone.(sh|bat) -b <ip_address>
To start and stop your server from ant and having it appear as if you started it from within eclipse, that is a harder task. You would have to create a Run/Launch Configuration from within eclipse and then call it from ant see Launch an Eclipse Run Configuration from ANT