org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found. - spring

I am trying to deploy the springboot application in Pivotal Cloud Foundry. I am getting following exception.
Caused by: org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found. Expected 1, found 0
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.rabbit.connection.ConnectionFactory]: Factory method 'rabbitConnectionFactory' threw exception; nested exception is org.springframework.cloud.CloudException: No unique service matching interface org.springframework.amqp.rabbit.connection.ConnectionFactory found. Expected 1, found 0

Try adding spring-cloud-services-starter-service-registry maven dependency.
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-service-registry</artifactId>
<version>3.1.5.RELEASE</version>
</dependency>

Related

After upgrading Spring Boot version to 2.7 Flowable engine not able create table

I have updated spring-boot-starter-parent dependency version to 2.7.1 and flowable-engine to 6.8.0
then after when I am running JUnit test cases then I am getting below error
> nested exception is org.flowable.common.engine.api.FlowableException: couldn’t create db schema: create table ACT_HI_TSK_LOG (column names .....)
..
..
..
Caused by: org.h2.jdbc.JdbcSqlNonTransmissionException: Unknown data type: "IDENTITY"; SQL Statement: create table ACT_HI_TSK_LOG (ID_ identity, TYPE_ varchar(64), TASK_ID_ varchar(64) not null, .....)
Getting same error for creating ACT_EVT_LOG table
I don't have defined or written this tables and I think this is coming from the flowable-engine dependency.
Dependencies which I have used :
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine</artifactId>
<version>6.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<type>pom</type>
</dependency>
Can someone help me on this please.
If I am using Spring 2.6.x version then it's working fine and all JUnit test cases are getting passed
GETTING BELOW ERROR AFTER UPGRADING THE SPRING-BOOT-STARTER-PARENT v2.7.7
H2 is on v1.4.200 And flowable-engine v6.8.0
Error creating bean with name 'processEngine': FactoryBean threw the exception on object creation; nested exception is java.lang.RuntimeException: Exception while initializing Database connection at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) .........
................
ommitted caused by: java.lang.RuntimeException: Exception while initializing Database connection at
...................
......................
org.flowable.spring/SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:76) at org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:59) at
org.flowable.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ... 65 common frames omitted Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The drive could not establish a secure connection to SQL Server by using Secure Socket Layer (SSL) exception. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:a31221-r15-erer-gdf45451 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680) at
com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2047) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3204) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2833) at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2671) at

Can I use Xfire with SpringBoot?

My application uses Xfire as a web service client, It a legacy system where service is written in Perl, I am modifying/rewriting application with Spring boot, when I add the Maven dependency, it shows error when I try to build
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-core</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-spring</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-aegis</artifactId>
<version>1.2.6</version>
</dependency>
[ERROR] contextLoads(com.au.cis.IPND.IpndApplicationTests) Time elapsed: 0.001 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
Caused by: java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
I don't know where database has been used
EmbeddedDatabaseType is part of spring-jdbc, so I would suggest adding the following dependency (if you do not already have it):
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
Please do adjust the version number (5.2.1.RELEASE) to match your other Spring dependencies!

Upgrade spring boot version from 1.5.13 to 1.5.19 occurred Error creating bean with name 'payloadRootAnnotationMethodEndpointMapping'

Error creating bean with name 'payloadRootAnnotationMethodEndpointMapping' defined in class path resource [org/springframework/ws/config/annotation/DelegatingWsConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError
Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError
Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
I have fixed this problem by adding the following to pom.xml:
<exclusion>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
Maybe it shouldn't have xalan in the Maven dependencies.

Getting "Error creating bean with name 'springSecurityFilterChain'" in Spring Boot

I got this error when I run the application. I tried to solve this problem by reading several posts but it makes no sense.
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
and
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.RuntimeException: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
In the exception stack trace it seems not able to find the JAXB-API . Do you have this dependency to your project - jaxb-api.
Java 11 removed the Java EE modules: java.xml.bind (JAXB) - REMOVED
You can fix the issue by using alternate versions of the Java EE technologies. Simply add Maven dependencies that contain the classes you need:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
For Details Read This StackOverflow Answer

BundleContext is no longer valid

I am having a Java web application which runs in an OSGi container. I have deployed my application on a Tomcat server. When I restart my server sometimes I am randomly getting mutiple instaces of error "BundleContext is no longer valid" and hence I am unable to deploy the application. It doesn't happen all the time when we restart our application server but happens sometimes only. The only solution we found is just to restart the server. Following is the stack trace:
org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager] : Adding
OSGi service dependency for importer [&simplyticOsgiSaeAdapter] matching OSGi filter [(objectClass=c
om.moodysanalytics.sae.simplytic.adapter.SimplyticSaeAdapter)]
[org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean] : Creating a single
service proxy ...
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (
1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource
' threw exception; nested exception is java.lang.IllegalStateException: **BundleContext is no longer valid**
org.ops4j.pax.logging.pax-logging-api[org.springframework.beans.factory.xml.BeanDefinitionParserDele
gate] : No XML 'id' specified - using 'templateElement' as bean name and [] as aliases
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAcce
ssor.java:102)
[org.springframework.beans.factory.support.DefaultListableBeanFactory] : FactoryBean threw exception
from getObjectType, despite the contract saying that it should return null if the type of its objec

Resources