• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Spring boot doesn't load context of child project

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic