Giter VIP home page Giter VIP logo

spring-cloud-deployer-local's Introduction

Spring Cloud Connectors

Spring Cloud Connectors provides a simple abstraction that JVM-based applications can use to discover information about the cloud environment on which they are running, connect to services, and have discovered services registered as Spring beans. It provides out-of-the-box support for discovering common services on Heroku and Cloud Foundry cloud platforms, and it supports custom service definitions through Java Service Provider Interfaces (SPI).

Note
This project is in maintenance mode, in favor of the newer Java CFEnv project. We will continue to release security-related updates but will not address enhancement requests.

Learn more

Build

The project is built with Gradle. The Gradle wrapper allows you to build the project on multiple platforms and even if you do not have Gradle installed; run it in place of the gradle command (as ./gradlew) from the root of the main project directory.

To compile the project and run tests

./gradlew build

To build a JAR

./gradlew jar

To generate Javadoc API documentation

./gradlew api

To list all available tasks

./gradlew tasks

Contributing

Spring Cloud is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into master. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.

Sign the Contributor License Agreement

Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

  • Use the Spring Framework code format conventions. If you use Eclipse you can import formatter settings using the eclipse-code-formatter.xml file from the Spring Cloud Build project. If using IntelliJ, you can use the Eclipse Code Formatter Plugin to import the same file.

  • Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.

  • Add the ASF license header comment to all new .java files (copy from existing files in the project)

  • Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).

  • Add some Javadocs and, if you change the namespace, some XSD doc elements.

  • A few unit tests would help a lot as well — someone has to do it.

  • If no-one else is using your branch, please rebase it against the current master (or other target branch in the main project).

  • When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit message (where XXXX is the issue number).

spring-cloud-deployer-local's People

Contributors

ben-enfuse-io avatar chrisjs avatar corneil avatar cppwfs avatar dturanski avatar ericbottard avatar github-actions[bot] avatar hekonsek avatar ilayaperumalg avatar jvalkeal avatar markpollack avatar mminella avatar olegz avatar onobc avatar sabbyanandan avatar spring-builds avatar spring-operator avatar trisberg avatar tzolov avatar viniciusccarvalho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-cloud-deployer-local's Issues

NPE in LocalAppDeployer$AppInstance.getAttributes when logs set to inherited

When deploying streams with deployer.*.local.inheritLogging=true property the runtime apps command in the shell fails with:

2017-06-28 10:55:02.567 ERROR 12006 --- [nio-9393-exec-1] o.s.c.d.s.c.RestControllerAdvice         : Caught exception while handling a request

java.lang.NullPointerException: null
    at org.springframework.cloud.deployer.spi.local.LocalAppDeployer$AppInstance.getAttributes(LocalAppDeployer.java:290) ~[spring-cloud-deployer-local-1.2.1.RELEASE.jar!/:1.2.1.RELEASE]

LocalDeployerProperties declares JAVA_COMMAND incorrectly.

Hi,

Attempting to execute mvnw test will always fail due to an incorrectly declared static constant "JAVA_COMMAND". It is set to "java". Tests that reference this class will fail when the private method "deduceJavaCommand" is called.

String javaExecutablePath = JAVA_COMMAND;
String javaHome = System.getProperty("java.home");
...
File javaExecutable = new File(javaHome, "bin/" + javaExecutablePath);
Assert.isTrue(javaExecutable.canExecute(), "Java executable discovered via 'java.home' system property '"
					+ javaHome + "' is not executable or does not exist.");

javaExecutable will resolve to %JAVA_HOME%/jre/java which can never be executable. Is this intended?

As it is defined currently the following Exception is raised and causes the tests to fail.
Tests run: 11, Failures: 0, Errors: 11, Skipped: 0, Time elapsed: 0.002 sec <<< FAILURE! testDirectJavaMemoryOptionWithG(org.springframework.cloud.deployer.spi.local.JavaExecutionCommandBuilderTests) Time elapsed: 0.001 sec <<< ERROR! java.lang.IllegalArgumentException: Java executable discovered via 'java.home' system property 'F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre' is not executable or does not exist.

Cannot deploy via Docker Container

Hi, I'm having problems related with deploying a stream using the :
spring-cloud-deployer-local-1.2.2.BUILD-SNAPSHOT.jar
and my Dockerfile builded with server-local is:
FROM nimmis/java-centos
MAINTAINER Roberto Gonçalves "[email protected]"
RUN mkdir -p spring-log
VOLUME spring-log
EXPOSE 7000-7010
RUN wget -O app.jar http://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dataflow-server-local/1.2.3.BUILD-SNAPSHOT/spring-cloud-dataflow-server-local-1.2.3.BUILD-SNAPSHOT.jar
ENV JAVA_OPTS="-Djava.io.tmpdir=spring-log"
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar ./app.jar" ]

