3

Using spring boot war build during the start up of the application in the tomcat

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/scheduling/quartz/SpringBeanJobFactory.class] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180)

even though it exists as a dependency

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

And also spring-context-support

There are no issues with spring boot jar build and run

How to fix the issue for the war deployment?

This is what I get when debugging jar file - maybe this might help: (with war file ClassNotFoundException)

enter image description here

Iurii Dziuban
  • 1,091
  • 2
  • 17
  • 31
  • The `SpringBeanJobFactory` is found in the `spring-context-support` dependency. What version are using? – Babajide M. Moibi Nov 21 '18 at 14:09
  • +- org.springframework.boot:spring-boot-starter-quartz:jar:2.0.6.RELEASE:compile [INFO] | +- org.springframework:spring-context-support:jar:5.0.10.RELEASE:compile – Iurii Dziuban Nov 21 '18 at 14:14
  • the class is inside it. Spring boot jar file runs without an issue. The issue occurs only when I build it as war and deploy on the separate tomcat. However the dependency is present. Have no clue. – Iurii Dziuban Nov 21 '18 at 14:16

3 Answers3

0

I'm not sure, it's just suggestion:

Try to add dependencies:

    <!--Quartz-->
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz-jobs</artifactId>
        <version>2.2.1</version>
    </dependency>

NOTE: It's just a way to 'hot fix'. And it is not a complete solution.

0

Figured out the issue. As I was running Tomcat from the IntelliJ Idea and new dependencies introduced to the project were not reflected. Needed to remove and reimport war/war exploded into Tomcat configuration - no issues.

Iurii Dziuban
  • 1,091
  • 2
  • 17
  • 31
0

Try to add the following dependency (if you want you can set Spring version by yourself):

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${spring.version}</version>
</dependency>
Giacomo Brunetta
  • 1,409
  • 3
  • 18
  • 38