Springboot hangs after removing logback-classic dependency - java

I am working with a SpringBoot project. Initially, when I am running the application I was getting the "multiple bindings" warning and no log files were getting created but the application started taking the log-back classic dependency and ignoring the slf4j-log4j12 artifact (Both are child dependencies of spring-boot-starter-logging which is in turn a child of spring-boot-starter). However, once I excluded the logback-classic artifact it has started to hang at the line INFO: Initializing Spring embedded WebApplicationContext and no log files are being generated. In this project I see that log4j is being used and the web.xml has been entirely commented out. Is the hanging of the application at startup related to any of the above actions or conditions?
Thanks in advance for the help. Please note that I am new to SpringBoot and nothing seems to work in this framework as mentioned in the docs so I am a bit frustrated as well. Any help will be really appreciated.

Related

Invalid logger interface org.hibernate.internal.EntityManagerMessageLogger

I am doing JPA without persistence.xml (without Spring Boot) and instead used the PersistenceUnitInfo to create the entity manager. When running the application from my IDE, there are no errors, but it logs sensitive persistence unit information. I've struggled to disable the logging.
It gets worse, when I run it from the command line, I get the following:
Kindly assist, I've lost quite a few hours to this one.
The issue you encounter is a classloading issue during initialization of your EntityManager on your JBoss application environement.
Disabling the logging will not fix this error, but hide it. Check your deployment classpath, and your JDK version. And verify that all required hibernate libraries are present. You can check which libraries you need on the classpath by looking at the dependencies on a site such as mvnRepository (example: https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core/6.0.2.Final).
Are you using a dependency manager, such as Maven or Gradle?

Spring application fails to start with ActiveJDBC instrumented classes

I am using Java 8, ActiveJDBC 1.4.13 and Spring Boot 2.0.0.RC1 with Spring 5.
On application startup I am getting this error:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: FooActiveModel.class;
This problem appeared when I upgraded from Spring Boot 2.0.0.M7 to 2.0.0.RC1.
I have found a few references to this error but no mention of ActiveJDBC. In my case classes extended from the activejdbc.Model class (instrumented classes) are causing the problem.
As per answers and suggestions in these...
SPRING4: Failed to read candidate component class CouchbaseConfig.class
Server fails to start, Spring throws BeanDefinitionParsingException
BeanDefinitionStoreException Failed to read candidate component class
ArrayOutOfBoundsException on Bean creation while using Java 8 constructs
I have...
made sure I'm using Java 8
searched for conflicting dependencies
cleaned and rebuilt my project
deleted local maven repo that "might" have been corrupted
re-imported all the dependencies
upgraded all dependencies to their latest version
These options did not help.
Finally managed to solve this problem by excluding the problematic classes(the ones extended from activejdbc.Model that were being instrumented) from the spring component scan.
To make sure that this was actually the reason for the error, I even reverted to my original pom.xml with all my previous dependency versions, re-imported everything, cleaned, rebuilt and sure enough I'm no longer having this issue.
This was an extremely frustrating and time consuming problem, hope it helps somebody.

NoSuchMethodError with spring ConfigurableListableBeanFactory.clearMetadataCache and multi module maven project

I get this log when I run webapp under tomcat 7.0.63:
[localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.clearMetadataCache()V
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:185)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:673)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:519)
This webapp works out fine when I deploy it simply exporting war with classical option in eclipse.
But when I build with maven in a multi module fashion. I got above errors on execution.
Could anyone give me some hint or direction in order to solve this issue?
Spring version in use is 4.2.0.RELEASE.
I don't use Spring Boot.
Check whether you have added the spring-web dependency in the POM.xml as the dependencies are required while building a MAVEN project. Hope you solve it.

Spring Boot App no longer logging to eclipse(STS) console

I've just combined several rest service projects into a a gradle multi-project. In order to do this I created a new workspace and imported everything after configuring my build.gradle for each project.
Most of the applications were able to start correctly using run as spring boot application however now in this new workspace nothing is being logged to the console. I was able to see the logs before in my old workspace.
I am using compile('org.projectlombok:lombok:1.16.6') in my parent build.gradle with the #Slf4j annotation which generates a logger field to write to the log in my classes.
Everything seemed to just work before and now I'm not sure what happened that is preventing logging.
Any help is appreciated
-Thanks

Avoid getting slf4j from maven

Maven uses slf4j, so as soon as it is launched, it initializes it with its default implementation contained into apache-maven-3.3.9\lib\slf4j-simple-1.7.5.jar and with configuration file defined in apache-maven-3.3.9\conf\logging\simplelogger.properties.
After that it loads the pom file and found my jetty-maven-plugin which launch a webapp. But in this webapp I want to use a different implementation for slf4j, but I can't because slf4j is already initialized.
I understand that maven is mainly a tool for build and not to launch apps, but I can't modify log configuration of apache-maven for each project to get pretty logs for each of them.
Is someone already face this issue and find a way to avoid that?
Note:
run-forked instead run works but in this case I can't no more debug from eclipse so I prefer an another solution.
older version of maven works as 3.0.3 because it didn't used slf4j

Categories