App Engine doesn't find WEB-INF in WAR created by sbt - google-app-engine

I'm trying to make a Lift app that I can run on App Engine and am managing the project with sbt. I have web.xml and appengine-web.xml in src/main/webapp/WEB-INF and package the project with sbt project. According to a previous SO quesiton, that should be all I need. However, I get this:
$ dev_appserver.sh target/scala_2.8.1/
2011-02-06 13:37:45.763 java[20355:903] [Java CocoaComponent compatibility mode]: Enabled
2011-02-06 13:37:45.765 java[20355:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
Feb 6, 2011 12:37:47 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
com.google.apphosting.utils.config.AppEngineConfigException: Supplied application has to contain WEB-INF directory.
at com.google.appengine.tools.development.JettyContainerService.determineAppRoot(JettyContainerService.java:319)
at com.google.appengine.tools.development.JettyContainerService.initContext(JettyContainerService.java:145)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:146)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:219)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
Any ideas why? Thanks.

Sorry, I just figured out the problem after submitting the question. The following invocation of the dev server works: dev_appserver.sh target/scala_2.8.1/webapp

Related

Azure App Service Getting error while deploying REACT JS application

Getting error while deploying to azure app services from the editor.
4:48:55 pm ppdedsrftwu2-appservice1: Starting deployment...
4:48:56 pm ppdedsrftwu2-appservice1: Creating zip package...
4:49:00 pm ppdedsrftwu2-appservice1: Zip package size: 1.09 MB
4:49:04 pm ppdedsrftwu2-appservice1: Fetching changes.
4:49:06 pm ppdedsrftwu2-appservice1: Updating submodules.
4:49:06 pm ppdedsrftwu2-appservice1: Preparing deployment for commit id '2a73dbd291'.
4:49:06 pm ppdedsrftwu2-appservice1: Repository path is /tmp/zipdeploy/extracted
4:49:06 pm ppdedsrftwu2-appservice1: Running oryx build...
4:49:06 pm ppdedsrftwu2-appservice1: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 10 -i /tmp/8d856447f426192 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log
4:49:07 pm ppdedsrftwu2-appservice1: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
4:49:07 pm ppdedsrftwu2-appservice1: You can report issues at https://github.com/Microsoft/Oryx/issues
4:49:07 pm ppdedsrftwu2-appservice1: Oryx Version: 0.2.20200805.1, Commit: e7c39ede513143e9d80fd553f106f04268d770d4, ReleaseTagName: 20200805.1
4:49:07 pm ppdedsrftwu2-appservice1: Build Operation ID: |lvjLop9mFGA=.426fac1c_
4:49:07 pm ppdedsrftwu2-appservice1: Repository Commit : 2a73dbd2834715ba1fee5082d13b60
4:49:07 pm ppdedsrftwu2-appservice1: Detecting platforms...
4:49:07 pm ppdedsrftwu2-appservice1: Could not detect any platform in the source directory.
4:49:07 pm ppdedsrftwu2-appservice1: Error: Couldn't detect a version for the platform 'nodejs' in the repo.
4:49:09 pm ppdedsrftwu2-appservice1: Error: Couldn't detect a version for the platform 'nodejs' in the repo.\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 10 -i /tmp/8d856447f4292 -p compress_node_modules=tar-gz --log-file /tmp/build-debug.log
4:49:20 pm ppdedsrftwu2-appservice1: Deployment failed.
Have defined all the necessary settings in the portal.
SCM_DO_BUILD_DURING_DEPLOYMENT=true
WEBSITE_NODE_DEFAULT_VERSION=12
WEBSITES_PORT=3000
WEBSITE_HTTPLOGGING_RETENTION_DAYS=7
Tried with node version 10 also but still the same error.
Connected with MS Support team they suggested to make the SCM_DO_BUILD_DURING_DEPLOYMENT= FALSE. After making this as false i am able to deploy the app. But the strange thing is with this option enabled i was doing earlier deployments and it was working.
In my case, I had the node app in a subdirectory, and this was causing this error in GitHub Actions job. Explicitly setting the working directory in the yml file fixed this. i.e
- name: npm install, build, and test
working-directory: ./subdirectory
run: |
npm install
npm run build --if-present
npm run test --if-present
I also struggled with this issue.
Two things helped me :
When deploying from the Azure App service extension :
Understanding that your root NodeJS application folder must be the root folder that is open in your explorer in vscode.
If your NodeJS application is in a subfolder, azure wont be able to build ( or identify your node platform : hence the error message that you are seeing ) the scripts in your root folder.
By far the easiest way to resolve this is to open vscode in the root folder ( the folder where your package.json file is located.
Also : When you click the deploy button on your vscode Azure App service extension : it might allow you to specify the folder to be deployed.
You can try to add the Application setting : SCM_DO_BUILD_DURING_DEPLOYMENT with the value of FALSE and Deployment slot setting of unchecked.
This is on the azure portal under configuration - application settings - add +
Remember to click that save button after adding new application settings ..... because azure ... lol.
But i think this is mostly way to delay your app building until the files are copied.
Last thing : If you are deploying from Github : Make sure that your nodeJS app is also in the root folder of the Github repo. If it is not you will need to update the workflow file to change the folder to the subfolder.
You just need to add cd yourfoldername above the line where it says npm install and commit the workflow change to the repo.
Hope this helps.
If you're doing a deployment from i.e., Visual Studio Code and deploying the dist/... folder then you wouldn't want to try and actually do a build hence setting SCM_DO_BUILD_DURING_DEPLOYMENT=false.
There is not a running node js server to actually do a build on the agent pool deployment pipeline. Azure devops or Jenkins per se would actually have an agent pool to do a "proper (air quotes)" build. Yes, you're code is running on node hence the setting you choose when setting up the web app. So those 2 things are not the same. Rather, DevOps.
I didn't find it in the documentation so appreciate the answer and responses here; but, I just wanted to give more context to the answer.
It's an upgrade to visual studio web apps deployment to potentially utilize other build methods like described in an answer here about github actions.

Download logs from Google App Engine with server errors

I try to download the logs from my Google App Engines with the command:
appcfg.py request_logs [directory] mylogs.txt
However, I encountered the server error as below:
C:\Program Files (x86)\Google\google_appengine>appcfg.py request_logs E:\PhD\cod
e\python\webDevelop\similarAPI\similarAPI/ mylogs.txt
05:22 PM Application: similarapi
05:22 PM Host: appengine.google.com
05:22 PM Downloading request logs for app similarapi version 1.
Error 500: --- begin server output ---
Server Error (500)
A server error has occurred.
--- end server output ---
I have looked at the official document and related Stack Overflow questions, but no clues are found. Actually I can get the logs in Dec, 2016 but not now. And I tried it for one week without the success, so it should not be the error of Google's infrastructure.
Does anyone know how to solve that problem? Thanks in advance.
Just a workaround, not a direct answer.
The GAE SDK might be getting a bit less attention compared to the cloud SDK (which is the recommended one lately). I, for one, can't even get as far as you got since appcfg.py request_logs can't properly detect my multi-service app from its directory and was not happy with any syntax attempt I made to specify it via args.
But I have the cloud SDK installed as well and I was able to get the logs for my app using gcloud app logs read (after setting up the gcloud context for my app)
FWIW, this isn't yet enough to make me switch, I'm still primarily a GAE SDK user. YMMV.
Finally, it has be proved that it is a bug of Google's infrastructure from 22 Mar to 10 Apr, 2017. Three related bug reports can be seen in the Google Issue Tracker 36637246, 37192011, 36969442.
Now the command appcfg.py request_logs [directory] mylogs.txt works well.

Google App Engine Tutorial Hello World Example won't run

I am having difficulty getting to the starting line on my machine.
1) Windows 7 32bit all service packs installed
2) Installed JDK 1.7.0_21
3) Checked PATH that only one copy of JDK\bin is in path and that it is correct.
4) Installed Eclipse Juno Java bundle. eclipse-java-juno-SR2-win32.zip
5) Install Google App Engine SDK per the tutorial using:
https://dl.google.com/eclipse/plugin/4.2
Selected:
- Google Plugin for Eclipse
- GWT
- SDK
Did NOT select:
- Developer Tools (Android)
- Google App for Android
- NDK Plugins
6) Following the tutorial, pull down the Google Icon and select "New Web Application Project"
- Name it Guestbook as shown
- Uncheck GWT
- Check Google App Engine
- Finish
7) Following the tutorial, Run as Web Application
At this point, the console shows several successful steps and then crashes and burns with jetty unable to establish a loop back connection. The full console output is attached below. I have searched all over the web and have not been able to find anything. I checked PATH and JDK. I checked the Windows firewall rule for Eclipse, it looks OK. I looked at the Classpath tab but could not see anything obviously wrong (although I don't know what it is supposed to look like)
Full Console Output
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF/appengine-web.xml
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF/web.xml
Jun 15, 2013 2:56:51 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFO: Overwriting system property key 'java.util.logging.config.file', value 'E:\Eclipse Google App Engine\eclipse\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.8.1\appengine-java-sdk-1.8.1\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'E:\User Data\Dave\Documents\Google App Engine Scratch\Guestbook\war\WEB-INF\appengine-web.xml'
Jun 15, 2013 2:56:51 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Jun 15, 2013 7:56:52 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed org.mortbay.jetty.nio.SelectChannelConnector$1#15321fc: java.io.IOException: Unable to establish loopback connection
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed SelectChannelConnector#127.0.0.1:8888: java.io.IOException: Unable to establish loopback connection
Jun 15, 2013 7:56:54 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed Server#150305e: java.io.IOException: Unable to establish loopback connection
java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(Unknown Source)
at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
at java.nio.channels.Pipe.open(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
at java.nio.channels.Selector.open(Unknown Source)
at org.mortbay.io.nio.SelectorManager$SelectSet.<init>(SelectorManager.java:312)
at org.mortbay.io.nio.SelectorManager.doStart(SelectorManager.java:223)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:314)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.Server.doStart(Server.java:235)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:249)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:307)
at com.google.appengine.tools.development.AutomaticServerInstanceHolder.startUp(AutomaticServerInstanceHolder.java:26)
at com.google.appengine.tools.development.AbstractServer.startup(AbstractServer.java:80)
at com.google.appengine.tools.development.Servers.startup(Servers.java:82)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:237)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:339)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:274)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:250)
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Unknown Source)
at sun.nio.ch.Net.connect(Unknown Source)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
... 26 more
PROBLEM SOLVED!
I was able to absolutely nail the cause of this problem and fix it.
What I did was removed the JRE and JDK from "C:\Program Files\Java\" (which is where Oracle's installer puts them by default) and reinstalled them in "C:\Java\Java7\" Apparently something in Eclipse and/or the Google Android development kit is still sensitive to spaces in the pathname to the JDK. This is an ancient general problem with Eclipse reported around 2005.
I did NOT need to drop down to Java 6
I did NOT need to edit Eclipse.ini and add a -VM line
I did NOT need to manually add the path to the jdk to PATH
Hope this helps the next person because this is an incredibly frustrating problem when you encounter it.
Thanks!
David Hetherington
Problem: Trying to run the 'Hello World' app using google eclipse plugin (eclipse - Kepler).
Solution: Adding to David's answer. If you have multiple jre's installed make sure the jre you are pointing to does not have a space in the absolute path. To change the jre you are pointing to go to eclipse - window->preferences->server->runtime environments->google app engine->edit. Now check the jre version you are pointing to. In my case I had jdk 1.7 installed in Program Files/Java and jre6 and jre7 installed in the same location. I moved jdk 1.7 to Program_files but was still getting the loopback error. Followed the above steps and pointed the jre version to the one in jdk1.7/jre in Program_files/java as earlier it was pointing to C:/Program Files/java/jre7
Hope this helps someone.
Are you sure you don't have anything else running with the same PORT number as the web-application? Default webapplication PORT is 8888

Google app engine sdk is using JRE Not JDK

I am not using eclipse, using GAE SDK to upload my project, problem is when i am trying to upload it is using jre not jdk thats the reason i am getting below error, please help how can i force app engine sdk to use JDK instead of jre
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\j1013366\Desktop\social.login.2013\appengine-java-sdk-1.8.0\appengine-j
ava-sdk-1.8.0\bin>appcfg.cmd update apps/SocialLoginProject
Reading application configuration data...
Jun 05, 2013 12:22:45 PM com.google.apphosting.utils.config.AppEngineWebXmlReade
r readAppEngineWebXml
INFO: Successfully processed apps/SocialLoginProject\WEB-INF/appengine-web.xml
Jun 05, 2013 12:22:45 PM com.google.apphosting.utils.config.AbstractConfigXmlRea
der readConfigXml
INFO: Successfully processed apps/SocialLoginProject\WEB-INF/web.xml
Jun 05, 2013 12:22:45 PM com.google.apphosting.utils.config.IndexesXmlReader rea
dConfigXml
INFO: Successfully processed apps\SocialLoginProject\WEB-INF\appengine-generated
\datastore-indexes-auto.xml
Beginning interaction for server default...
0% Created staging directory at: 'C:\Users\j1013366\AppData\Local\Temp\appcfg152
7926604447976257.tmp'
5% Scanning for jsp files.
8% Compiling jsp files.
Error Details:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilation
Context.java:238)
at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilation
Context.java:214)
at org.apache.jasper.JspC.processFile(JspC.java:1181)
at org.apache.jasper.JspC.execute(JspC.java:1341)
at com.google.appengine.tools.development.LocalJspC.main(LocalJspC.java:
40)
Caused by: java.lang.NullPointerException
at com.google.appengine.tools.development.LocalJspC$LocalCompiler.<clini
t>(LocalJspC.java:53)
... 7 more
com.google.appengine.tools.admin.JspCompilationException: Failed to compile jsp
files.
Unable to update app: Failed to compile jsp files.
Please see the logs [C:\Users\j1013366\AppData\Local\Temp\appcfg5225288314554557
20.log] for further information.
C:\Users\j1013366\Desktop\social.login.2013\appengine-java-sdk-1.8.0\appengine-j
ava-sdk-1.8.0\bin>
Personally I have intentionally set it up to use the JRE from within the SDK by modifying appcfg.cmd to
"%JAVA_HOME%\bin\java" -Djava.home="%JAVA_HOME%\jre" -Xmx1100m -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*
and setting JAVA_HOME to point to the JDK.
I am guessing you could modify -Djava.home="%JAVA_HOME%\jre" to point to wherever you like.

