1

I am new to Spring boot and getting ClassNotFoundException while running simple Spring Boot Web application. I have verified maven local repository but issue is still arising. Here is my pom.xml:

<groupId>com.tb</groupId>
<artifactId>igweb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>igweb</name>

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

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <tomcat.version>8.5.0</tomcat.version>
</properties>

<dependencies>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- JSTL tag lib -->
    <dependency>
      <groupId>javax.servlet.jsp.jstl</groupId>
      <artifactId>javax.servlet.jsp.jstl-api</artifactId>
      <version>1.2.1</version>
    </dependency>

    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>

    <!-- Tomcat for JSP rendering -->
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-jasper</artifactId>
      <scope>provided</scope>
    </dependency>

</dependencies>

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


</project>

And my main class is: package com.tb.igweb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class IgwebApplication {

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

While running same on eclipse, I am getting following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: 
    org/springframework/util/ClassUtils
    at 
 org.springframework.boot.SpringApplication.deduceWebEnvironment(SpringApplication.java:257)
    at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:248)
    at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:225)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at com.tb.igweb.IgwebApplication.main(IgwebApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.util.ClassUtils
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more
saurabh2208
  • 72
  • 1
  • 1
  • 7
  • The question is not generic only to java Jarrod. I am facing problem while developing with Spring Boot – saurabh2208 Nov 22 '17 at 09:19
  • 1
    Dependencies issue, some of your dependencies are conflicting, check the versions. – ivoruJavaBoy Nov 22 '17 at 09:23
  • I have verified maven dependencies and have purged maven local repositories as well – saurabh2208 Nov 22 '17 at 09:28
  • run "mvn dependency:tree" and check if if you have one single version of Spring, if yes check the compatibility between the version you are using and the other libs you are using, look on google for specific Spring version specyfing the error you are having...guess you did it already but don't just clean the project, delete M2 local, sometime this can help, even if in your case I don't think this last thing is gonna help.. – ivoruJavaBoy Nov 22 '17 at 09:31
  • Thanks @ivoruJavaBoy for understanding and supporting my question. As you have mentioned, I executed "mvn dependency:tree" and found out spring version to be "4.3.12.RELEASE". Since I am using .jsp pages, can this problem be related to packaging? – saurabh2208 Nov 22 '17 at 09:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/159567/discussion-between-ivorujavaboy-and-saurabh2208). – ivoruJavaBoy Nov 22 '17 at 09:53

0 Answers0