Missing #ConditionalBean on StormpathWebMvcAutoConfiguration.stormpathApplicationResolver - spring-boot

While trying to add Stormpath to my existing Spring-Boot application, I have the following error on startup.
java.lang.IllegalStateException: Error processing condition on com.stormpath.spring.boot.autoconfigure.StormpathWebMvcAutoConfiguration.stormpathApplicationResolver
...
Caused by: java.lang.IllegalArgumentException: #ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)
My pom :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<stormpath.version>1.1.1</stormpath.version>
</properties>
<dependencies>
<dependency>
<groupId>com.stormpath.spring</groupId>
<artifactId>stormpath-default-spring-boot-starter</artifactId>
<version>${stormpath.version}</version>
</dependency>
</dependencies>

The stormpath version 1.1.1 works with spring-booth 1.4. I solved the problem by changing the spring-boot-starter-parent version to 1.4.1.

Related

I want to extend WebSecurityConfigurerAdapter but it had been deprecated

I'm trying to code a website using spring boot(security, jpa, web...) and i'm following this tutorial.
And in the minute : 1:05:25 , he needs to extend the WebSecurityConfigurerAdapter, but it had been deprecated in the last spring boot versions, so he changes the version in his "pom.xml" from :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
To :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Then he saves all and updtaes the project. And when I do the same I get errors in my pom.xml file in the parent tag:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
with the error : Coul not read maven project ...
And I get an error in this dependancy :
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
The error is :
3.0.0+
The <dependency> element contains information about a dependency of the project.
Source: maven-4.0.0.xsd`
I also get this error in my console :
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
While in the video, he doesn't get errors at all.
So I would like to solve the problem by modifying something in my pom.xml and keeping that application.

Compilation Failure : cannot access LoggingEventAware [ERROR] class file for org.slf4j.spi.LoggingEventAware not found on mvn clean install -U

I have upgraded the spring boot version from 2.3.5 to 2.7.5 , resolved most of the dependency versions. But when i do the maven clean install , i received the compilation failure error : cannot access LoggingEventAware
[ERROR] class file for org.slf4j.spi.LoggingEventAware not found
But i do not see any error in the java file - LoggingConfiguration.java.
When i just do reload of project to resolve all the dependencies - it gives error for maven plugin : Cannot resolve plugin org.apache.maven.plugins:maven-release-plugin:3.1.1
I am not sure what is the issue. I have tried to restart IntelliJ after invalidate cache and also cleared the .m2 repository .Nothing helps. Please suggest your inputs how to resolve the same.
Here is the sample 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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-release-plugin.version>3.1.1</maven-release-plugin.version>
<maven-scm-provider-gitexe.version>1.9.5</maven-scm-provider-gitexe.version>
<junit.platform.version>4.13.0</junit.platform.version>
<logback-json-classic>0.1.5</logback-json-classic>
<logback-jackson.version>0.1.5</logback-jackson.version>
</properties>
</project> ```
While updating a project to Spring Boot 3.0.1, I came across the same issue.
Here is what worked for me:
Exclude logback-classic sub-dependency of spring-boot-starter-web.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
Add an earlier dependency of logback with version 1.2.11
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
</dependency>

resolve dependencies for maven project spring

pom.xml admin-service
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-adminpanel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sai-edm-adminpanel</name>
<description>sai-edm-adminpanel</description>
<properties>
<java.version>17</java.version>
</properties>
pom.xml authorization service(which depends on the admin service)
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-auth</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sai-edm-auth</name>
<description>sai-edm-auth</description>
<properties>
<java.version>17</java.version>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>com.springframework</groupId>
<artifactId>sai-edm-adminpanel</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
when deploying the project gives me an error "Failed to execute goal on project sai-edm-auth: Could not resolve dependencies for project com.springframework:sai-edm-auth:jar:0.0.1-SNAPSHOT: Could not find artifact com.springframework:sai-edm-adminpanel:jar:0.0.1-SNAPSHOT in spring-milestones (https://repo.spring.io/milestone) -> [Help 1]"
The project is launched locally, the problem is only when deploying, tell me what could be the problem, please
Firstly, you cannot use the groupId "com.springframework" at it is not yours. See the Maven Guide. So for both artifacts sai-edm-adminpanel and sai-edm-adminpanel change the groupId to something you own.
Secondly, remove the compile scope line.
Thirdly, make sure that you have sai-edm-adminpanel artifact installed in your local m2 repository. You can find your local repo under ~/.m2/repository/. If you cannot find it there, you first must install it by going to the sai-edm-adminpanel pom.xml and running mvn clean install.

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()

Spring Boot Application
I am making a Tag Reader Application where am keep Getting This issue
Note: i am not using any Property file input
This my Simple Spring boot application
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class RfidReaderApplication {
public static void main(String[] args) {
SpringApplication.run(RfidReaderApplication.class, args);
}
}
*Pom.xml *
This pom configursation that i am using to build project and also have one external jar for OctaneSDKJava because it not reader OctaneSDKJava jar form pom so i added externally
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.Amazin.RFID.Reader</groupId>
<artifactId>RFID-Reader</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>RFID-Reader</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.octane</groupId>
<artifactId>OctaneSDKJava</artifactId>
<version>1.32.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Error Msg that i am getting
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:285)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:102)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:220)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:199)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.Amazin.RFID.Reader.RfidReaderApplication.main(RfidReaderApplication.java:10)
As shown through the post linked in the comments, you are possibly missing some SLF4J dependencies. Another possibility, however, is that your dependencies actually have different versions of SLF4J, but since only one can be used there is a clash. See this SO post as well.
I would recommend explicitly using spring-boot-starter-log4j2 since you are using spring boot and going from there.

Spring project error using thymeleaf, Compilation failure. How can I fix this?

I'm pretty new at Spring framework, and I try to start a project for practice.
But I have an error and I have no idea how to fix this.
I've created a new Spring project in IntelliJ Idea, with Spring Initializr option (In Intellij, not with start.spring.io ). I added only 2 dependedncies for start (Web and Thymeleaf), but it throws error for Thymeleaf dependency if i run it with
'mvn spring-boot:run' command.
My spring project is "empty" , I have no controllers, beans, jpa entites, etc.. but it i think it shound run in this way too. I just wanted to make sure if it works if I run it.
If I create a same project, without Thymeleaf dependency (only Web dependency), it starts correctly on localhost.
I'm using Java 9.0.4 and Apache Maven 3.5.3
My error log
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>com.example</groupId>
<artifactId>demo_thymeleaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo_thymeleaf</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>9</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I solved it with deleting the whole C\Users\user.m2 directory.
After then with 'mvn spring-boot:run' it started successfully on localhost.
But I've got one more question:
When I run it, at terminal there are a couple of Warning messages.
Spring application runs anyway, but is there something to do with these messages?
Warning messages during Spring application run.

Resources