So then I build the image and then i started it, so I get the docker+rabbitmq and do the bulk:

app import http://bit.ly/Bacon-RELEASE-stream-applications-rabbit-docker

So when I run:

stream deploy --name ticktock

I get:

Caused by: java.io.IOException: Cannot run program "docker" (in directory "/root/spring-log/spring-cloud-dataflow-1938563371549328050/ticktock-1499481317911/ticktock.time"): error=2, No such file or directory

Tracking down I found:

at org.springframework.cloud.deployer.spi.local.LocalAppDeployer$AppInstance.start(LocalAppDeployer.java:298) ~[spring-cloud-deployer-local-1.2.2.BUILD-SNAPSHOT.jar!/:1.2.2.BUILD-SNAPSHOT

Checking this method and seeing the createDir method, I'm thinking that is a problem with creating the directory, but, I can't solve this since that I am new to this repository. Can you guys help me? Thank you!

Support deploying Boot 2.0 apps

Looks like the way we provide the app args by adding them to the environment instead of as command line arguments has some issues with Boot 2.0 based apps. The integration tests set a random port via server.port but the app always ends up using the default 8080.

Undeploying app causes 401 error in shutdownAndWait if shutdown endpoint is secured

Most recent stream apps have shutdown endpoint secured so the local deployer barfs during undeploy. We can work around it by using deploy properties like: "app.*.endpoints.shutdown.sensitive=false"

Stack trace:

org.springframework.web.client.HttpClientErrorException: 401 null
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.cloud.deployer.spi.local.AbstractLocalDeployerSupport.shutdownAndWait(AbstractLocalDeployerSupport.java:146) ~[spring-cloud-deployer-local-1.1.1.RELEASE.jar!/:1.1.1.RELEASE]
	at org.springframework.cloud.deployer.spi.local.LocalAppDeployer.undeploy(LocalAppDeployer.java:148) ~[spring-cloud-deployer-local-1.1.1.RELEASE.jar!/:1.1.1.RELEASE]
	at org.springframework.cloud.dataflow.server.controller.StreamDeploymentController.undeployStream(StreamDeploymentController.java:398) ~[spring-cloud-dataflow-server-core-1.1.0.RELEASE.jar!/:1.1.0.RELEASE]
	at org.springframework.cloud.dataflow.server.controller.StreamDeploymentController.undeploy(StreamDeploymentController.java:146) ~[spring-cloud-dataflow-server-core-1.1.0.RELEASE.jar!/:1.1.0.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doDelete(FrameworkServlet.java:894) [spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:654) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105) [spring-boot-actuator-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:208) [spring-security-web-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.1.3.RELEASE.jar!/:4.1.3.RELEASE]
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107) [spring-boot-actuator-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]

Escaping issues on windows

When running tests on windows:

Results :

Failed tests:   testCommandLineArgumentsPassing(org.springframework.cloud.deployer.spi.local.LocalAppDeployerIntegrationTests): (..)

test app fails with message

Caused by: java.lang.IllegalArgumentException: Expected 'commandLineArgValueThatMayNeedEscaping' value to be equal to '&'"|< é\(', but was '&'|<'

DeployerLocal adds all environment variables to command Line

When attempting to run a task from the command line, all environment variables are added to the command line.
This causes 2 problems:

  1. if the entry has no value boot throws an IllegalArgumentException as discussed here spring-cloud/spring-cloud-task#369
  2. If the user enumerates the datasource via environment properties it is not added to the command properly, because it uses underscores instead of dots.

While this solution may work for Docker, it does not work for running from the command line.

Tasks does not become RUNNING if they don't expose a http endpoint

Hi,

With current implementation a task become RUNNING status only if the process is running and it has a web container. We have tasks to do one time jobs such as sending email, converting xcel to xml, some json transfers etc.. which they don't have web dependency. They never become RUNNING, instead they become LAUNCHING. My question is how reasonable to expect a task to expose a http endpoint ?

            if (exit != null) {
				if (exit == 0) {
					return LaunchState.complete;
				}
				else {
					return LaunchState.failed;
				}
	    }else{
                return LaunchState.running;
            }
			try {
				HttpURLConnection urlConnection = (HttpURLConnection) baseUrl.openConnection();
				urlConnection.setConnectTimeout(100);
				urlConnection.connect();
				urlConnection.disconnect();
				return LaunchState.running;
			}
			catch (IOException e) {
				return LaunchState.launching;
			}

