Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Failure to call the interface 400 /dolphinscheduler/projects/{projectName}/executors/start-process-instance #3156

Closed
zengqinchris opened this issue Jul 6, 2020 · 3 comments
Labels
question Further information is requested

Comments

@zengqinchris
Copy link

zengqinchris commented Jul 6, 2020

image
,请求 参数
{"processDefinitionId":14,"scheduleTime":"0 0 8 * * ? *","warningType":"FAILURE","failureStrategy":"CONTINUE","warningGroupId":1,"projectName":"online-test","processInstancePriority":"MEDIUM"}

调用接口的代码

public static String httpRequestUtils(String urlStr, String params, String requestMethod) {
        PrintWriter out = null;
        BufferedReader in = null;
        StringBuilder result = new StringBuilder();
        String url = SchedulerWorkflowConstants.DS_SCHEDULER_URL() + urlStr;
        try {
            URL reqUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection)reqUrl.openConnection();
            conn.setRequestProperty("Content-Type", SchedulerWorkflowConstants.DS_SCHEDULER_CONTENT_TYPE());  //设置请求头
            conn.setRequestProperty("token", SchedulerWorkflowConstants.DS_SCHEDULER_TOKEN());
            //      conn.setRequestProperty("connection", "Keep-Alive");
            //      conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
            conn.setDoOutput(true);  //设置为true才可以使用conn.getOutputStream().write()
            conn.setDoInput(true); //可以使用conn.getInputStream().read();
            conn.setRequestMethod(requestMethod);
            if (!"".equals(params)) {
                out = new PrintWriter(conn.getOutputStream());  //写入参数
                out.print(params);    //设置参数,可以直接写&参数,也可以直接传入拼接好的
                out.flush();  // flush输出流的缓冲
            }
            conn.connect();
            // 定义BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
            String line = in.readLine();
            while (line != null) {
                result.append(line);
                line = in.readLine();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                out.close();
            }
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return result.toString();
    }`
```


报错信息
`All insert ok : 2
start-process-instance params: {"processDefinitionId":14,"scheduleTime":"0 0 8 * * ? *","warningType":"FAILURE","failureStrategy":"CONTINUE","warningGroupId":1,"projectName":"online-test","processInstancePriority":"MEDIUM"}
java.io.IOException: Server returned HTTP response code: 400 for URL: http://xxxxxt:15681/dolphinscheduler/projects/online-test/executors/start-process-instance
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at com.wumii.data.platform.manager.service.meta.SchedulerWorkflowService.httpRequestUtils(SchedulerWorkflowService.java:260)
	at com.wumii.data.platform.manager.service.meta.SchedulerWorkflowService.startSchedulerWorkflowTask(SchedulerWorkflowService.java:220)
	at com.wumii.data.platform.manager.controller.meta.SchedulerWorkflowController.startSchedulerWorkflowTask(SchedulerWorkflowController.java:71)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:864)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:531)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:319)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:175)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:133)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:754)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:672)
	at java.lang.Thread.run(Thread.java:748)
start-process-instance msg: 
insert into scheduler_workflow (id,process_name, status, description, update_time, create_time) VALUES (?,?, ?, ?, ?, ?) on conflict (id) do nothing
All insert ok : 2
i`



@zengqinchris zengqinchris added the question Further information is requested label Jul 6, 2020
@zengqinchris
Copy link
Author

如果这个接口已经废除了,有没有新的接口可以使用?

@samz406 samz406 changed the title [QUESTION] 调用接口失败报 400 /dolphinscheduler/projects/{projectName}/executors/start-process-instance [QUESTION] Failure to call the interface 400 /dolphinscheduler/projects/{projectName}/executors/start-process-instance Jul 6, 2020
@samz406
Copy link
Contributor

samz406 commented Jul 6, 2020

/projects/{projectName}/executors/start-process-instance api is not abolished, you can use the postman tool to test, or manually run on the page, F12 to see the request parameters.

@samz406 samz406 closed this as completed Jul 6, 2020
@zengqinchris
Copy link
Author

已经解决,projects/online-test/executors/start-process-instance?processDefinitionId=14&failureStrategy=CONTINUE&warningType=FAILURE&warningGroupId=1&projectName=online-t
按照这种方式传递参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants