Play framework app 'cannot find template' while deployed on heroku - exception

i have written an app that runs locally with no issues
after deploying app to Heroku when trying to enter a certain page i receive the following error (taken from log):
2012-02-29T00:11:53+00:00 app[web.1]: Internal Server Error (500) for request GET /Application/adminPage
2012-02-29T00:11:53+00:00 app[web.1]: Template not found (In /app/controllers/Application.java around line 78)
2012-02-29T00:11:53+00:00 app[web.1]:
2012-02-29T00:11:53+00:00 app[web.1]: at play.mvc.Controller.renderTemplate(Controller.java:667)
2012-02-29T00:11:53+00:00 app[web.1]:
2012-02-29T00:11:53+00:00 app[web.1]: play.exceptions.TemplateNotFoundException: Template not found : Application/admin.html
2012-02-29T00:11:53+00:00 app[web.1]: The template Application/admin.html does not exist.
/app/controllers/Application.java around line 78 :
public static void admin(){
List<MailUSer> allUsers = MailUSer.findAll();
render(allUsers);
}
rout file:
# Home page
GET / Application.index
GET / module:secure
POST /Register/welcome Register.welcome
GET /Application/adminPage Application.admin
# Ignore favicon requests
GET /favicon.ico 404
# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public
# Catch all
* /{controller}/{action} {controller}.{action}
what am i doing wrong ?

I had this problem on Heroku, and it was case-insensitivity.
In my controller, I had something like
public static void showUser(Long id) {
...
render(user);
}
but in my views folder I had
app/views/Application/showuser.html
On my Mac, and Windows machine, this is fine, but on Linux machines, including Heroku, the file showUser.html will not be found.

try to troubleshoot using the following items:
did you upload the views folder under app to the Heroku?
do you have case sensitive problems in your file and directory names (say Application/admin.html is different from application/admin.html etc)? When you are in a windows platform this is okay, but when you deloy app to a linux/unix environment, this going to break your app.
BTW, MailUSer looks strange, why not MailUser ?

Related

Get frequent chrome driver error: driver config / start failed: chrome server returned empty list from http://localhost:(port) in karate standalone

I used to get frequent chrome driver error in karate UI tests. I have been using karate tests in VS code for the past 5 months. Now, I used to get driver config / start failed: chrome server returned empty list from http://localhost:[port] frequently. Sometimes, I need to run 20 times to run the same test to succeed. All other runs throws either "driver config / start failed: chrome server returned empty list" / "ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed"
I have installed chrome multiple times but I get the same error. Also I have re-imaged my laptop due this issue and through something went wrong. Even now I used to get the above errors often.
I have installed Chrome 64 bit in windows laptop, it get installed in "C:\Program Files\Google\Chrome\Application\chrome.exe" but karate standalone will always check the Chrome path "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" in runtime which doesn't exists.
Note: I have set the chrome.exe installed path in my system environment PATH but karate not considering the path variable. Please advise me on this.
So I have modified the driver config as given below:-
* configure driver = { type: 'chrome', headless: true }
[To]
* configure driver = { type: 'chrome', executable: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: true }
Karate version: 0.9.6.RC3
OS : Windows 10 Home
JDK Version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
Chrome Driver config
configure driver = { type: 'chrome', executable: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: true }
Chrome Driver Errors
testui.feature:8 - driver config / start failed: chrome server returned empty list from http://localhost:54311, options: {type=chrome, executable=C:/Program Files/Google/Chrome/Application/chrome.exe, headless=true, target=null}
ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed:
[1.1:33] test_page.feature:9 - driver config / start failed: chrome server returned empty list from http://localhost:55676, options: {type=chrome, executable=C:/Program Files/Google/Chrome/Application/chrome.exe, headless=true, target=null}
ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed:
[1.1:33] test_page.feature:11 - evaluation (js) failed: input('#username', 'admin'), failed to get reply for: [id: 23, method: Input.dispatchKeyEvent, params: {modifier=0, type=keyDown, text=k}]
Please guide me how to resolve this issue.
Thanks,
Chandra
I was same error. Actually its finding chrome.exe in different location where actually its not located.
In default it's looking at "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
but actual path was 'C:/Users/ues/AppData/Local/Google/Chrome/Application/chrome.exe'
So check your chrome.exe path.
Hope it's helpful.
I have solved my problem by defining in the config file as;
"karate.configure('driver', { type: 'chrome', port: 9222,
executable: 'C://Program Files//Google//Chrome//Application//chrome.exe' });"
maybe assigning a port help me to solve the issue but one thing to consider here is that u need to use forward slashes in the executable command.
No one else has reported this, so you'll need to figure this out maybe with the help of someone who can troubleshoot your machine. Maybe there are some permission restrictions. Maybe your old processes are still running, so make sure you go to your task manager and kill them etc, this is quite common on Windows.
And please upgrade to 1.0 before trying anything else, because that may help: https://github.com/intuit/karate/wiki/1.0-upgrade-guide
Otherwise we will need your help to maybe debug and suggest changes to the framework. Ideally you should contribute code to Karate, and remember - it is an open source project. If you are able to replicate your problems, follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - but I'm not sure that is possible with the kinds of issues you are describing.
If none of the above options work, you may need to consider switching to some other framework.
EDIT: most teams run on CI + Docker which is much more stable: https://stackoverflow.com/a/62325328/143475

