I am facing a problem when i startup the server with spring configuration. I am using spring with Zk - spring

I am facing a problem when i startup the server with spring configuration. I have got the Following Error
I am using spring with Zk and I use zkspring-core 3.0RC
ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zkTypePropertyEditor': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.HashMap' to required type 'java.util.Map' for property 'customEditors'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.Class] to required type [java.lang.String] for property 'customEditors[class java.lang.Class]': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
...
thanks

This is a known bug in ZK Spring 3.0 RC:
http://code.google.com/p/zkspring/issues/detail?id=3&can=1
It is already fixed. You can download the freshly version (Aug. 10 version) to try it:
http://code.google.com/p/zkspring/downloads/list
Henri Chen
The ZK Team
http://www.zkoss.org

We had the same problem with Spring 3.1.0-RELEASE with Apache CXF 2.7.4:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Contact' defined in class path resource [DoMappings/EAI/do-contact-mapping.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.LinkedHashMap' to required type 'java.util.Map' for property 'doFieldNameToDsFieldNameMap'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map] for property 'doFieldNameToDsFieldNameMap[name]': no matching editors or conversion strategy found
We had to switch to Spring 3.1.1-RELEASE to fix the issue.

Related

Error with Springboot 2.4.0 incompatible versions

I have followed the below link and have updated the dependent jar versions respectively for spring boot 2.4.0.
But I get the following error while starting the service:
o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException.
Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'newRelicMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'newRelicMeterRegistry' parameter 2;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'newRelicClientProvider' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [io.micrometer.newrelic.NewRelicClientProvider]:
Factory method 'newRelicClientProvider' threw exception; nested exception is io.micrometer.core.instrument.config.validate.ValidationException: Multiple validation failures:
management.metrics.export.newrelic.apiKey was 'null' but it is required when publishing to Insights API
management.metrics.export.newrelic.accountId was 'null' but it is required when publishing to Insights API
So, I would like to understand where I will get compatible versions while upgrading to 2.4.0?
For example, I have updated these versions:
io.micrometer.micrometer-core // v1.6.2
io.micrometer.micrometer-registry-new-relic // v1.6.2
io.micrometer.micrometer-registry-prometheus // v1.6.2
spring.cloud.version // v2020.0.0-M6
org.springframework.cloud.spring-cloud-starter-sleuth // v2.2.5.RELEASE
redisson.version // v3.12.2
I am not familiar with the use of "io.micrometer.micrometer-registry-new-relic" api. But the problem looks like some validations are getting failed because of wrong value. Make sure your registry parameters are correct to get through the validations. Below is napshot of error from your error log.
nested exception is io.micrometer.core.instrument.config.validate.ValidationException: Multiple validation failures: management.metrics.export.newrelic.apiKey was 'null' but it is required when publishing to Insights API management.metrics.export.newrelic.accountId was 'null' but it is required when publishing to Insights API.
Also refer below link if that can help.
https://discuss.newrelic.com/t/error-with-micrometer-and-newrelic-with-springboot2/55988

Spring Boot application WAR deployment to Resin 4: is there a way to use app (WEB-INF/lib) classloader first?

I'm trying to deploy Spring Boot app as a WAR to Caucho Resin 4. I'm getting an error on hitting the app:
org.springframework.context.ApplicationContextException: Unable to
start embedded container; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration'
: Bean instantiation via constructor failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$
$EnhancerBySpringCGLIB$$58b91c9d]: Constructor threw exception; nested
exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'dashboardResource' defined in file
[/var/resin/webapps/itasng-0.8.5/WEB-INF/classes/gov/nih/cit/itasng/
rest/DashboardResource.class]: Unsatisfied dependency expressed through
constructor parameter 0; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'payPeriodRepository' defined in file
[/var/resin/webapps/itasng-0.8.5/WEB-INF/classes/gov/nih/cit/itasng/
persistence/PayPeriodRepository.class]: Unsatisfied dependency
expressed through constructor parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.orm.jpa.SharedEntityManagerCreator#0': Cannot
resolve reference to bean 'entityManagerFactory' while setting
constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'entityManagerFactory' defined in class path resource
[org/springframework/boot/autoconfigure/orm/jpa/
HibernateJpaAutoConfiguration.class]: Invocation of init method failed;
nested exception is java.lang.NoSuchMethodError:
javax.persistence.Table.indexes()[Ljavax/persistence/Index; at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext
.onRefresh(EmbeddedWebApplicationContext.java:137)
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE]
...
It's obvious that this is a typical class-loading issue: classes loaded by the parent class-loader from Resin lib (e.g. lib/javaee-16.jar) cause issues for the app built with newer versions (e.g. WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar).
Most app servers that I used before have a setting somewhere in a vendor specific –web.xml descriptor to switch the classloader order so that WEB-INF/lib classes load first. However, the Resin docs don't really have an easy answer if such an option exists.
Is there a way to switch class loading order in Resin 4 or what would be an alternative solution?
In Resin 4.0 there is no way to use app classloader first.
Potential workarounds for related classloading issues could involve using
the <jvm-classpath> which has precedence over Resin's classpath.
An example use case is to use later versions of JPA instead of JPA 2.0, which is deployed out-of-the-box.
Documentation reference:
http://www.caucho.com/resin-4.0/admin/cluster-config.xtp#jvm-classpath

Cache Busting in Spring Boot + Thymeleaf application

I read spring boot documentation and it seems that if I am using Thymeleaf, I can just add the following to my application.properties file to achieve cache busting:
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
But it doesn't work!
This is the error that I see:
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.ResourceProperties org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.resourceProperties; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.resources.CONFIGURATION_PROPERTIES': Could not bind properties to [unknown] (target=spring.resources, ignoreInvalidFields=false, ignoreUnknownFields=false, ignoreNestedProperties=false); nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'chain[strategy][fixed][version]' of bean class [org.springframework.boot.autoconfigure.web.ResourceProperties]: Cannot access indexed value in property referenced in indexed property path 'chain[strategy][fixed][version]'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'chain[strategy][fixed][version]' of bean class [org.springframework.boot.autoconfigure.web.ResourceProperties]: Bean property 'chain[strategy][fixed][version]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
What am I missing?
The problem was with the version of spring boot I was using. Spring Boot 1.2 doesn't have any such properties while 1.3 does.

Need guidance on Introduction to Spring JMS Active MQ

I am following "I coding blog" which is very good for someone like me who wants to get into Spring, JMS and ActiveMQ.
When I run TestJMSListener as a java application, I am getting following error:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [com/jms/helloworld/config/JMSConfig.xml]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'brokerurl' of bean class [org.apache.activemq.ActiveMQConnectionFactory]:
Bean property 'brokerurl' is not writable or has an invalid setter method.
Does the parameter type of the setter match the return type of the getter?
I do not know how to fix it, below is my JMSConfig.xml file:
your xml file here.
According to the documentation the property is called brokerURL, not brokerurl. Spring helpfully reported the cause of the problem in the exception message.

ERROR org.springframework.web.context.ContextLoader - Context initialization failed

I am new please help me where the exact problem is.
ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/dataAccessContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: could not init listeners
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
It has happened the same error, then I realized it happens when I change the structure of the database and update the JPA annotations manually, and was a detail that escaped me, to solve what I did was create again all mappings of entities automatically (this I did with NetBeans wizard) and problem solved.
Also this article has detailed instruction on Spring 3.1 and Hibernate 4.1 integration

Resources