0
votes

The application is deployed in pivotal web services and when I hit the application with the link https://webstore.cfapps.io/, the login.jsp page is not rendered.

The same application runs successfully in the local server. I tried for searching the same issue but none of them solve the problem. I used both STS deployment and also tried cf command line for deploying separately but couldn't get the result.

I am giving you the details.

  1. The error shown.

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Sat Jan 14 04:21:40 UTC 2017 There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/login.jsp

  1. My pom file is

    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

    ecommerce.com webstore 0.0.1-SNAPSHOT jar

    ecommerce-webstore Demo project for Spring Boot

    org.springframework.boot spring-boot-starter-parent 1.4.2.RELEASE

    UTF-8 UTF-8 1.8

    org.springframework.boot</groupId> spring-boot-starter-security</artifactId> </dependency> --> org.springframework.boot spring-boot-starter-web

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>
    
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <scope>test</scope>
    </dependency>
    
    
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    

    org.springframework.boot spring-boot-maven-plugin

3.MY application.properties file is

spring.mvc.view.prefix:/WEB-INF/jsp/

spring.mvc.view.suffix: .jsp

spring.datasource.url= jdbc:mysql://localhost:3306/ecommercestore

spring.datasource.username=root

spring.datasource.password=root

spring.jpa.hibernate.ddl-auto=update

3.The manifest.yml generated after deployment is applications:

  • name: webstore

    memory: 1024M

    host: webstore

    domain: cfapps.io

    buildpack: standard buildpack provided in git hub. I am not writing link

    services:

    • cleardb

The result after giving the following command from cmd is

cf push webstore -p target/webstore-0.0.1-SNAPSHOT.jar --no-start

...................................................................... C:\Users\santosh dahal\Desktop\excellerant\ecommerce-webstore>cf push webstore -p target/webstore-0.0.1-SNAPSHOT.jar --no-start

Creating app webstore in org santosh-org / space Myspace as [email protected]... OK

Using route webstore.cfapps.io Binding webstore.cfapps.io to webstore... OK

Uploading webstore...

Uploading app files from: C:\Users\SANTOS~1\AppData\Local\Temp\unzipped-app904639435

Uploading 478.9K, 140 files

Done uploading OK

6. I went to myapp in pivotal and started the application after binding the database cleardb to the same instant and application, the application runs successfully with the Running Status

7. the folder arrangement is as follows:

I have kept jsp pages in src/main/webapp/WEB-INF/jsp/login.jsp

While the application.properties is in src/main/resources.

I will provide more details if needed. the github link for the code is

here

1

1 Answers

1
votes

you are packaging it as a jar not as a war . In that case put your jsp files into static folder under resources or follow the below the link to understand better on the packaging aspect. But I feel it is better to package it as a war

Package a spring boot application including JSPs and static resources.

Also please check the jar generated before pushing the app to PWS whether jsp is avaibale at the requested path.