JaversException COMPONENT_NOT_FOUND: JaVers bootstrap error - component of type 'org.javers.core.CommitIdGenerator' not found in container - javers

Using javers-core 3.9.7 I am facing this error when building javers. What exactly does this error message mean? javers doc doesn't have a description for it.
JaversBuilder.javers().withPackagesToScan("<omitted>").build();
JaversException COMPONENT_NOT_FOUND: JaVers bootstrap error - component of type 'org.javers.core.CommitIdGenerator' not found in container

This appears to have been reported here
https://github.com/javers/javers/issues/684
and
https://github.com/javers/javers/issues/682
and possibly fixed here
https://github.com/javers/javers/pull/683
A workaround suggested was to register the repository when building javers. For example:
JaversBuilder.javers().registerJaversRepository(new InMemoryRepository(CommitIdGenerator.RANDOM)).build();
This worked for me.

Fixed is released in javers 3.10.1, see https://github.com/javers/javers/issues/682

Related

Upgrading to Springboot 3: 'org.springframework.hateoas.server.LinkRelationProvider' that could not be found

I am upgrading my springboot app from 2.7.x to 3.0.0, I have made required changes for jakartaEE. When starting my app I am getting the below error
{"#timestamp":"2023-01-03T15:28:01.149Z","#version":"1","message":"\r\n\r\n***************************\r\nAPPLICATION
FAILED TO
START\r\n***************************\r\n\r\nDescription:\r\n\r\nParameter
1 of method collectionModelContentConverter in
org.springdoc.core.configuration.SpringDocHateoasConfiguration
required a bean of type
'org.springframework.hateoas.server.LinkRelationProvider' that could
not be found.\r\n\r\n\r\nAction:\r\n\r\nConsider defining a bean of
type 'org.springframework.hateoas.server.LinkRelationProvider' in your
configuration.\r\n","logger_name":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","thread_name":"main","level":"ERROR","level_value":40000}
I am using hateos lib for representation in my app, Also I am using springdoc-openapi-starter-webmvc-ui for swagger UI.
When I disable configuration for api-docs springdoc.api-docs.enabled=false the above error go away but my swagger page is also gone, which definitely means this is not the solution.
Could someone please guide me why this bean is not getting found with springboot 3 while it was all working before with springboot2.7.x and java-11.
here is my pom.xml https://gist.github.com/bruce2019/c93a16dc20f7edb7d922b1e284f39d15
Thanks in advance
You can use springdoc-openapi-starter-webmvc-ui with 2.0.2 version
Add "/v3/api-docs/**" to mvcMatchers in WebSecurityCustomizer

"Ambiguous search mapping detected" thrown after adding Springfox 3.0.0 to SpringBoot

I have a SpringBoot application (spring-boot-starter-parent:2.4.0) and I want to use Swagger. I followed this Baeldung-Tutorial, and I am unfortunately getting this exception on startup:
org.springframework.context.ApplicationContextException: Failed to
start bean 'documentationPluginsBootstrapper'; nested exception is
java.lang.IllegalStateException: Ambiguous search mapping detected.
This is due to the fact that I am in some cases overloading methods in my repositories as follows:
Page<Message> findByConversationId(Long conversationId, Pageable pageable);
List<Message> findByConversationId(Long conversationId);
The exception says that both methods
are mapped to /findByConversationId! Tweak configuration to
get to unambiguous paths!
Is there any way to overcome this issue ?
Thank you !
This is not an answer to your problem but it might help you.
Consider using springdoc instead of Springfox. It is a newer library that is easier to use and way less error-prone than Springfox. We moved to it 2 years ago and we are very glad we did. There is very good documentation and tutorials online for it:
https://springdoc.org/
https://www.baeldung.com/spring-rest-openapi-documentation
It is also very active and you usually get your issues answered very fast on the github page.

stomp-chat web socket with embedded tomcat reactor error - type reactor.tuple.Tuple not found

I am having problems getting web socket subscriptions to work properly using Spring with an embedded Tomcat server.
When running this stomp-chat application I get the following error:
org.springframework.messaging.MessageHandlingException: Expression evaluation failed: #chatRoomSessions[headers.simpDestination].add(T(reactor.tuple.Tuple).of(headers.simpSessionId, headers.simpSubscriptionId));
nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1005E:(pos 58): Type cannot be found 'reactor.tuple.Tuple'
I tried to add the following dependency:
compile ("io.projectreactor:reactor-stream:$reactorVersion")
but it gave the same error. Any help would be appreciated.
OK. I see the problem.
The dependency for the io.projectreactor:reactor-stream:2.0.8 isn't enough.
The Tuple class has been moved to the new reactor.fn.tuple package.
So, you still have to fix all the reactor.tuple.Tuple mentioning in the stomp-server.xml to the new reactor.fn.tuple.Tuple.
The sample will be fixed soon: https://github.com/spring-projects/spring-integration-samples/issues/185
Sorry for inconvenience.

Hibernate Validator 5 on GAE?

Is it possible to run Hibernate Validator 5.x on GAE? I try with 5.2.2.Final and when I run it I get the following exception:
java.lang.NoClassDefFoundError: java.util.ResourceBundle$Control is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.apphosting.runtime.security.shared.stub.java.util.ResourceBundle$Control.<clinit>(ResourceBundle.java)
at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator$AggregateResourceBundle.<clinit>(PlatformResourceBundleLocator.java:169)
at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.loadBundle(PlatformResourceBundleLocator.java:132)
at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.getResourceBundle(PlatformResourceBundleLocator.java:105)
at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolateMessage(AbstractMessageInterpolator.java:264)
at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolate(AbstractMessageInterpolator.java:228)
at org.springframework.validation.beanvalidation.LocaleContextMessageInterpolator.interpolate(LocaleContextMessageInterpolator.java:50)
at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:422)
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:300)
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(ValidationContext.java:261)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:456)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:127)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:592)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:555)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406)
at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204)
at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:108)
at org.springframework.validation.DataBinder.validate(DataBinder.java:866)
This issue has already been fixed in the latest master and the fix will be part of the next Hibernate Validator release. HV-1023 is the issue number in case you want to track it.

Spring - Error using "JDBCTemplate": The method "X" refers to the missing type DataAccessException

I´m developing in STS and when I´m going to use JDBC Template I´ve got several errors :S...
I´ve got my DAOImplementation and I want to redefine the JDBCTemplate, but all the methods I´m redefining returns errors like:
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
The method query(String, RowMapper) from the type JdbcTemplate refers to the missing type DataAccessException
Concretly, the methods are:
Update.
QueryForString.
Query.
I have imported all dependencies for Maven, I don´t know what is happening...
I hope you could help me, thanks for all :).
Juandi.
In spring 3 the whole jar structure has been re-organized. There is no all-in-one spring.jar as before. You have to pick what you need.
DataAccessException is in org.springframework.transaction-3.0.0.RELEASE.jar
include this jar in class path.
i had same problem add the spring-tx-XXX.jar to you project xxx means version
In spring framework 4.1, "org.springframework.transaction.xxx.jar" is to be imported instead of spring-tx-xxx.jar
Adding
org.springframework.transaction-3.0.1.RELEASE-A.jar
solve my problem
Same on my case, I used Spring-mvc 4.3.0 and have a spring-tx.4.3.0 and DataAccessException in there.
But I haved an error like your case.
Solution : I just deleted Spring-tx Folder dependency in maven repo (.m2/repository/) and update dependency again. It was solved to me.

Resources