java.net.UnknownHostException: appengine.google.com

Got this error. Any idea how to get rid of it?
Yesterday it was working fine but today I got these errors. I saw a known issue with this - link. But I didn't find any solution yet..
Oct 16, 2012 4:01:59 PM com.google.appengine.tools.info.RemoteVersionFactory getVersion
INFO: Unable to access https://appengine.google.com/api/updatecheck?runtime=java&release=1.7.1&timestamp=1345058163&api_versions=['1.0']
java.net.UnknownHostException: appengine.google.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:559)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1010)
at com.google.appengine.tools.info.RemoteVersionFactory.getVersion(RemoteVersionFactory.java:76)
at com.google.appengine.tools.info.UpdateCheck.checkForUpdates(UpdateCheck.java:99)
at com.google.appengine.tools.info.UpdateCheck.doNagScreen(UpdateCheck.java:174)
at com.google.appengine.tools.info.UpdateCheck.maybePrintNagScreen(UpdateCheck.java:142)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:289)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:249)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:225)
Oct 16, 2012 4:01:59 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Oct 16, 2012 4:02:00 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed D:\WorkSpace\GAE\GST\war\WEB-INF/appengine-web.xml
Oct 16, 2012 4:02:00 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed D:\WorkSpace\GAE\GST\war\WEB-INF/web.xml
Oct 16, 2012 4:02:02 PM com.google.appengine.tools.development.DevAppServerImpl start
If you are using Java 8 in your app engine application, you will need to include
<url-stream-handler> urlfetch </ url-stream-handler>
in appengine-web.xml.
appengine-web.xml Reference
I am assuming that you are seeing this in your Eclipse IDE when you are trying to run the Eclipse Project as a Web Application.
The GAE plugin simply checks if there is an updated AppEngine SDK available for download. If there is a newer one than the one you are currently using then it lets you know that. The error is because at that instance, there was probably a network error and it got not connect through. It is harmless as far as running your application is concerned.
But if your application is dependent on accessing some external network services, then chances are that they might fail also if the network issue persists in your development environment.
got it working.. : cmd->goto your home directory >mkdir .appcfg_no_nag this will stop checking for the update and yourweb app willrun locally atleast..
This error is related to internet connection. I changed to other connection, it works
You should add in appengine-web.xml:
<url-stream-handler> urlfetch </ url-stream-handler>
And also start using java.net.URLConnection,
Apache HttpClient is not gonna work for example.
https://cloud.google.com/appengine/docs/standard/java/issue-requests#java_8_runtime_vs_java_7_behavior

Resources