title: Java Webapp Deployment in Azure Service fabric explorer
body: <p>We have a stateless Java Application which I want to be deployed in Azure fabric. I have installed the Fabric SDK and Visual studio tools as per the documentation.</p>
  
  <p>After that I have created the Service Fabric application "Guest Executable" template and my project structure is like below:</p>
  
  <p><a href="https://i.stack.imgur.com/9wG4q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9wG4q.png" alt="enter image description here"></a></p>
  
  <p>I have followed steps similar to the documentation as in <a href="https://azure.microsoft.com/en-us/documentation/articles/service-fabric-deploy-existing-app/" rel="nofollow noreferrer">https://azure.microsoft.com/en-us/documentation/articles/service-fabric-deploy-existing-app/</a></p>
  
  <p>My ServiceManifest.xml is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ServiceManifest Name="Guest1Pkg"
                   Version="1.0.0"
                   xmlns="http://schemas.microsoft.com/2011/01/fabric"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;ServiceTypes&gt;
      &lt;StatelessServiceType ServiceTypeName="Guest1Type" UseImplicitHost="true" /&gt;
    &lt;/ServiceTypes&gt;
    &lt;CodePackage Name="Code" Version="1.0.0"&gt;
      &lt;EntryPoint&gt;
        &lt;ExeHost&gt;
          &lt;Program&gt;HelloWorld.war&lt;/Program&gt;
          &lt;Arguments&gt;&lt;/Arguments&gt;
          &lt;WorkingFolder&gt;CodePackage&lt;/WorkingFolder&gt;
        &lt;/ExeHost&gt;
      &lt;/EntryPoint&gt;
    &lt;/CodePackage&gt;
    &lt;ConfigPackage Name="Config" Version="1.0.0" /&gt;
    &lt;Resources&gt;
      &lt;Endpoints&gt;
        &lt;Endpoint Name="JavaAppTypeEndpoint" Protocol="http" Port="8080" Type="Input" /&gt;
      &lt;/Endpoints&gt;
    &lt;/Resources&gt;
  &lt;/ServiceManifest&gt;
  </code></pre>
  
  <p>My ApplicationManifest.xml snippet is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ApplicationManifest ApplicationTypeName="Application1Type"
                       ApplicationTypeVersion="1.0.0"
                       xmlns="http://schemas.microsoft.com/2011/01/fabric"
                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;Parameters&gt;
      &lt;Parameter Name="Guest1_InstanceCount" DefaultValue="-1" /&gt;
    &lt;/Parameters&gt;
    &lt;ServiceManifestImport&gt;
      &lt;ServiceManifestRef ServiceManifestName="Guest1Pkg" ServiceManifestVersion="1.0.0" /&gt;
      &lt;ConfigOverrides /&gt;
    &lt;/ServiceManifestImport&gt;
    &lt;DefaultServices&gt;
      &lt;Service Name="Guest1"&gt;
        &lt;StatelessService ServiceTypeName="Guest1Type" InstanceCount="[Guest1_InstanceCount]"&gt;
          &lt;SingletonPartition /&gt;
        &lt;/StatelessService&gt;
      &lt;/Service&gt;
    &lt;/DefaultServices&gt;
  &lt;/ApplicationManifest&gt;
  </code></pre>
  
  <p>I deployed to Service Fabric Explorer in my local, and the build and publish steps are good without any errors:</p>
  
  <pre><code>-------- Package: Project: Application1 succeeded, Time elapsed: 00:00:00.3530634 --------
  2&gt;Started executing script 'Deploy-FabricApplication.ps1'.
  2&gt;. 'C:\Users\samanoha\Documents\Visual Studio 2015\Projects\Application1\Application1\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'C:\Users\samanoha\Documents\Visual Studio 2015\Projects\Application1\Application1\pkg\Debug' -PublishProfileFile 'C:\Users\samanoha\Documents\Visual Studio 2015\Projects\Application1\Application1\PublishProfiles\Local.5Node.xml' -DeployOnly:$true -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'Always' -SkipPackageValidation:$true -ErrorAction Stop
  2&gt;Copying application to image store...
  2&gt;Copy application package succeeded
  2&gt;Registering application type...
  2&gt;Register application type succeeded
  2&gt;Removing application package from image store...
  2&gt;Remove application package succeeded
  2&gt;Finished executing script 'Deploy-FabricApplication.ps1'.
  2&gt;Time elapsed: 00:00:01.9327912
  ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
  ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
  
  Started executing script 'Publish-NewServiceFabricApplication'.
  [void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Publish-NewServiceFabricApplication -ApplicationPackagePath 'C:\Users\samanoha\Documents\Visual Studio 2015\Projects\Application1\Application1\pkg\Debug' -ApplicationParameterFilePath 'C:\Users\samanoha\Documents\Visual Studio 2015\Projects\Application1\Application1\PublishProfiles\..\ApplicationParameters\Local.5Node.xml' -ApplicationParameter @{_WFDebugParams_='[]'} -Action Create -SkipPackageValidation:$true -ErrorAction Stop
  Creating application...
  
  
  ApplicationName        : fabric:/Application1
  ApplicationTypeName    : Application1Type
  ApplicationTypeVersion : 1.0.0
  ApplicationParameters  : { "_WFDebugParams_" = "[]" }
  
  Create application succeeded.
  
  
  Finished executing script 'Publish-NewServiceFabricApplication'.
  Time elapsed: 00:00:01.8691591
  Started executing script 'Get-ServiceFabricApplicationStatus'.
  [void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Get-ServiceFabricApplicationStatus -ApplicationName 'fabric:/Application1' -ErrorAction Stop
  The application has started.
  Service Status:
  fabric:/Application1/Guest1 is ready.
  
  The application is ready.
  Finished executing script 'Get-ServiceFabricApplicationStatus'.
  Time elapsed: 00:00:01.0230548
  </code></pre>
  
  <p>But the application health state shows error and the event is </p>
  
  <pre><code>"Error event: SourceId='System.Hosting', Property='CodePackageActivation:Code:EntryPoint'.
  There was an error during CodePackage activation."
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PdC9P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PdC9P.png" alt="enter image description here"></a></p>
  
  <p>I don't have any idea what might be the issue here in deployment, whether anything needs to be included in Application service Entry point in addition to mentioned above.</p>
  
  <p>Also, The Java webapplication when deployed on Standalone tomcat has the following context <a href="http://localhost:8080/HelloWorld/hello" rel="nofollow noreferrer">http://localhost:8080/HelloWorld/hello</a> . If the Application is deployed in Service fabric cluster, will the URL context for this  remains same or should it be something like <a href="http://localhost:8080/Application1/Guest1/HelloWorld/hello" rel="nofollow noreferrer">http://localhost:8080/Application1/Guest1/HelloWorld/hello</a> due to the Azure fabric wrapper around it?</p>