ServerSymmetricEngine fails to start - java

I have an embedded Spring boot app. When I start the server
ServerSymmetricEngine serverEngine = new ServerSymmetricEngine(new File("server.properties"));
It always fails when the following error:
Error creating bean with name 'domainServerExporter' defined in class path resource [symmetric-jmx.xml]: Error setting property values
Invalid property 'registrationBehaviorName' of bean class [org.springframework.jmx.export.MBeanExporter]: Bean property 'registrationBehaviorName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
What could be the issue? I have an embedded Tomcat (In spring boot), why should I expose the jmx config?

Version 3.5 of SymmetricDS depends on Spring 3.1.2, so make sure your dependencies are correct. But, those are old versions and no longer supported.
Instead, I recommend using the latest version of SymmetricDS. The project switched Maven repositories a while back, so maybe you're just picking up old versions from Maven central. Here is the current Maven repository for SymmetricDS:
http://maven.jumpmind.com/repo/

Related

Application Deployment failing on cloud foundry due to entityManagerFactory bean creation failed

I am facing below error while deploying spring boot microservice on cloud foundry:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/ge/pd/reports/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
As I checked many resolution on stack overflow and many other portals for the solution, All the solution are related to jar version conflicts.
I have eliminated all the conflicts jar from the application and updated with all the jar versions which is required.
I am using below jar and its version:
hibernate-core-5.0.12.Final.jar - 5.0.12
hibernate-jpa-2.1-api-1.0.0.Final.jar - 2.1
hibernate-entitymanager-5.0.12.Final.jar - 5.0.12
openjpa-2.4.0.jar - 2.4.0
Please Provide the Solution.
This indeed looks like a dependency conflict, more specifically, between Hibernate 5.0.12 (which uses JPA 2.1) and OpenJPA 2.4.0 (which uses JPA 2.0). Try removing the OpenJPA dependency.
As this SO thread shows, the said method was introduced in JPA 2.1.

Spring Boot 2 Upgrade not able to resolve class name as property

We have an application where one of our internal libraries has defined a bean like this
<bean id="myBean" class="${myBean.type}"/>
We have a Spring Cloud Config Server which feeds properties to this application on startup, which also contains the property myBean.type. This setup is currently working fine with no issues. I then made the following change to my pom
Earlier
<spring.boot.version>1.5.16.RELEASE</spring.boot.version>
<spring.cloud.version>Edgware.RELEASE</spring.cloud.version>
<spring.version>4.3.19.RELEASE</spring.version>
Now
<spring.boot.version>2.0.9.RELEASE</spring.boot.version>
<spring.version>5.0.13.RELEASE</spring.version>
<spring.cloud.version>Finchley.SR2</spring.cloud.version>
Then I started getting this error on startup
An attempt was made to call the method org.springframework.beans.factory.support.BeanDefinitionBuilder.addConstructorArg(Ljava/lang/Object;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder; but it does not exist. Its class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:
jar:file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class
It was loaded from the following location:
file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder
Looking at this, I excluded the artifact org.apache.cxf:cxf-api:jar:2.7.18:compile from all the jars that depended on it & upgraded cxf jars versions to 3.2.5. Now the startup is going ahead but it is giving me the following error:
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [${myBean.type}] for bean with name 'myBean' defined in class path resource [xyz.xml]; nested exception is java.lang.ClassNotFoundException: ${myBean.type}
I am not sure if removal of cxf-api is causing this issue, or upgrade of Spring Boot 2, or is it something else that is going wrong here!

Multiple annotations found at this line: Factory bean not Found

I am building a Spring project in Spring Tool Suite(3.6.4.RELEASE).
I am trying to upgrade spring framework version from 4.0.3.RELEASE to 4.2.7.RELEASE using maven.
Before upgradation there was no error and everything running smoothly. Now project is compiling and running without error but login page is not showing and also I am getting error in my spring security configuration xml.
Error in spring-security.xml:
Showing following error on STS hovering:
Multiple annotations found at this line:
- Factory bean 'org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser
$DefaultWebSecurityExpressionHandlerBeanFactory' not found [config set: mcare-dashboard-web/web-context]
- Factory bean 'org.springframework.security.config.http.HttpConfigurationBuilder
$SecurityContextHolderAwareRequestFilterBeanFactory' not found [config set: mcare-dashboard-web/web-context]
Project Hierarchy:
My pom.xml was like following:
Then I just changed the version number like this:
After that spring-security.xml was showing the error.
Can anybody explain why is this happening?
You state that you are upgrading Spring from version 4.0.3.RELEASE to 4.2.7.RELEASE. However effectively you are upgrading both Spring and Spring Security. This due to having a single version property, named org.springframework-version, to manage both the version of the Spring and Spring Security dependencies.
So changing org.springframework-version to 4.2.7.RELEASE effectively upgrades Spring Security as well.
To fix this you want to have two distinct version properties one for Spring and another for Spring Security. You can than upgrade only Spring or Spring Security.

Constructor in org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration required a single bean, but 3 were found

I have an issue with running demo site (or admin) after configuring demo using this link
I got this error
*************************** APPLICATION FAILED TO START
Description:
Constructor in
org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration
required a single bean, but 3 were found:
- exporter: defined in class path resource [bl-common-applicationContext-mbeans.xml]
- blAutoDDLStatusExporter: defined in class path resource [bl-common-applicationContext-mbeans.xml]
- hibernateExporter: defined in class path resource [bl-common-applicationContext-mbeans.xml]
Action:
Consider marking one of the beans as #Primary, updating the consumer
to accept multiple beans, or using #Qualifier to identify the bean
that should be consumed
How can I solve issue this issue?
Please note that I am using the latest Broadleaf Commerce version (5.2)
thanks for the answers, I managed to get it to run by removing the JMX property in the configuration properties from within IntelliJ.
click on Edit Configuration (from Run Menu)
deactivate the'Enable JMX Agent' (bottom right of dialog.
Apply and run
Hope this helps.
I assume that you are running the project from the newest version of IntelliJ, 2017.2. The workaround is to disable "Enable JMX Agent" in the run configuration for the boot project.
I opened an issue for this at https://github.com/BroadleafCommerce/Issues/issues/1, this should be resolved in the next version of Broadleaf.
Try using #Qualifier annotation with the bean id you are trying to load,
#Qualifier("{bean_id_here}")
Annotate either
exporter
blAutoDDLStatusExporter
hibernateExporter
with primary="true" in your xml config files to let Spring know when bean should be the default for the Spring Admin JMX config or disable Spring Admin JMX auto-configuration by setting the spring.application.admin=false in your application.properties.

ambiguous mapping while deploying

I'm using Jenkins 1.6.20 (Git Client Plugin 1.18.0, Git Plugin 2.4.0) to get the Java application code from bitbucket.org and deploy it to Apache Tomcat 8.0.23.
The error appears while deploying and looks like:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/spr$
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
bla-bla-bla ... so many errors ...
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'positionWS' bean method
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
The problem is that the class (with annotation #Controller) PositionWS with method getEmployeePost was renamed to ResourceWS a week ago, so exists no more, so I should not get this error.
To fix this I have to create a blank PositionWS controller (with no methods in it), commit & push that to bitbucket (and delete (cus i really don't need it) later and commit & push).
It seems to be like a bug in any of the applications I use. I can't find out in which app there is a bug to report it. Tell me please, if anyone faced such problems.
The heart of the issue was in incorrect configuration of Jenkins, it was my fault.
When I was configuring Jenkins I set maven goal as "install", but it must be "clean install". According to this Jenkins never deleted old files and kept them, so got a lot of issues of different kinds and with different log messages.
Due to Jenkins working specialty it downloads project files and try to assemble it on path /var/lib/jenkins/jobs/<projectName>/workspace/target/.
So I've drop the data in this folder and afterwards set maven goal to "clean install" and that fixed the issue.

Categories

Resources