Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make localhost app publish to CloudFoundry as is: getting Resource not Available on CF
    text
    copied!<p>I have a basic Spring web app (Spring MVC Project) that I want to run on CloudFoundry. I took the default HelloWorld project and added to it. I've installed the CloudFoundry STS extensions, got a server created, publisd my app to the CF site. The 'home' page displays both on my localhost server, and the CF servers. All good. But, when I click on the only link to take me back into the HomeController to a different method/view, I get a 'Resource not available' error on the CF server, though it works perfectly on my localhost (local PC) server.</p> <p>On my local PC:</p> <ol> <li>The url is: <code>http://localhost:8080/myapp</code> (correct)</li> <li>The initial page (home.jsp) displays with one link: <code>&lt;a href="/myapp/property"&gt;Property&lt;/a&gt;</code> (correct)</li> <li>Mousing over the link shows this in the status bar: <code>http://localhost:8080/myapp/property</code> (correct)</li> <li>Clicking takes me to the method mapped to <code>/property</code> and shows the property page (<code>property.jsp</code>). (correct)</li> </ol> <p>On CloudFoundry:</p> <ol> <li>The url is : <code>http://myapp.cloudfoundry.com/</code> (correct)</li> <li>The initial page (<code>home.jsp</code>) displays same as on my localhost PC. (correct)</li> <li>Mousing over link shows this in status bar: <code>http://myapp.cloudfoundry.com/myapp/property</code> (correct, I think).</li> <li>Clicking gets '<code>esource not available</code>.</li> <li>When I go up into the location window and remove <code>myapp</code> from the url, it works.</li> </ol> <p>Below is all the code, but I think it's just some of my own misunderstanding of the two environments, my local PC, and CloudFoundry. Hopefully, someone can educate me on what I'm not knowing here to get the apps to work in both environements--locally, and on CloudFoundry.</p> <p>Here is the HTML for home.jsp, the initial page</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;a href="/myspp/property"&gt;Property&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The HomeController is:</p> <pre class="lang-java prettyprint-override"><code>package com.myapp.app; import java.util.Locale; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.myapp.services.PropertyServicesImpl; /** * Handles requests for the application home page. */ @Controller public class HomeController { private static final String VIEW_HOME = "home"; private static final String VIEW_PROPERTY = "property"; private static final String ACQUISITIONS = "acquisitions"; @Autowired private PropertyServicesImpl propertyServices; /** * Shows home view */ @RequestMapping(value = "/", method = RequestMethod.GET) public ModelAndView home(Locale locale, Model model) { return new ModelAndView(VIEW_HOME); } /** * Shows Property.jsp with jQuery tabs. */ @RequestMapping(value = "/property", method = RequestMethod.GET) public ModelAndView property(Locale locale, Model model) { return new ModelAndView(VIEW_PROPERTY); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload