I'm developing an API on Spring Boot using Vault and Mongo, but it refuses to start.
2022-09-07 13:58:56.510 WARN 23885 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.vault.config.VaultReactiveBootstrapConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.cloud.vault-org.springframework.cloud.vault.config.VaultProperties': Could not bind properties to 'VaultProperties' : prefix=spring.cloud.vault, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
2022-09-07 13:58:56.513 INFO 23885 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-07 13:58:56.521 ERROR 23885 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath
EDIT: I think the problem is that Spring Boot tries to use javax and jakarta at the same time according to this part of the error:
nested exception is javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found.. Is this a normal behavior?
Consider to bypass the problem: try to add compile 'de.flapdoodle.embed:de.flapdoodle.embed.mongo' to your build.gradle, and #Bean public MongoClient embeddedMongoClient() to return a dummy Mongo client during the Init phase.
The real mongo Url could be fetched (and used) from the Vault later, during run time, once required, via a customized extends of spring-data-mongodb's MongoDbFactory.
Adding hibernate-validator 6 and spring-boot-starter-validation solved the problem.
Thing to know: hibernate-validator < 7 uses Javax, hibernate-validator => 7 uses Jakarta.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.4.Final</version>
</dependency>
Related
When I run my webapp with Eclipse IDE (Right click + run as Java application)
I have the following error :
2018-08-14 15:58:17.381 WARN 7324 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'actionServiceImpl' defined in file [D:\dfsdfdsfdsfsfsfsf\target\classes\com\showyou\service\impl\ActionServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.showyou.service.mapper.ActionMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Does anybody has an idea ? I followed all the required steps : https://www.jhipster.tech/configuring-ide-eclipse/
I'm trying to set up a simple cloud stream Sink but keep running into the following errors.
I've tried several binders and they all keep giving the same error.
"SEVERE","logNameSource":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","message":"
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method binderAwareRouterBeanPostProcessor in org.springframework.cloud.stream.config.BindingServiceConfiguration required a bean of type '[ Lorg.springframework.integration.router.AbstractMappingMessageRouter;' that could not be found.
Action:
Consider defining a bean of type '[ Lorg.springframework.integration.router.AbstractMappingMessageRouter;' in your configuration.
I'm trying to use a simple Sink to log an incoming message from a kafka topic
#EnableBinding(Sink.class)
public class ReadEMPMesage {
private static Logger logger =
LoggerFactory.getLogger(ReadEMPMesage.class);
public ReadEMPMesage() {
System.out.println("In constructor");
}
#StreamListener(Sink.INPUT)
public void loggerSink(String ccpEvent) {
logger.info("Received" + ccpEvent);
}
}
and my configuration is as follows
# Test consumer properties
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.group-id=testEmbeddedKafkaApplication
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.ByteArrayDeserializer
# Binding properties
spring.cloud.stream.bindings.output.destination=testEmbeddedOut
spring.cloud.stream.bindings.input.destination=testEmbeddedIn
spring.cloud.stream.bindings.output.producer.headerMode=raw
spring.cloud.stream.bindings.input.consumer.headerMode=raw
spring.cloud.stream.bindings.input.group=embeddedKafkaApplication
and my pom
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
TL;DR - check your version of Spring Boot and try upgrading it a few minor revs.
I ran into this problem on a project after upgrading from Spring Cloud DALSTON.RELEASE to Spring Cloud Edgware.SR4 -- it was strange because other projects worked fine but there was a single one that didn't.
After further investigation I realized that the troublemaker project was using Spring Boot 1.5.3.RELEASE and others were using 1.5.9.RELEASE
After upgrading Spring Boot to 1.5.9.RELEASE things seemed to start working
I have a WSDL file located under src\main\resources\wsdl\ folder and it is having multiple operations defined within it. My application is running on Weblogic 12C server. I'm trying to expose the SOAP web-service using Apache Cammel (version: 2.18.3) with Java DSL -
I have written below code under configuration method of my RouteBuilder class -
CxfComponent cxfComponent = new CxfComponent(getContext());
CxfEndpoint serviceEndpoint = new CxfEndpoint("/soap/Manage_Order", cxfComponent);
serviceEndpoint.setAddress("http://<IP>:<PORT>/myproject/soap/ManageOrder_Details");
serviceEndpoint.setServiceClass(
"Fully qualified service interface name generated from WSDL file using maven with #WebService annotation");
serviceEndpoint.setEndpointName(<end point name defined in the service class with #WebEndpoint annotation>);
serviceEndpoint.setDataFormat(DataFormat.MESSAGE);
serviceEndpoint.setDefaultOperationName("manageOrder");
getContext().addEndpoint("myServiceEndPoint1", serviceEndpoint);
from("cxf:myServiceEndPoint1").log("Hi, I am here").end();
While I'm deploying the application, it is throwing below exception -
weblogic.application.ModuleException: java.lang.IllegalArgumentException: serviceClass must be specified
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException: serviceClass must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:311)
at org.apache.camel.component.cxf.CxfEndpoint.createServerFactoryBean(CxfEndpoint.java:663)
at org.apache.camel.component.cxf.CxfConsumer.createServer(CxfConsumer.java:70)
at org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:66)
at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:252)
Truncated. see log file for complete stacktrace
pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-soap</artifactId>
<version>2.18.3</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.18.3</version>
<!-- use the same version as your Camel core version -->
</dependency>
As the error says, you have not mentioned the service class and endpoint names.serviceEndpoint.setServiceClass("Fully qualified service interface name generated from WSDL file using maven with #WebService annotation");
serviceEndpoint.setEndpointName(<end point name defined in the service class with #WebEndpoint annotation>);
Step 1: Generate the service from your wsdl using wsdl2java command or your choice of IDE.
Step 2: Have that in your code classpath
Step 3: Mention the class name and endpoint names in the above piece of code
I have a Spring Boot MVC project. It works fine with h2 database and also fine in local postgre database with following application.properties configuration
spring.datasource.url=myUrl
spring.datasource.username=myUsername
spring.datasource.password=myPassword
But when I am trying to deploy it in Heroku it is getting this following error:
Caused by: org.hibernate.HibernateException: Access to
DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
If I use this configuration
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=herokuPostgreSqlDbUrl
spring.datasource.username=herokuUsername
spring.datasource.password=mherokuPassword
I am getting this when try to run my project from STS and failed deployment.
Caused by: java.sql.SQLException: Driver:org.postgresql.Driver#17a3dff6
returned null for URL:myUrl
My pom is :
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1206-jdbc42</version>
</dependency>
Can any body help ?
You need a proper JDBC url. See: https://springframework.guru/configuring-spring-boot-for-postgresql/
I have a pretty simple service that is returning a 500 error - here's the details on the error:
[EL Info]: 2013-11-01 11:09:05.61--ServerSession(741529784)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
[EL Info]: 2013-11-01 11:09:06.452--ServerSession(741529784)--file:/C:/Users/Fred/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/cheese-ws/WEB-INF/lib/cheese-jpa.jar_cheese login successful
34442 [http-bio-8080-exec-1] ERROR org.apache.wink.server.internal.handlers.FlushResultHandler - The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the java.util.Vector type and application/json mediaType. Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
34446 [http-bio-8080-exec-1] INFO org.apache.wink.server.internal.RequestProcessor - The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error) with message 'null' while processing GET request sent to ...
The code is pretty straightforward and very similar to other services that work fine:
public class StudentTeacherCommunicationService extends BaseService {
#GET
#Path("classroomId/{classroomId}/studentId/{studentId}")
#Produces(MediaType.APPLICATION_JSON)
public List<ClassroomStudentCommunication> getCandidatesAsJson(#PathParam("classroomId") int classroomId, #PathParam("studentId") int studentId) {
EntityManager em = createEM();
TypedQuery<ClassroomStudentCommunication> query;
if(studentId==0) {
query = em.createQuery("SELECT csc FROM ClassroomStudentCommunication csc where csc.classroomId = :classroomId ORDER BY csc.threadOrder", ClassroomStudentCommunication.class);
query.setParameter("classroomId", classroomId);
List <ClassroomStudentCommunication> classCommunication = query.getResultList();
return classCommunication;
Any ideas?
This seems to be a Rest problem not a JPA problem.
If you happen to use Maven and generated the project with an archetype or IDE, it is worth to check the generated pom.xml. JSON support can be turned off by default in the pom.xml.
For example if you use Jersey and your project is generated with jersey-quickstart-webapp archetype then you should uncomment the following section manually in the pom.xml:
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
-->