LocalDeployerProperties fails on executing java on windows

From @pjannapu on July 6, 2017 14:9

As part of an effort to setup and run Spring Cloud Dataflow (SCDF) local server as per the instructions provided at (http://cloud.spring.io/spring-cloud-dataflow/ precisely at step 2), I was running into an exception when starting the SCDF local server on my Windows 10 workstation. The server startup fails with an error that says .

"Error creating bean with name 'spring.cloud.deployer.local-org.springframework.cloud.deployer.spi.local.LocalDeployerProperties': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.deployer.spi.local.LocalDeployerProperties]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Java executable discovered via 'java.home' system property 'C:\Installed_software\java\jre-8u131' is not executable or does not exist. "

On further debugging the problem, it turned out that the method deduceJavaCommand(), in the class, org.springframework.cloud.deployer.spi.local.LocalDeployerProperties, has an assertion on
"javaExecutable.canExecute()" which fails on windows. This is because on Windows, the Java executable is named as "java.exe" but not "java".

A hack for this problem would be to create an empty file named "java" (no extensions) and run the jar. It would be great if someone can put in a fix for the issue. As the problem was discovered as part of local setup instructions, I felt that it would be great if someone from Pivotal can again verify the local setup instructions that are provided as part of such tutorials on Spring cloud. Thanks for your time!

-PJ.

Copied from original issue: spring-cloud/spring-cloud-deployer#225

LocalTaskLauncher limit number of concurrent tasks

Hi,

When there are high number of task launcher requests, there will be high number of processors which causes unstability in task launcher. How about adding a parameter that limit number of concurrent tasks. If there more tasks, they will have to wait till one of running tasks completed.

I tried this by adding a public method to LocalTaskLauncher which gives number of currently running tasks. Then in TaskLauncherSink launchTask() wait if current number is not less than max allowed.

What do you think about it?

public int runningTaskCount() {
		return running.size();
	}

LocalTaskLauncher remove the instance from running map when task exits

LocalTaskLauncher does not remove intances from running map Map<String, TaskInstance> running = new ConcurrentHashMap<>(); Thus tasks created are added to the map, but not removed even cancelled. However LocalAppDeployer remove from map in cancel().

@Override
	public void cancel(String id) {
		TaskInstance instance = running.get(id);
		if (instance != null) {
			instance.cancelled = true;
			if (isAlive(instance.getProcess())) {
				shutdownAndWait(instance);
			}
		}
	}

If you add running.remove(id) after shutdownAndwait it makes testSimpleCancel test case to be failed since getStatus return status as unknown when instance object is null.

assertThat(launchId, eventually(hasStatusThat(
				Matchers.<TaskStatus>hasProperty("state", Matchers.is(LaunchState.running))), timeout.maxAttempts, timeout.pause));
@Override
	public void cancel(String id) {
		TaskInstance instance = running.get(id);
		if (instance != null) {
			instance.cancelled = true;
			if (isAlive(instance.getProcess())) {           
				shutdownAndWait(instance);
			}
                        running.remove(id);
		}
	}

NPE observed when querying for runtime status

As an SCDF user, when querying for runtime apps status (with deployer.*.local.inheritLogging=true), I see the following NPE.

stacktrace:

2017-06-28 10:55:02.567 ERROR 12006 --- [nio-9393-exec-1] o.s.c.d.s.c.RestControllerAdvice         : Caught exception while handling a request

java.lang.NullPointerException: null
    at org.springframework.cloud.deployer.spi.local.LocalAppDeployer$AppInstance.getAttributes(LocalAppDeployer.java:290) ~[spring-cloud-deployer-local-1.2.1.RELEASE.jar!/:1.2.1.RELEASE]

scdf shell:

dataflow:>runtime apps
Command failed org.springframework.cloud.dataflow.rest.client.DataFlowClientException: NullPointerException

Not possible start Spring Cloud Data Flow in Windows

Copied from spring-cloud/spring-cloud-dataflow#1580

In Windows 10 Home edition, I have configured the JAVA_HOME and PATH variables (same approach used since Windows XP) all my app that use Java work fine, same appreciation for any tool that needs Java, such as (IDE, LibreOffice, etc...)

Observe the following:

> javac -version
javac 1.8.0_131

> java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

According with [Spring Cloud Data Flow][1]

When I do java -jar spring-cloud-dataflow-server-local-1.2.2.RELEASE.jar the following happens:

> java -jar spring-cloud-dataflow-server-local-1.2.2.RELEASE.jar
  ____                              ____ _                __
 / ___| _ __  _ __(_)_ __   __ _   / ___| | ___  _   _  __| |
 \___ \| '_ \| '__| | '_ \ / _` | | |   | |/ _ \| | | |/ _` |
  ___) | |_) | |  | | | | | (_| | | |___| | (_) | |_| | (_| |
 |____/| .__/|_|  |_|_| |_|\__, |  \____|_|\___/ \__,_|\__,_|
  ____ |_|    _          __|___/                 __________
 |  _ \  __ _| |_ __ _  |  ___| | _____      __  \ \ \ \ \ \
 | | | |/ _` | __/ _` | | |_  | |/ _ \ \ /\ / /   \ \ \ \ \ \
 | |_| | (_| | || (_| | |  _| | | (_) \ V  V /    / / / / / /
 |____/ \__,_|\__\__,_| |_|   |_|\___/ \_/\_/    /_/_/_/_/_/

Spring Cloud Data Flow Local Server  (v1.2.2.RELEASE)

2017-07-01 14:43:37.512  INFO 2260 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-07-01 14:43:38.839  WARN 2260 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/spring-cloud-dataflow-server-local/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2017-07-01 14:43:38.843  INFO 2260 --- [           main] o.s.c.d.s.local.LocalDataFlowServer      : No active profile set, falling back to default profiles: default
2017-07-01 14:43:42.687  INFO 2260 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2017-07-01 14:43:43.614  INFO 2260 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=b15ff760-91d3-31de-a2a8-f2cc5ce41a5c
2017-07-01 14:43:46.475  INFO 2260 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-07-01 14:43:46.478  INFO 2260 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.15
2017-07-01 14:43:46.730  INFO 2260 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-07-01 14:43:47.871  INFO 2260 --- [           main] erverConfiguration$H2ServerConfiguration : Starting H2 Server with URL: jdbc:h2:tcp://localhost:19092/mem:dataflow
2017-07-01 14:43:49.381  INFO 2260 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schema-h2-common.sql for h2 database
2017-07-01 14:43:49.382  INFO 2260 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schema-h2-streams.sql for h2 database
2017-07-01 14:43:49.382  INFO 2260 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schema-h2-tasks.sql for h2 database
2017-07-01 14:43:49.383  INFO 2260 --- [           main] o.s.c.d.s.r.s.DataflowRdbmsInitializer   : Adding dataflow schema classpath:schema-h2-deployment.sql for h2 database
2017-07-01 14:43:49.393  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schema-h2-common.sql]
2017-07-01 14:43:49.420  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schema-h2-common.sql] in 27 ms.
2017-07-01 14:43:49.420  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schema-h2-streams.sql]
2017-07-01 14:43:49.427  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schema-h2-streams.sql] in 4 ms.
2017-07-01 14:43:49.427  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schema-h2-tasks.sql]
2017-07-01 14:43:49.434  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schema-h2-tasks.sql] in 7 ms.
2017-07-01 14:43:49.435  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schema-h2-deployment.sql]
2017-07-01 14:43:49.438  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schema-h2-deployment.sql] in 2 ms.
2017-07-01 14:43:50.946  INFO 2260 --- [           main] o.s.b.c.r.s.JobRepositoryFactoryBean     : No database type set, using meta data indicating: H2
2017-07-01 14:43:51.414  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [org/springframework/batch/core/schema-h2.sql]
2017-07-01 14:43:51.492  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [org/springframework/batch/core/schema-h2.sql] in 78 ms. 2017-07-01 14:43:51.521  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql]
2017-07-01 14:43:51.538  INFO 2260 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [org/springframework/cloud/task/schema-h2.sql] in 16 ms.

...

Caused by: org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'spring.cloud.deployer.local-org.springframework.cloud.deployer.spi.local.LocalDeployerProperties': 
  Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
  Failed to instantiate [org.springframework.cloud.deployer.spi.local.LocalDeployerProperties]: 
  Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 
  Java executable discovered via 'java.home' system property 'C:\whiteroom\java\jre1.8.0_131' is not executable or does not exist.
  ...
  Caused by: java.lang.IllegalArgumentException: Java executable discovered via 'java.home' system property 'C:\whiteroom\java\jre1.8.0_131' is not executable or does not exist.
        at

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.