Composed Task is giving Error in Spring cloud data flow server - spring-cloud-dataflow

When i create tasks independently they are working fine, but when i add the same tasks to composed task it is giving below error
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataFlowOperations' defined in class path resource [org/springframework/cloud/task/app/composedtaskrunner/DataFlowConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.dataflow.rest.client.DataFlowOperations]: Factory method 'dataFlowOperations' threw exception; nested exception is java.lang.IllegalArgumentException: URI is not absolute
I followed the steps mentioned here : https://dataflow.spring.io/docs/2.3.x/feature-guides/batch/composed-task/#registering-composed-task-runner
This error i am getting only from SCDF server, hosted in pcf.
I am able to execute the composed task in my local scdf server.
This is the DSL i am trying
timelabel1: timestamp && timelabel2: timestamp

I am able to resolve this by passing below argument while launching task
--arguments "--dataflow-server-uri=https:<data-flow-serrver-url>"

Related

Spring cloud gateway and outh2

I have a legacy web application that I want to secure it by using a Spring cloud gateway with Outh2.
Without Outh2, the Spring cloud gateway worked with the following application.yml
spring:
cloud:
gateway:
routes:
- id: my_route
uri: http://MyLegacyServer:8080
predicates:
- Path=/**
But when I added the keycloak definition to it like the following
keycloak:
auth-server-url: http://localhost:8083/auth
realm: xxx
resource: login-app
public-client: true
I was getting the following error when at start
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration$SpringMvcFoundOnClasspathConfiguration': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration$SpringMvcFoundOnClasspathConfiguration]: Constructor threw exception; nested exception is org.springframework.cloud.gateway.support.MvcFoundOnClasspathException
I haven't used keycloak before but when you look at the nested exception within the one that says the application couldn't start because a bean could not be instantiated, you see MvcFoundOnClasspathException.
Spring Cloud gateway is a reactive framework. It is in opposition to the Spring Mvc model. "The main difference between the two frameworks is that spring-mvc is based on thread pools, while spring-webflux is based on event-loop mechanism."
If you want to protect a resource using oauth, Spring Security is webflux-compatible.

Neoload how to connect tibco server. Getting Cannot instantiate class: om.tibco.tibjms.TibjmsQueueConnectionFactory Error

I am using Neoload for performance testing but getting the
Blockquote
the following error while connecting to the Tibco server.
Could not create JNDI API initial context: javax.naming.NoInitialContextException: Cannot instantiate class: om.tibco.tibjms.TibjmsQueueConnectionFactory [Root exception is java.lang.ClassNotFoundException: om.tibco.tibjms.TibjmsQueueConnectionFactory]java.lang.ClassNotFoundException: om.tibco.tibjms.TibjmsQueueConnectionFactory
I am using the following parameters
initialContextFactory (required): com.tibco.tibjms.TibjmsQueueConnectionFactory
providerURL (required): tibjmsnaming://10.106.29.215:5222
connectionFactory (required): QueueConnectionFactory
destination (required): myqueuename
tibjms.jar is missing in the class path.
Please check the class path again .

Spring Cloud Dataflow scriptable-transform fails for python language

Recently, I download the 1.7.0 release and tried to deploy the following
stream create amqp-to-hdfs --definition "mqtt-source-rabbit
--username=admin --password=pwd --url=/path/to/host--topics=dmj/ccs/sms/stream |
scriptable-transform --language=python --script='return \"payload\"' |
hdfs --fs-uri=hdfs://path/to/hdfs:9000 --directory=/path/to/recording --file-name=ingest"
However, this failed to start due to the following issue:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorConfiguration':
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformer' defined in
org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorConfiguration:
Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: javax.script.ScriptEngineManager is
unable to create a script engine for language 'python'
This is odd because I do have python installed and if I change the language and script values to ruby-based code, everything works. However, I need to use Python for this task.
Any ideas
The scriptable transformer will require you to have function declared and you will call that function at the end of the function defination
def myFunction(firstVar, lastVar):
return firstVar +" some addition "+ lastVar;
myFunction("First ", " Second ")

Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean

I'm trying to deploy a simple webapp with an embedded instance of Jetty. My embedded test code is:
public static void main(String[] args) throws Exception{
Server server = new Server(8181);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setWar(ContUtil.warPath + ContUtil.warName);
server.setHandler(webAppContext);
logger.info("starting jetty...");
server.start();
server.join();
}
but I got the following error:
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir/webapp/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 23 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/Program%20Files%20(x86)/apache-maven-2.2.1/repo/org/apache/struts/struts2-core/2.2.1/struts2-core-2.2.1.jar!/struts-default.xml:29:72 - bean - jar:file:/C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir/webapp/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
... 26 more
I've referenced many similar answers about this problems, for example: Struts2 Error when Deploying: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory; Most of the similar problems are caused by jar packages conflict of different versions. But my problem is a little different. I ensure that there is only one version of struts2-core (2.2.1) in my classpath.
I checked the error message, I think that jetty creates a tmp file, that is: /C:/Users/lingguo/AppData/Local/Temp/jetty-0.0.0.0-8181-MemCloud-Web-1.0-SNAPSHOT.war-_-any-6830790104248388668.dir,and the jar struts2-core-2.2.1 is confict with the jar in my local maven repository.
Could anybody know where is going wrong? Thanks in advance!

javax.servlet.ServletException: Filter [sitemesh]: could not be initialized when deploying grails 2.11 app to WebSphere 8.5 liberty profile?

When I try and deploy my grails application to a WebSphere 8.5 liberty profile server I get the following error message.
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
I've set up a parent last class loading policy for my application. The same war file deploys with no problems to tomcat located on the same server. Any ideas of what could be causing this and how to work around it? I've pasted the full stacktrace below.
Error Page Exception
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
Original Exception:
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack:
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:903)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4173)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Root cause:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102)
at org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper.init(GrailsLayoutDecoratorMapper.java:48)
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:110)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:903)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4173)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Error Page Exception:
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
Error Code: 0
Target Servlet:
Error Stack:
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:906)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3650)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4203)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4184)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
Root cause:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102)
at org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper.init(GrailsLayoutDecoratorMapper.java:48)
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:110)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:579)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:480)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:299)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:372)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:906)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1036)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3650)
at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4203)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4184)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:302)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.handleRequest(DynamicVirtualHost.java:296)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1006)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$1.run(DynamicVirtualHost.java:253)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:457)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:722)
WebSphere 8.5 Liberty Profile does not expand WARs upon deployment, and surprisingly quite a few web applications heavily depend on the feature. That's what has led to your case.
I'm pretty sure you deployed the Grails web application as a WAR.
The solution is quite simple - deploy the web application expanded and the issue goes away.
To prove my thought I ran the sample from 2.3 Creating an Application. When I deployed it, the error message you faced was indeed displayed in the browser and the logs.
jacek:~/sandbox/helloworld
$ cp target/helloworld-0.1.war ~/apps/wlp/usr/servers/libertyGrails/dropins/
What you overlooked though was the line in the logs when it asked whether the web archive is expanded.
Caused by: java.io.FileNotFoundException: ServletContext resource
[/WEB-INF/grails-app/i18n/messages.properties] cannot be resolved to
absolute file path - web application archive not expanded? ... 20
more
I redeployed the web application (a mere rm with unzip -d afterwards), and the welcome page displayed properly.
jacek:~/sandbox/helloworld
$ rm ~/apps/wlp/usr/servers/libertyGrails/dropins/helloworld-0.1.war
jacek:~/sandbox/helloworld
$ unzip -d ~/apps/wlp/usr/servers/libertyGrails/dropins/helloworld-0.1.war target/helloworld-0.1.war
jacek:~/sandbox/helloworld
$ open http://localhost:9080/helloworld-0.1

Resources