Rendering Error when executing Yarn Run with Boilerplate and Electron-React

I am very new to this and will probably have a hard time explaining the problem well. I am using boilerplate and electron react to open a webpage. Up until today it was working fine, however all of a sudden my console reads an error when using
yarn run
The error is:
Failed to load resource: the server responded with a status of 404 (Not Found) renderer.dev.js:1
The window appears but nothing renders.
I've tried to revert my commits but the problem doesn't go away, I'm unsure of what route to pursue with the problem.
Any guidance would be appreciated
EDIT
It looks like sajad saderi's suggestion of removing node_modules and reinstalling it removed the specific error message, and my renderer.dev.js file has loaded. However, now the following appears
Uncaught Error: None of the binaries loaded successfully. Is your node version >= 10.15 ?
at failIfNoBinaryExported (renderer.dev.js:192034)
at Object.liveLoad (renderer.dev.js:192030)
at Object../node_modules/msnodesqlv8/lib/bootstrap.js (renderer.dev.js:192050)
at __webpack_require__ (renderer.dev.js:771)
at fn (renderer.dev.js:131)
at renderer.dev.js:192072
at Object../node_modules/msnodesqlv8/lib/connection.js (renderer.dev.js:192508)
at __webpack_require__ (renderer.dev.js:771)
at fn (renderer.dev.js:131)
at Object.<anonymous> (renderer.dev.js:194552)
The program is meant to gather data from an SQL Server using Electron React, Boilerplate, and msnodesqlv8

Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443 throws on uploading files to appcenter

I am working on sample tests for mobile application and to upload and run in AppCenter. I have tried with XamarinUITest and C# combination; test files uploaded and ran successfully. On trying test files with Appium, Java and Junit and tried to upload it in AppCenter throws Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443 in Terminal.
The snippet I am using to upload is:
appcenter test run appium --app "Appium/JunitiOS" --devices "Appium/iphone" --app-path pathToFile.ipa --test-series "test" --locale "en_US" --build-dir target/upload
Note: given corresponding file paths in the snippet.
and get the below in Terminal:
Preparing tests... done.
Validating arguments... done.
Creating new test run... done.
Validating application file... done.
Uploading files... failed.
Error: getaddrinfo ENOTFOUND api.appcenter.ms api.appcenter.ms:443
Environment: darwin
App Upload Id: Appium/JunitiOS
Timestamp: 1554114371409
Operation: RunAppiumTestsCommand
Exit Code: 3
This error usually occurs when there's some sort of network issue (either WiFi dropping out, a corporate firewall or proxy or a DNS issue are likely culprits)
Things to try if the successful upload is running on a different machine or a different network
Check the failing upload over a different network
Make sure you can see the URLs and IPs from the machine you're running on
If that fails - reach out to support using the App Center portal and a support engineer will help you get up and running
Things to try if the successful upload is running on the same machine on the same network
Double check that the UITest tests are still working successfully
Check that you don't have any corporate firewall policies which could be blocking specific files
If that fails - reach out to support using the App Center portal and a support engineer will help you get up and running
I would also recommend running the command again using --debug - you should be able to see the API calls being sent and identify at which point the uploads are failing (and if it's the same point every time).

Polymer starter kit unit testing

I'm trying out polymer-starter-kit for the first time. Using yeoman generator I have scaffolded the basic project. When I run the unit test using Web Component Tester, am getting the following error.
Error: Could not request headers from http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip
Following is the stdout when I run gulp test:local
[12:39:44] Using gulpfile
~\tryout\js\polymer\admin-portal-client\gulpfile.js [12:39:44]
Starting 'wct:local'... Starting Selenium server for local browsers
---------- selenium-standalone installation starting
--- selenium install: from: http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\se
lenium-server\2.47.1-server.jar
--- chrome install: from: http://chromedriver.storage.googleapis.com/2.16/chromedriver_win32.zip
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\ch
romedriver\2.16-x64-chromedriver
--- ie install: from: http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\ie
driver\2.46.0-x64-IEDriverServer.exe
--- File from http://chromedriver.storage.googleapis.com/2.16/chromedriver_win32.zip
has already been downloaded
--- File from http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
has already been downloaded [12:40:10]
'wct:local' errored after 26 s
[12:40:10] Error: Could not request headers from
http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip:
Node version : v0.12.7
npm version : 2.11.3
OS : Windows 7
What could be wrong ?
Because this file http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip doesn't exist on that link. Just try to browse it on your browser on all 3 files. You will find this is the only one that doesn't exist. However, http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.47.0.zip does exist.
Update: Looks like someone already opened an issue.
https://github.com/Polymer/web-component-tester/issues/206

MSDeploy gulp build package

Is it possible to deploy a Single Page App project build using grunt to IIS using MSDeploy from TeamCity? The project is not any kind of Visual Studio solution and doesn't get built using MSBuild.
My Command parameters which are not working are:
-source:package='%teamcity.build.checkoutDir%\Dist.%build.number%.zip' -dest:auto,computerName="%system.MsDeployServiceUrl%",userName="%system.UserName%",password="%system.Password%",authtype="basic",includeAcls="False"
-verb:sync -setParamFile:"%teamcity.build.checkoutDir%\Dist.%build.number%.zip.SetParameters.xml"
-AllowUntrusted -setParam:"IIS Web Application Name"="%system.WebSiteName%" -verbose
The error I am getting is:
[11:47:31][Step 3/3] Error Code: ERROR_EXCEPTION_WHILE_CREATING_OBJECT
[11:47:31][Step 3/3] More Information: Object of type 'package' and
path 'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip' cannot
be created. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.
[11:47:31][Step 3/3] Error: The Zip package
'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip' could not
be loaded. [11:47:31][Step 3/3] Error: Could not find file
'D:\TeamCity\buildAgent\work\e2b0015b49d87e90\Dist.30.zip'.
[11:47:31][Step 3/3] Error count: 1. [11:47:31][Step 3/3] Process
exited with code -1 [11:47:31][Step 3/3] Step Deploy (Command Line)
failed
My build process is working as I end up with the correct artefacts, I just don't seem to be able to deploy my generated artefacts using MSDeploy
This is a screenshot of my artefacts:
I managed to get this working by changing my parameters to the following:
-source:iisapp='%teamcity.build.checkoutDir%\dist' -dest:iisapp='C:\www\xxxx-website',computerName="%system.MsDeployServiceUrl%",userName="%system.UserName%",password="%system.Password%",authtype="basic",includeAcls="False"
-verb:sync -AllowUntrusted -verbose
And changing my user to an admin user rather than an IIS user. Note use of iisapp - the key was to read the MSDeploy api using msdeploy -help
FYI - a good test is to use the intended command against msdeploy.exe in console and check output errors then push command into teamcity when it's working.
I created a grunt and gulp plugin to do just what you are looking to do. gulp-mswebdeploy-package and grunt-mswebdeploy-package will create a ms webdeploy package from any folder and do not require your build to be running on windows.
https://www.npmjs.com/package/gulp-mswebdeploy-package
https://www.npmjs.com/package/grunt-mswebdeploy-package