I have a java-application (standard springboot from default tutorial: https://spring.io/guides/gs/spring-boot-for-azure/ ) that I "successfuly" deploy to my WebApp (created during deployment) via Eclipse/maven plugin azure-webapp:deploy
Once deployed, files are inside the WebApp, I can see them. If start-up is successful I do get running application, but if it is not - I do not know how to troubleshoot. I don't know where to find error logs, what caused the problem and as consequence, how to solve it.
as an example of how to make it fail, add this line:
throw new RuntimeException("Doomed to fail");
I tried enabling logs from "diagnostic logs tab" and expected to see them under LogFiles/Applications but that folder remains empty.
How do I troubleshoot java-application that fails to start in WebApps of Azure?
edit: additional example of Exception to troubleshoot:
public static void main(String[] args) {
throw new RuntimeException("start failure #21");
//SpringApplication.run(Application.class, args);
}
It sounds like you followed the springboot tutorial Deploying a Spring Boot app to Azure to build the GitHub project microsoft/gs-spring-boot and deploy to Azure, but not works.
Here is my steps which I also followed the tutorial, but deployed via my own way.
I created a directory SpringBoot on my local machine, and to do the commands cd SpringBoot and git clone https://github.com/microsoft/gs-spring-boot.
Then, to build it via commands cd gs-spring-boot/complete and mvnw clean package
Note: I reviewed the sections of the tutorial under Create a sample Spring Boot web app which seems to do on Linux, but the web.config file in microsoft/gs-spring-boot/complete is ready to Azure WebApp for Windows. However, there is not any comments to describe the deployment target that be Azure WebApp for Windows or Linux.
So I used my existing WebApp for Windows to test my deployment. I open my Kudu console in browser via the url https://<webapp name>.scm.azurewebsites.net/DebugConsole and drag the files complete/web.config and complete/target/gs-spring-boot-0.1.0.jar to site/wwwroot as the figure below. Then, I started my webapp, and it works fine.
Note: Please check the JAVA_HOME environment variable which has been configured on Azure via command echo %JAVA_HOME% as the figure below.
If not, you need to set Java runtime in the Application settings tab of Azure portal.
Or you can also configure the web.config file to replace the reference %JAVA_HOME% with an existing Java runtime installed in the path D:\Program Files\Java of Azure WebApp, as below.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<!-- <httpPlatform processPath="%JAVA_HOME%\bin\java.exe" -->
<httpPlatform processPath="D:\Program Files\Java\jre1.8.0_181\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\gs-spring-boot-0.1.0.jar"">
</httpPlatform>
</system.webServer>
</configuration>
I didn't manage to find logs in windows based machine, but If you enable logs on linux-based-machine you will see them in the "Diagnostic logs" output. There is a catch though.
There is 230 timeout. It will wait full "timeout" time, until producing logs in the log file, after which you can access them via log file or through "Diagnostic logs". Make sure to enable logging before you start application. This applies to linux based machine, I don't know if it can apply to windows based machine.
Then it waits for an answer trigger. Answer trigger, as it turns out, is a phrase in console output "Application is started in X seconds". I increased the timeout to 500 seconds, because although it starts in 60 seconds on my local machine, it takes 430 seconds on remote-linux-based machine of Microsoft Azure*
Second, I changed the name of my main class from "GameStart" to "Application" and after that it actually caught the trigger. After that the application started. Nowhere in manuals did I find the "until timeout - no logs" and "trigger phrase" clauses mentioned.
ps: For reference, it took me 20 to upload application, 5 minutes to start it. I was using centralUS server, cuz centralEU did not work out for me, as it was even longer, although I'm in central EU myself
-
*using test account. It might happen that on payed account number are either different or similar.
Related
I have a problem with running JHipster in Production Mode. After building the .war by
mvn -Pprod package
and uploading it to my server, I get the "normal" start page - so the page loaded, but with following errors:
"NetworkError: 404 Not Found - http://server.net:9080/studentenhelfer-intern-0.0.1-SNAPSHOT.original/api/authentication?cacheBuster=1459611519471"
"NetworkError: 404 Not Found - http://server.net:9080/studentenhelfer-intern-0.0.1-SNAPSHOT.original/api/logout?cacheBuster=1459611519626"
The second point - when I "install/start" the Application on the server, the database will be not created. (No tables and no data)
I can´t figure out why.... With the dev-profile everything is working fine.... (Also with the same DB settings in application-prod.yml)
Additionial Info: the spring profile has also been set to prod profile in
/etc/default/tomcat7
JAVA_OPTS="${JAVA_OPTS} -Dspring.profiles.active=prod"
(This should be ok, yes?)
I´m using MySql as Db (with liquibase) and Maven for building. The server is a linux server (ubuntu) with Plesk 12.
For information - that´s my first experience with a linux-server. So maybe I forgot some extra configurations, but I think if the page gets loaded, the tomcat should not be the problem)
I also can´t find any "usefull" logs from catalina or tomcat...
var/log/tomcat7/catalina.out
var/log/apache2/error.log
But if someone needs to see the logs, I will post them..
Please help :(
Thanks, Fab
EDIT: I have tried to run the application on a local running tomcat -> And it works... so it´s a server-side problem?
I had installed Websphere Liberty Runtime in a Windows 7 machine following the instructions here :
https://developer.ibm.com/wasdev/downloads/liberty-profile-using-non-eclipse-environments/
I had installed and configured the admin-center feature following these instructions :
http://www-01.ibm.com/support/knowledgecenter/SSD28V_8.5.5/com.ibm.websphere.wlp.core.doc/ae/twlp_ui_setup.html
I set two users : admin and nonadmin
I am able to connect to this server from Eclipse in another computer.
However, each time i try to deploy an application on this server, i get this error in the computer with Eclipse :
Publish HelloWorldApplication
OK
Failed to transfer application HelloWorldApplication
CWWKX0121E: Access denied to path C:/wlp/usr/servers/servername/apps/HelloWorldApplication.war.
Failed to synchronize server configuration.
CWWKX0121E: Access denied to path C:/wlp/usr/servers/servername/server.xml.
Deployment of application HelloWorldApplication failed.
And, in the server i got this :
[ERROR ] CWWKX7901E: The C:/wlp/usr/servers/servername/apps/HelloWorldApplication.war file system path is not valid.
Can anyone help me, please ?
We are more than one developer needing to work on this server.
Thanks in advance.
SJRM
How do you have your server.xml configured? Given the error you mention, I think it's missing the configuration for writing into the remote directories, which looks something like this:
<remoteFileAccess>
<writeDir>${writePath}</writeDir>
</remoteFileAccess>
You can define several write directories and each one can refer to variables or absolute paths, for example:
<remoteFileAccess>
<writeDir>${wlp.user.dir}</writeDir>
</remoteFileAccess>
You can obtain the basic configuration for remote administration by executing this command on you Liberty profile bin directory:
configUtility install remoteAdministration
For reference see:
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/t_creating_remote_server.html?cp=SSEQTP_8.5.5%2F1-3-11-0-2-3 for setting up a remote server,
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_command_configutil.html%23rwlp_command_configutil?cp=SSEQTP_8.5.5%2F1-3-11-0-3-2-1-1&lang=en for reading about the configUtility and
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/rwlp_dirs.html?cp=SSEQTP_8.5.5%2F1-3-11-0-2-0&lang=en for a list of Liberty profile properties and their corresponding directories.
I installed dspace on my windows 7 machine and everything works fine.Even the admin account was created.But after deploying it on my tomcat it gives 404 error.I followed installation tutorial given on dspace website.Am I missing something.Please help
Did you follow the steps in deploying web applications? There are two techniques in having Tomcat serve up your web applications.
Below was taken from DSpace online documentation:
Technique A. Tell your Tomcat/Jetty/Resin installation where to find
your DSpace web application(s). As an example, in the directory
[tomcat]/conf/Catalina/localhost you could add files similar to the
following (but replace [dspace]with your installation location):
DEFINE A CONTEXT FOR DSpace XML User Interface: xmlui.xml
<?xml version='1.0'?>
<Context
docBase="[dspace]/webapps/xmlui"
debug="0"
reloadable="true"
cachingAllowed="false"/>
Technique B. Simple and complete. You copy only (or all) of the
DSpace Web application(s) you wish to use from the [dspace]/webapps
directory to the appropriate directory in your Tomcat/Jetty/Resin
installation. For example: cp -R [dspace]/webapps/* [tomcat]/webapps*
(This will copy all the web applications to Tomcat). cp -R
[dspace]/webapps/jspui [tomcat]/webapps* (This will copy only the
jspui web application to Tomcat.)
Also check your Tomcat logs for any errors.
what is your dspace version? im use 5.4
[dspace-source] mvn package
all success!
[dspace-source/dspace/target/dspace-installer]ant fresh_install
all success!
Init database[optional]
c:/dspace-installed/bin dspace-migrate
c:/dspace-installed/bin create-administrator
success!
copy all or the essentials[JSPUI,XMLUI,OAI,SOLR] app from [Dspace-installed/webapps] to tomcat-webapps
start tomcat.be happy!
I have developed an java ear that i deploy from my local eclipse to my local websphere 8.5 by using the publish button in eclipse. When I try to deploy my ear from command line I get an error after I try to access the webpage.
I update my ear from common line like this:
${was.dir}/profiles/${was.profile}/bin/wsadmin.sh -lang jython -username ${was.username} -password ${was.password} -c AdminApplication.updateApplicationUsingDefaultMerge('${was.app.name}', '${build.dir}/${ear.name}')
The deployment is successful but when I access my application thru my web browser I get the following message instead of seeing my application:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /wwww/index.html
I have verified that the ear is ok by updating it thru the web admin interface of websphere without any configuration.
What am I doing wrong or what additional steps do I need to do to successfully update my ear?
You are using wrong command. You should use something like this:
AdminApp.update('MyAppEAR', 'app', '[ -operation update -contents
MyApp.ear -nopreCompileJSPs -installed.ear.destination C:\WAS\MyAppEAR
-nodistributeApp -useMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -noprocessEmbeddedConfig -filepermission ..dll=755#..so=755#..a=755#..sl=755
-noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -noenableClientModule -clientMode isolated -novalidateSchema -MapModulesToServers [[ MyApp MyApp.war,WEB-INF/web.xml WebSphere:cell=Node02Cell,node=Node02,server=server1 ]]]' )
Also, in WebSphere Application Server you can log every command you issue through Administrative Console.
Steps
login to admin console with administrative user (e.g. wasadmin)
click "System Administration" -> "Console Preferences"
check "Enable command assistance notifications" and "Log command assistance commands"
click Apply button to save changes
You can see commands in help portlet on the upper-right side of admin console:
If you checked "Log command assistance commands", you can also see jython commands in a log file "<WAS_HOME>\profiles\<PROFILE_NAME>\logs\server1\commandAssistanceJythonCommands.log"
I'm not sure about updateApplicationUsingDefaultMerge vs update (the latter is what I use), but don't forget you also have to AdminConfig.save() after you're finished.
I have deployed a Scala, play framework, application on Heroku.
And I have added the new relic add-on to my app.
I have followed the Java guide as Scala runs on the Java VM.
$ heroku addons:add newrelic:standard
-----> Adding newrelic:standard to ... done, v7 (free)
Unziped newrelic to newrelic in the application
$ git add newrelic
$ git commit -m 'add newrelic'
$ heroku config:add JAVA_OPTS='-Xmx384m -Xss512k -XX:+UseCompressedOops -javaagent:newrelic/newrelic.jar'
$ git push heroku master
Now to the problems. First when I accessed the add on I had to create a new account on new relic with new password and it wanted my credentials? Is this correct? Shouldn't my Heroku account suffice, I later think it started to work.? Strange process so now I believe I have two accounts. In Herokus page my account is standard hourly and in new relics it's standard lite.
I don't understand how to see my performance stats. I actually think that the new relic isn't set up correctly?
One absurd thing is the new relics homepage which says not sufficient permissions on everything except "tell a friend and earn bucks" not even support works WTF.
I have attached two screenshot with my credentials masked. can anyone comment if they look like they should or if the new relic has set up itself incorrectly?
You should be able to use New Relic through the heroku interface without creating a separate account.
Once you're app is deployed with the agent, and has gotten a few requests you should start seeing data in the interface.
The agent does create a log (I believe you can get output via heroku logs) so that might also help you troubleshoot it.
I'd suggest opening a support ticket on http://support.newrelic.com.
This could be happening because your hosted application does not have the right credentials (e.g license key) provided by newrelic.
Did you update the default newrelic.yml file obtained from the 'newrelic.jar' extract? You can obtain your app's license key in the account settings menu when accessing newrelic through the heroku interface (your 1st screenshot). Then set the following config vars on heroku;
NEW_RELIC_LICENSE_KEY="your license key"
NEW_RELIC_APP_NAME="your app name"
Don't forget to set the appropriate RACK_ENV config var too e.g RACK_ENV=production
Then update your newrelic.yml file by finding and changing the following lines;
license_key: '<%= license_key %>' to license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>'
app_name: My Application to app_name: '<%= ENV["NEW_RELIC_APP_NAME"] %>'
app_name: My Application (Development) to app_name: '<%= ENV["NEW_RELIC_APP_NAME"] (Development) %>'
app_name: My Application (Staging) to app_name: '<%= ENV["NEW_RELIC_APP_NAME"] (Staging) %>'
Here is a sample newrelic.yml file with environment vars set.
You should be able to access new relic from heroku interface after you've pushed your changes.
Check whether you find anything in the heroku logs with heroku logs. Also, you can increase the log level of new relic by setting the system properties newrelic.config.log_level and newrelic.debug. Also note that after creation of a new account or after password changes it takes a while until the changed credentials are propagated.
To set a finer log log level:
$ heroku config:set JAVA_OPTS=”-Xmx384m -Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -javaagent:target/staged/newrelic-agent-2.20.0.jar -Dnewrelic.bootstrap_classpath=true -Dnewrelic.config.file=./conf/newrelic.yml newrelic.config.log_level=finer newrelic.debug=true”
Make sure to not run with that in production. It produces quite a lot of logs.
See our blog post about how to setup New Relic with Play 2.1/Scala on Heroku: http://techblog.nezasa.com/2013/08/performance-monitoring-of-nezasa-with.html
When I attempted to use New Relic on Heroku I was prompted to enter credit card information
$ heroku addons:add newrelic:standard
but I just exited out and the logging for my Rails application is working*. Note that depending on your New Relic settings you may just be logging locally (default for development mode does not log to the cloud but is accessible locally).
Sorry to pollute this thread with Ruby stuff, but you may find something similar with regards to Heroku and New Relic.
*update: I had the same issue again when deploying another application and realized that to use the Heroku New Relic add-on you have to provide credit card information, but if you just directly instrument your application you do not have to give credit card information. YOu do have to have created an account already, though.