3

I am getting the requested resource () is not available displayed in the browser and I can not understand what I am doing wrong.

I know, too many posts about this question but i still this error, read the official documentation did not help me spring boot maven plugin.

Is working properly on the IDE (embedded tomcat).

enter image description here

This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>netgloo</groupId>
<artifactId>spring-boot-mysql-hibernate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>spring-boot-mysql-hibernate</name>
<description> Spring Boot web application with Hibernate Spatial</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath />
</parent>

<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>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <version>9.4-1200-jdbc4</version>
</dependency>

  <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20160212</version>
  </dependency>

  <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-spatial</artifactId>
      <version>4.3</version>
  </dependency>
  <dependency>
      <groupId>org.postgis</groupId>
      <artifactId>postgis-jdbc</artifactId>
      <version>1.5.2</version>
  </dependency>
<dependency>
  <groupId>org.thymeleaf</groupId>
  <artifactId>thymeleaf-spring4</artifactId>
  <version>2.1.2.RELEASE</version>
</dependency>

</dependencies>

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <start-class>netgloo.Application</start-class>
  <java.version>1.7</java.version>
</properties>

<repositories>
 <repository>
  <id>OSGEO GeoTools repo</id>
  <url>http://download.osgeo.org/webdav/geotools</url>
 </repository>
 <repository>
  <id>Hibernate Spatial repo</id>
  <url>http://www.hibernatespatial.org/repository</url>
 </repository>
 <repository>
  <id>JBOSS</id>
  <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
 </repository>
 </repositories>

 <build>
  <plugins>
    <plugin>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-maven-plugin</artifactId>
   </plugin>
  <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
   </plugin>
  </plugins>
  <finalName>kgeo</finalName>
</build>

</project>

main Application class

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  return application.sources(Application.class);
  }
  public static void main(String[] args) {
  SpringApplication.run(Application.class, args);
}

}

main Controller

@Controller
public class MainController {

  @RequestMapping("/")
  public String index(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
  model.addAttribute("name", name);
  return "index";
  }

}

This sample work without problems java sample war

in Catalina log i can see an error

" Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;"

reading around this can be generated by a mismatch of java versions, in my editor i started with java8 and then i went down to 7, currently i'm building with maven3 that uses open-jdk 7 and Tomcat7 the same

gaia
  • 93
  • 2
  • 9
  • Can you show the url you are trying to connect to. And also, what context has it deployed under. This should be displayed on the tomCat Manager page. – jr593 May 05 '16 at 15:44
  • Hello the URL is "http://localhost:8080/kgeo/" , do you mean the tomcat7-admin package? – gaia May 05 '16 at 15:52
  • Yes, I mean the url localhost:8080/manager.. It should show you the application that you have deployed. – jr593 May 06 '16 at 14:07
  • The context path is "/kgeo", in the catalina log i show errors " Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;" – gaia May 07 '16 at 01:01
  • set both the source and target java levels in your pom.xml file to be 1.7 – DwB May 11 '16 at 19:43
  • The answer to [this question](http://stackoverflow.com/q/24448723/3080094) appears to confirm you have a Java 7 / Java 8 incompatibility. – vanOekel May 11 '16 at 21:00
  • I compiled with maven that used jdk7 but i started tomcat7 with jdk8, with this configuration i can start the app, currently i'm looking for a method to know which maven dependency in my pom uses the problematic class – gaia May 14 '16 at 23:30

0 Answers0