Spring boot fiegn client - spring-cloud-feign

Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'feignEncoder' defined in org.springframework.cloud.openfeign.FeignClientsConfiguration:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate [feign.codec.Encoder]: Factory method 'feignEncoder' threw exception; nested exception is
java.lang.NoClassDefFoundError: feign/form/FormEncoder

This happened due to incorrect dependency jars. I deleted my local .m2 folder and build the project again and it is working fine now.

Related

How to trigger task using spring cloud stream and pass white listed properties

I have create the stream as below
1.stream create SampleClaimInjestTask --definition "triggertask --triggertask.uri=file://D:/ClaimReportBatch/target/ClaimReportBatch-0.0.1-SNAPSHOT.jar --trigger.fixed-delay=60 --triggertask.environment-properties=spring.datasource.url=jdbc:postgresql://localhost:5432/scdf,spring.datasource.username=postgres,spring.datasource.password=postgres | task-launcher-local --authentication-token-u-r-l=http://10.73.122.140:9040/api/authenticate --rest-post-api-u-r-l=http://10.73.122.140:9040/api/claim-report-transactions --processed-file-folder=D:/processed --csv-file-path=D:/local-files --json-config-path=D:/remote-files"
2.stream deploy --name SampleClaimInjestTask
3.Stream SampleClaimInjestTask deployed successfully
4 task-launcher trigger the task.But those properties not set in BatchConfigurationProperties.class
Error log:
018-10-18 15:32:12.744 ERROR 9360 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'readClaimReportCSVFilesJob' defined in class path resource [com/ev/fincloud/fdp/ClaimReportBatch/config/ClaimReportBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method 'readClaimReportCSVFilesJob' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileProcessingStep' defined in class path resource [com/ev/fincloud/fdp/ClaimReportBatch/config/ClaimReportBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Step]: Factory method 'fileProcessingStep' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multiResourceItemReader' defined in class path resource [com/ev/fincloud/fdp/ClaimReportBatch/config/ClaimReportBatchConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.item.file.MultiResourceItemReader]: Factory method 'multiResourceItemReader' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.19.RELEASE.jar!/:4.3.19.RELEASE]

Error creating bean with name 'defaultKieStatelessSession'

The following error I am getting when deploying the application on AWS. This is working fine when the application is deployed on in house tomcat server. The location of path where it is unable to get byte contains file with proper read permisson. I am using grails drools 1.1.1 plugin with tomcat 7 and grails 2.4.4
Any help will be appreciated.
ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'defaultKieStatelessSession': Cannot resolve reference to bean 'defaultKieBase' while setting bean property 'kBase'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieStatelessSession': Cannot resolve reference to bean 'defaultKieBase' while setting bean property 'kBase'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultKieBase': Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to get bytes for: /var/lib/tomcat7/webapps/ROOT/WEB-INF/classes/ScaffoldingGrailsPlugin$_closure2.class
... 5 more
Instead of using grails drools plugin, used directly drools package through maven, which took care of this issue.

Can't find configured AuditLog domain error while configuring Auditlog plugin for Grails 2.4.4

I am trying to add the auditlog plugin but when server stars I get the error Cant find configured Auditlog domain and the server shuts down.
[ERROR] 2015-11-10 15:22:04,561 org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEventController]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find configured AuditLog domain: groovy.util.ConfigObject#5bb5d623
And this is how I added in the my buildconfig.groovy
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
compile ":audit-logging:1.1.0-SNAPSHOT"
As described in the docs (http://plugins.grails.org/plugin/audit-logging), you must perform
grails audit-quickstart your.package.YourAuditLogEvent>
to create the audit-log Domain class in your project and to configure this class in Config.groovy.
BTW: 1.1.0 is released, already.

Searchable grails plugin ClassNotFoundException: org.apache.lucene.analysis.Analyzer$TokenStreamComponents

i'm using the searchable 0.6.9 plugin with grails 2.4.4 and on my development machine (Windows/IntelliJ IDEA) everything works fine. Deploying it on my Tomcat on linux, however, gives me the following error:
...
2014-12-01 10:20:46,066 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grails.plugin.searchable.SearchableController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer$TokenStreamComponents
at org.compass.core.lucene.engine.analyzer.CoreAnalyzerBuilderDelegate.buildAnalyzer(CoreAnalyzerBuilderDelegate.java:47)
at org.compass.core.lucene.engine.analyzer.DefaultLuceneAnalyzerFactory.createAnalyzer(DefaultLuceneAnalyzerFactory.java:81)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.buildAnalyzer(LuceneAnalyzerManager.java:225)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.buildAnalyzers(LuceneAnalyzerManager.java:133)
at org.compass.core.lucene.engine.analyzer.LuceneAnalyzerManager.<init>(LuceneAnalyzerManager.java:67)
at org.compass.core.lucene.engine.LuceneSearchEngineFactory.<init>(LuceneSearchEngineFactory.java:119)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:124)
at org.compass.core.impl.DefaultCompass.<init>(DefaultCompass.java:117)
at org.compass.core.config.CompassConfiguration.buildCompass(CompassConfiguration.java:288)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.buildCompass(SearchableCompassFactoryBean.java:95)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:58)
at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:41)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer$TokenStreamComponents
... 17 more
It seems as if the org.apache.lucene.analysis.Analyzer class does not contain TokenStreamComponents in lucene 2.4.1 (which is a dependency of searchable 0.6.9). But as I wrote, it works fine on my development machine.
PS: On Linux the war file is built by hudson.
UPDATE:
On my dev machine it does not run as war either but run-app does. I have no clue why it tries to use a method that is not present when running as a war file.
Thanks for your help in advance.
SOLVED:
Unfortunately the solution was simple: I had the Jasper plugin installed as well and it loads lucene 4.5.1 as dependency.
By excluding it with
compile (":jasper:1.10.0") {
excludes 'org.apache.lucene:lucene-core:4.5.1'
excludes 'org.apache.lucene:lucene-analyzers-common:4.5.1'
excludes 'org.apache.lucene:lucene-queryparser:4.5.1'
}
everything works as expected.

SLF4J exception when deploying to weblogic

We've started getting the following exception when deploying to Weblogic:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'alertService': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailService': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailMessageBuilderFactory': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailMessageContentRenderer': Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'groovyPagesTemplateEngine': Cannot resolve reference to bean 'gspTagLibraryLookup' while setting bean property 'tagLibraryLookup'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grails.plugin.springsecurity.SecurityTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webInvocationPrivilegeEvaluator': Cannot resolve reference to bean 'filterInvocationInterceptor' while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterInvocationInterceptor': Invocation of init method failed; nested exception is
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;
[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
I've tried removing the slf4j jar from my ear. I've also tried putting the following in my weblogic-appliction.xml:
<prefer-application-packages>
<package-name>org.slf4j.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
</prefer-application-resources>
Nothing has worked thus far. Basically, I've tried all of the different things that I've found online. Usually, when I have a conflict with a jar that I'm providing myself and that Weblogic is also providing, just using the prefer-application-packages does the trick.
I'm using Grails 2.3.6 with Weblogic 10.3.6.
In case anyone comes across this issue, this is what my problem ended up being:
What was happening is that we were including the activemq-all artifact for JMS stuff, and this artifact is what they call an "uber" jar. It as a ton of dependencies baked into it that cannot be excluded via maven – one of those dependencies was an old version of slf4j. So, even though I had the "prefer-application-packages" set in Weblogic for slf4j, it wasn't using the Grails provided version, but rather the activemq one. Rather than using the activemq-all dependency, I switched to use individual components from activemq and was able to at that point exclude slf4j. This solved my issue.

Resources