Win a copy of Head First Android this week in the Android forum!

zaghman arshad

Greenhorn
+ Follow
since Apr 13, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by zaghman arshad

Hi Guys

I'm having some issues while accessing the services of spring boot. I have two projects called "Parent Project" and Second is a Child Project. Child project added in Parent Project as a module project. So the issue is when i try to access the Parent project it works fine but it gives me error when i try access the child project services

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Apr 13 22:29:30 PKT 2016
There was an unexpected error (type=Not Found, status=404).
No message available

Here is a code of both Projects
Parent Project
@RequestMapping("/test/**")
@RestController
public class Example {

@RequestMapping(method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public String index() {
return "Hello World";
}


@Configuration
@ComponentScan
@EnableAutoConfiguration
public class HelloWorldApplication {

public static void main(String[] args) {
SpringApplication.run(HelloWorldApplication.class, args);
}


Pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dashboard</groupId>
<artifactId>com.pos.interfaces</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
</parent>

<properties>
<!-- The main class to start by executing java -jar -->
<start-class>com.walmart.pos.dashboard.backend.HelloWorldApplication</start-class>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>


</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
<module>jira-widget-app</module>
</modules>
</project>



Child Project
Example
@RequestMapping("/tester/**")
@RestController
public class Example {

@RequestMapping(method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE})
public String index() {
return "Hello World";
}



HelloWorldApplication1.java
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class HelloWorldApplication1 {

public static void main(String[] args) {
SpringApplication.run(HelloWorldApplication1.class, args);
}

Pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>walmart-dashboard</groupId>
<artifactId>com.walmart.pos.interfaces</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>jira-widget-app</artifactId>
<packaging>jar</packaging>

<properties>
<!-- The main class to start by executing java -jar -->
<start-class>com.jira.pos.widget.HelloWorldApplication1</start-class>
</properties>
</project>


When i try to access http://localhost:8080/test
it returns me Hello World on browser

However, when i try to access http://localhost:8080/tester
it Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Apr 13 22:37:17 PKT 2016
There was an unexpected error (type=Not Found, status=404).
No message available
5 years ago