0

I am using javafx charts in my project. My code works well in a windows os and I am able to generate the charts. But when I deploy the same application in a ubuntu, I am getting the following error while trying to create the charts. I am using JDK 8 and tomcat.

22-Feb-2016 00:00:21,670 ERROR TaskUtils$LoggingErrorHandler:95 - Unexpected error occurred in scheduled task.
java.lang.ExceptionInInitializerError
    at javafx.scene.chart.PieChart$Data.<init>(PieChart.java:827)
    at com.project.service.impl.AnalyticsServiceImpl.getPDFDump(AnalyticsServiceImpl.java:711)
    at com.project.service.impl.AnalyticsServiceImpl.getChartMap(AnalyticsServiceImpl.java:861)
    at com.project.service.impl.AnalyticsServiceImpl.emailReportScheduler(AnalyticsServiceImpl.java:768)
    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:497)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
    at com.sun.proxy.$Proxy68.emailReportScheduler(Unknown Source)
    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:497)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: No toolkit found
    at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:217)
    at com.sun.javafx.perf.PerformanceTracker.logEvent(PerformanceTracker.java:110)
    at javafx.scene.Node.<clinit>(Node.java:387)
    ... 31 more
rohit
  • 953
  • 5
  • 15
  • 31
  • 1
    Tomcat and javafx? That's a strange combination you have here – fge Feb 23 '16 at 11:57
  • are they issues with tomcat and javafx in ubuntu? It is working well in windows. – rohit Feb 23 '16 at 13:14
  • I think the question is why/how are you using JavaFX and Tomcat together at all? JavaFX is a GUI toolkit. Tomcat is a server-side process, and typically runs on a machine with no UI capabilities at all. So the two would seem to have contradictory use cases. (I'm guessing you are trying to use JavaFX in some kind of headless mode, to build charts and then snapshot them, convert to AWT image and then use ImageIO to stream them to a browser; however that is fraught with issues.) More concretely, perhaps, what JDK are you using on Ubuntu? – James_D Feb 23 '16 at 13:25
  • Possibly a duplicate of http://stackoverflow.com/questions/17940329/javafx-for-server-side-image-generation – James_D Feb 23 '16 at 13:51
  • I am having a spring application which is deployed on the tomcat server. I have a scheduler service running which generates pdf reports that contain charts. For creating charts I am using javafx. JDK version is 1.8 – rohit Feb 24 '16 at 13:37

0 Answers0