I'm developing a simple web app that i need to deploy to Azure as an App Service.
It's a Spring Boot project and i've followed the instructions from this website:
https://learn.microsoft.com/en-us/java/azure/spring-framework/deploy-spring-boot-java-app-with-maven-plugin
I've done few changes, like adding some configuration to pom.xml so that the right subscription is chosen. When i run mvn azure-webapp:deploy it completes without errors and i see a bunch of stuff is uploaded. But when i visit my site at the given url xxx.azurewebsites.net all i get is a Error 404. I even tried the Azure Toolkit for Intellij, it completes successfully but site still gives error.
I've watched hours of youtube videos and lots of tutorials on this and i can't see that i've missed any steps.
Combining the steps in the official tutorials and my deployment procedure, I provide the following check points for you:
Point 1: Please use mvn package to bulid the JAR package in the directory under which the pom.xml file is located.
]
Point 2: Please make sure that the jar package name configured in web.config is the same as the uploaded jar package name.
web.config
<?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"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\<your project name>"">
</httpPlatform>
</system.webServer>
</configuration>
Point 3: Please use FTP to publish jar files and web.config to D:\home\site\wwwroot\ directory on KUDU.
Point 4: Please make sure ApplicationSettings matches your project such as jdk version,tomcat version.
If you want to deploy a war file, you need to configure the ApplicationSettings of your app service on Azure portal, then upload the war file into the path D:\home\site\wwwroot\webapps.
In addition, you could check the log files on KUDU : https://<your project name>.scm.azurewebsites.net/DebugConsole.
As references, please refer to the documents and threads below.
1.Configure web apps in Azure App Service
2.Create a Java web app in Azure App Service
3.Deploying Springboot to Azure App Service.
Hope it helps you.
Related
I want to deploy a Spring boot application in an external Tomcat server version 9. I am able to deploy it and working the endpoints also. But properties I have set in application.properties file those are not working. Like server.servlet.context-path=/myapp is is not working instead the context path which I am getting is http://localhost:8080/myapp-0.0.1-SNAPSHOT/api/ping.
I am using 2.3.10.RELEASE and Java 1.8 and Tomcat version 9.0.46 Can anyone please help me out with this.
But everything is perfectly working on embedded tomcat. Thanks in advance and any suggestion, comment is highly appreciated.
Can anyone please help me with how I can do this - My war file name would be myapp-0.1.war but the context path of the application would be like this localhost:8080/myapp/api/ping
Use finalName property in your build file (pom.xml for maven)
<finalName>myapp</finalName>
When you run a Spring Boot application in an external servlet container, the server.* properties do not apply.
If you are willing to change the naming convention you can drop a WAR file named myapp##0.1.war in the $CATALINA_BASE/webapps directory and benefit from parallel deployment (cf. parallel deployment).
If you want to stick to your naming convention, you can create a folder for your WAR files (e.g. $CATALINA_BASE/webapps-available) and create a deployment descriptor $CATALINA_BASE/conf/<engine_name>/<host_name>/<context_path>.xml (in your case probably $CATALINA_BASE/conf/Catalina/localhost/myapp.xml) with the following content:
<Context docBase="${catalina.base}/webapps-available/myapp-0.1.war" />
I made an AngularJs application that just uses my REST api backend (built in Java and deployed on Wildfly).
I made my servers accessible from the Internet using my public IP address (through port-forwarding).
My question is how can I make the Angular application accessible as well from the Internet using my public IP. Can I also deploy it on Wildfly? How do I do that?
If you don't want to deploy a WAR/EAR, try defining a handler in your standalone.xml configuration file:
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/yourapp" handler="static"/>
</host>
</server>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
<file name="static" path="/var/yourapp" directory-listing="true"/>
</handlers>
You could package your angular application in the same application as your REST backend API.
For example, if you package your REST api within a .war package, you could put your anglar application files (html pages, js scripts, ...) in your WAR package root, and your REST resources in WEB-INF/lib directories packaged as JAR files.
See WAR packaging details here.
Then to query your REST api, you just have to provide the resource URI, not the base URL (including webapp context), as angular app belongs to the webapp which also exposes your REST api.
For example, if you want to get one of your resource, you can do like this with angular: (with your REST API using 'rs' path in application config and using $http angular service)
$http.get('rs/icecreams?flavoor=strawberry')
I have an angular2 app whith routes, and was necessary an additional configuration. This is the process:
In the root module enable use hash for your routes:
RouterModule.forRoot(routes, { useHash: true })
Build the application, the simple way is ng build other options in angular-cli build
The build process generates angular app in "dist" folder in root of angular app. Copy all files inside dist folder to root of your WAR file.
Acces to angular app in http://SERVER_IP:PORT/WAR_PATH/#/. All routes for angular app start from #/.
Is it possible to override the root context specified in WEB-INF/jboss-web.xml at deploy time?
I have this jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>my-context</context-root>
</jboss-web>
And I want to be able to deploy the application with different root context in in e.g. /another-context for some of my environments, but keep /my-context in other environments.
You can do this via WildFly Maven Plugin (as part of your CI job) or using the WildFly CLI.
The maven variant would be like the following command:
org.wildfly.plugins:wildfly-maven-plugin:deploy-only
-Dwildfly.deployment.filename=app.war
-Dwildfly.deployment.runtime.name=appcontext.war
The app will be deployed under /appcontext.
Note, you should remove the context-root from your jboss-web.xml otherwise this value will win always.
The CLI variant could look like (documentation):
[dply#as wildfly-8.2.0.Final]$ bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone#localhost:9990 /] deploy /path/to/app.war --runtime-name=appcontext.war
For doing this, you could combine maven profiles (e.g. "my-context" and "another-context") and maven resource filtering as explained here: Maven resource filters
It certainly takes a little bit of time until everything works as expected.
if you have a EAR file you need to define it at your application.xml
<module>
<web>
<web-uri>webapp.war</web-uri>
<context-root>/my-context</context-root>
</web>
</module>
I downloaded JBoss Application Server 5 and successfully deployed a war file. I copypasted the Hello.war which has a simple index.jsp file into
\jboss-5.1.0.GA-jdk6\jboss-5.1.0.GA\server\default\deploy
and it worked fine.
However when I used JBoss AS 7 and deployed the war file here, it did not get executed.
jboss-as-7.0.0.Final\jboss-as-7.0.0.Final\standalone\deployments
How to deploy it?
EDIT: I googled it but was not able to find info as JBoss AS 7 is relatively new.
Actually, for the latest JBOSS 7 AS, we need a .dodeploy marker even for archives. So add a marker to trigger the deployment.
In my case, I added a Hello.war.deployed file in the same directory and then everything worked fine.
Hope this helps someone!
Read the file $AS/standalone/deployments/README.txt
you have two different modes : auto-deploy mode and manual deploy mode
for the manual deploy mode you have to placed a marker files as described in the others posts
for the autodeploy mode : This is done
via the "auto-deploy" attributes on the deployment-scanner element in the
standalone.xml configuration file:
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir"
path="deployments" auto-deploy-zipped="true" **auto-deploy-exploded="true"**/>
I built the following ant-task for deployment based on the jboss deployment docs:
<target name="deploy" depends="jboss.environment, buildwar">
<!-- Build path for deployed war-file -->
<property name="deployed.war" value="${jboss.home}/${jboss.deploy.dir}/${war.filename}" />
<!-- remove current deployed war -->
<delete file="${deployed.war}.deployed" failonerror="false" />
<waitfor maxwait="10" maxwaitunit="second">
<available file="${deployed.war}.undeployed" />
</waitfor>
<delete dir="${deployed.war}" />
<!-- copy war-file -->
<copy file="${war.filename}" todir="${jboss.home}/${jboss.deploy.dir}" />
<!-- start deployment -->
<echo>start deployment ...</echo>
<touch file="${deployed.war}.dodeploy" />
<!-- wait for deployment to complete -->
<waitfor maxwait="10" maxwaitunit="second">
<available file="${deployed.war}.deployed" />
</waitfor>
<echo>deployment ok!</echo>
</target>
${jboss.deploy.dir} is set to standalone/deployments
Can you provide more info on the deployment failure? Is the application's failure to deploy triggering a .war.failed marker file?
The standalone instance Deployment folder ships with automatic deployment enabled by default. The automatic deployment mode automates the same functionality that you use with the manual mode, by using a series of marker files to indicate both the action and status of deployment to the runtime. For example, you can use the unix/linux "touch" command to create a .war.dodeploy marker file to tell the runtime to deploy the application.
It might be useful to know that there are in total five methods of deploying applications to AS7. I touched on this in another topic here : JBoss AS7 *.dodeploy files
I tend to use the Management Console for application management, but I know that the Management CLI is very popular among other uses also. Both are separate to the deployment folder processes. See how you go with the other methods to fit your needs.
If you search for "deploy" in the Admin Guide, you can see a section on the Deployment Scanner and a more general deployment section (including the CLI): https://docs.jboss.org/author/display/AS7/Admin+Guide
Just copy war file to standalone/deployments/ folder, it should deploy it automatically. It'll also create your_app_name.deployed file, when your application is deployed. Also be sure that you start server with bin/standalone.sh script.
open up console and navigate to bin folder and run
JBOSS_HOME/bin > stanalone.sh
Once it is up and running just copy past your war file in
standalone/deployments folder
Thats probably it for jboss 7.1
I am using JSF2 with Websphere 7 . I have created a shared lib successfully and have pointed application using Webpsphere Admin Console and it works successfully . But what we really want to do is to not have to point to that Shared Lib via WAS Admin Console but have some sort of application level configuration e.g in deployment.xml etc which we can point to the name of that Shared Isolated Lib and use it . I have gone through SO and google but not found any thing doing that . I however know that there are commercial application doing it but do not know how . This question from How can I specify a shared library reference at the web module level in Websphere 6.1 deployment descriptors? is closely what I am after but I not want to specify version numbers or jar names as the answer states
I found a way by simply following what WAS Admin Console was actually doing.
Create a deployment.xml in your EAR file if you do not have one already .
You will find a reference to class loader like below
<classloader xmi:id="Classloader_1311552732281" mode="PARENT_FIRST">
Modify it and add reference to the shared Liberary created on server like below
<classloader xmi:id="Classloader_1311552732281" mode="PARENT_FIRST">
<libraries libraryName="JSF2_SHARED_LIB" sharedClassloader="true"/>
</classloader>
#dbreaux has also shown a way .Accpeting my own answer as fits my needs better but big thanks to dbreaux too for advice.
Is the issue just that you don't want to have to configure each application separately, or that you don't want to use the admin console at all? You can associate a shared library with an entire server, which might be preferable to doing it for each app.
The other way to create those application associations is in the WebSphere-specific .xmi deployment files. These are created when you deploy but can also be included in WAR/EAR files. I don't know if that would help you at all. If it would, the official way to create them ahead of time is using one of the Deployment Tools, but since they're just XML, you may feel comfortable creating them manually.
To append extra details to Shahzeb's answer:
My environment: Websphere 8.5; Windows 7;(Eclipse Luna to generate testing .war file)
I have installed the war file exported from eclipse on websphere server by websphere console.
Then exported it again and unpack it to see what websphere automatically add to it to generate EAR.
[folder]META-INF
[folder]ibmconfig
[file]application.xml
[file]ibm-application-bnd.xmi
[file]ibm-application-runtime.props
[file]MANIFEST.MF
[file]was.module
[file]was.policy
[file]was.webmodule
[file]myWAR.war
And the file deployment.xml is placed in
..\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\
whose content in form of
<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1417052686904">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1417052686904" deploymentId="0" startingWeight="1" binariesURL="$(APP_INSTALL_ROOT)/[server service name]Cell/myWAR.ear" useMetadataFromBinaries="false" enableDistribution="true" createMBeansForResources="true" reloadEnabled="false" appContextIDForSecurity="href:[server service name]Cell/myWAR" filePermission=".*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755" allowDispatchRemoteInclude="false" allowServiceRemoteInclude="false" asyncRequestDispatchType="DISABLED" standaloneModule="true" enableClientModule="false">
<targetMappings xmi:id="DeploymentTargetMapping_1417052686904" enable="true" target="ServerTarget_1417052686904"/>
<classloader xmi:id="Classloader_1417052686904" mode="PARENT_FIRST"/>
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1417052686904" deploymentId="1" startingWeight="10000" uri="myWAR.war" containsEJBContent="0">
<targetMappings xmi:id="DeploymentTargetMapping_1417052686905" target="ServerTarget_1417052686904"/>
<classloader xmi:id="Classloader_1417052686905"/>
</modules>
<properties xmi:id="Property_1417052686904" name="metadata.complete" value="true"/>
</deployedObject>
<deploymentTargets xmi:type="appdeployment:ServerTarget" xmi:id="ServerTarget_1417052686904" name="server1" nodeName="[server service name]"/>
</appdeployment:Deployment>
(Since I have no reputation, I have to do it all in text.. )