I can't help you with this one, this is purely a springframework/tomcat/whatever issue.

My guess is that the initialization can only happen once per JVM, so after the first job submission (or similar operation that runs the main method (like displaying the plan)) it will no longer work. This issue supports this theory: https://github.com/spring-projects/spring-boot/issues/10617

It works with the CLI since you always spin up a new JVM for each command.

On 13.03.2019 14:06, Durga Durga wrote:
Thanks for the prompt reply - now i used the fully qualified class Name - it gives this error (it works fine via the CLI bin/flink run <jar>

org.apache.flink.client.program.ProgramInvocationException: The main method 
caused an error.

This is in my pom.xml

<*properties*>

<*debug.port*>8888</*debug.port*>

<*debug.suspend*>n</*debug.suspend*>

<*scala.binary.version*>2.11</*scala.binary.version*>

<*start-class*>com.foo.bar.MyFlinkApplication</*start-class*>

<*main-class*>com.foo.bar.MyFlinkApplication</*main-class*>

</*properties*>


I used the complete class Name

2019-03-13 12:49:28,085 WARNorg.apache.flink.runtime.webmonitor.handlers.JarRunHandler- Configuring the job submission via query parameters is deprecated. Please migrate to submitting a JSON request instead.

2019-03-13 12:49:32,469 ERROR org.apache.flink.runtime.webmonitor.handlers.JarRunHandler- Exception occurred in REST handler.

org.apache.flink.runtime.rest.handler.RestHandlerException: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.

at org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$handleRequest$4(JarRunHandler.java:114)

at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870)

at java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:852)

at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)

at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1595)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.util.concurrent.CompletionException: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.

at org.apache.flink.runtime.webmonitor.handlers.utils.JarHandlerUtils$JarHandlerContext.toJobGraph(JarHandlerUtils.java:119)

at org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$getJobGraphAsync$7(JarRunHandler.java:151)

at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)

... 3 more

Caused by: org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.

at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:546)

at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)

at org.apache.flink.client.program.OptimizerPlanEnvironment.getOptimizedPlan(OptimizerPlanEnvironment.java:83)

at org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:78)

at org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:120)

at org.apache.flink.runtime.webmonitor.handlers.utils.JarHandlerUtils$JarHandlerContext.toJobGraph(JarHandlerUtils.java:117)

... 5 more

Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)

at com.foo.bar.MyFlinkApplication.main(MyFlinkApplication.java:37)

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.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)

... 10 more

Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125)

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86)

at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:414)

at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:174)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152)

... 21 more

Caused by: org.apache.catalina.LifecycleException: A child container failed during start

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:960)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.startup.Tomcat.start(Tomcat.java:370)

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:106)

... 26 more

Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

at java.util.concurrent.FutureTask.get(FutureTask.java:192)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:951)

... 34 more

Caused by: org.apache.catalina.LifecycleException: A child container failed during start

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:960)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)

... 34 more

Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@172ea702]

at java.util.concurrent.FutureTask.report(FutureTask.java:122)

at java.util.concurrent.FutureTask.get(FutureTask.java:192)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:951)

... 42 more

Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@172ea702]

at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)

at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4758)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4893)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1429)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)

... 42 more

Caused by: java.lang.Error: factory already defined

at java.net.URL.setURLStreamHandlerFactory(URL.java:1112)

at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:130)

at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:53)

at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:77)

at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699)

at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:682)

at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)

... 52 more





--
_Durga Deep

On Wed, Mar 13, 2019 at 4:16 AM Chesnay Schepler <ches...@apache.org <mailto:ches...@apache.org>> wrote:

    Looks like the wrong main class is being passed to the REST API.

    It is "MyFlinkApplication" but should be
    "com.foo.bar.MyFlinkApplication".

    Are you setting the class manually during the job-submission or is it
    written into the jar manifest?

      On 13.03.2019 03:21, Durga Durga wrote:
    > Hi Folks,
    >
    >     We developed a Flink Application  DataStreamSource reading
    from a Kafka
    > Topic. Now we need to deploy this via the Flink Dash Board. This
    program
    > runs perfectly fine via  the command line bin/flink run <Jar>
    >
    > But with the Dash Board  it doesn't work.
    >
    > Should there be any changes done -
    >
    >
    >       // set up the execution environment
    >
    > final StreamExecutionEnvironment streamExecutionEnv =
    > StreamExecutionEnvironment.getExecutionEnvironment();
    >
    > // make parameters available in the web interface
    >
    > streamExecutionEnv.getConfig().setGlobalJobParameters(params);
    >
    > streamExecutionEnv.getConfig().disableSysoutLogging();
    >
    >
    
streamExecutionEnv.getConfig().setRestartStrategy(RestartStrategies.fixedDelayRestart(10,
    > 500));
    >
    > ...
    >
    > streamExecutionEnv.execute("MyFlinkApplication");
    >
    > *Submit new Job*
    > We're sorry, something went wrong. The server responded with:
    >
    > *org.apache.flink.client.program.ProgramInvocationException: The
    > program's entry point class 'MyFlinkApplication' was not found
    in the
    > jar file.*
    >
    >
    > I see this class in my jar file
    >
    >
    > jar -tvf  My.jar | grep  -i MyFlinkApplication
    >
    >    4018 Tue Mar 12 17:49:40 PDT 2019
    com/foo/bar/MyFlinkApplication.class
    >
    >
    > Thanks a lot
    >
    > Durga Deep
    >



--
_Durga Deep


Reply via email to