{"action":"created","issue":{"url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/192","repository_url":"https://api.github.com/repos/schemacrawler/SchemaCrawler","labels_url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/192/comments","events_url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/192/events","html_url":"https://github.com/schemacrawler/SchemaCrawler/issues/192","id":341551319,"node_id":"MDU6SXNzdWUzNDE1NTEzMTk=","number":192,"title":"Schemacrawler graphviz-java usage fails when v8 is not available","user":{"login":"selliera","id":1607899,"node_id":"MDQ6VXNlcjE2MDc4OTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1607899?v=4","gravatar_id":"","url":"https://api.github.com/users/selliera","html_url":"https://github.com/selliera","followers_url":"https://api.github.com/users/selliera/followers","following_url":"https://api.github.com/users/selliera/following{/other_user}","gists_url":"https://api.github.com/users/selliera/gists{/gist_id}","starred_url":"https://api.github.com/users/selliera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selliera/subscriptions","organizations_url":"https://api.github.com/users/selliera/orgs","repos_url":"https://api.github.com/users/selliera/repos","events_url":"https://api.github.com/users/selliera/events{/privacy}","received_events_url":"https://api.github.com/users/selliera/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sualeh","id":36505153,"node_id":"MDQ6VXNlcjM2NTA1MTUz","avatar_url":"https://avatars0.githubusercontent.com/u/36505153?v=4","gravatar_id":"","url":"https://api.github.com/users/sualeh","html_url":"https://github.com/sualeh","followers_url":"https://api.github.com/users/sualeh/followers","following_url":"https://api.github.com/users/sualeh/following{/other_user}","gists_url":"https://api.github.com/users/sualeh/gists{/gist_id}","starred_url":"https://api.github.com/users/sualeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sualeh/subscriptions","organizations_url":"https://api.github.com/users/sualeh/orgs","repos_url":"https://api.github.com/users/sualeh/repos","events_url":"https://api.github.com/users/sualeh/events{/privacy}","received_events_url":"https://api.github.com/users/sualeh/received_events","type":"User","site_admin":false},"assignees":[{"login":"sualeh","id":36505153,"node_id":"MDQ6VXNlcjM2NTA1MTUz","avatar_url":"https://avatars0.githubusercontent.com/u/36505153?v=4","gravatar_id":"","url":"https://api.github.com/users/sualeh","html_url":"https://github.com/sualeh","followers_url":"https://api.github.com/users/sualeh/followers","following_url":"https://api.github.com/users/sualeh/following{/other_user}","gists_url":"https://api.github.com/users/sualeh/gists{/gist_id}","starred_url":"https://api.github.com/users/sualeh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sualeh/subscriptions","organizations_url":"https://api.github.com/users/sualeh/orgs","repos_url":"https://api.github.com/users/sualeh/repos","events_url":"https://api.github.com/users/sualeh/events{/privacy}","received_events_url":"https://api.github.com/users/sualeh/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-07-16T14:50:05Z","updated_at":"2018-07-19T13:20:59Z","closed_at":null,"author_association":"NONE","body":"# Environment\r\n\r\n> Specify the\r\n> * version of SchemaCrawler: 14.21.02\r\n> * version of Java: 1.8\r\n\r\n# Issue\r\nWhen using graphviz-java to generate a png, the tool fails with `java.lang.NoClassDefFoundError: com/eclipsesource/v8/V8RuntimeException` when v8 is not available in the runtime, even if graphviz-java has a Jdk engine.\r\n\r\nWhen initializing the GraphvizEngines, it would be nice to ensure they can be loaded.\r\nThe following patch does that, but it would most certainly be better to also properly log some warnings when an engine is not available.\r\n\r\n```\r\n--- a/schemacrawler-integrations/src/main/java/schemacrawler/tools/integration/graph/GraphvizJavaExecutorUtility.java\r\n+++ b/schemacrawler-integrations/src/main/java/schemacrawler/tools/integration/graph/GraphvizJavaExecutorUtility.java\r\n@@ -3,12 +3,16 @@ package schemacrawler.tools.integration.graph;\r\n\r\n import static java.util.Objects.requireNonNull;\r\n\r\n+import java.util.List;\r\n+import java.util.ArrayList;\r\n+\r\n import java.io.FileReader;\r\n import java.nio.file.Path;\r\n import java.nio.file.Paths;\r\n\r\n import guru.nidi.graphviz.engine.Format;\r\n import guru.nidi.graphviz.engine.Graphviz;\r\n+import guru.nidi.graphviz.engine.GraphvizEngine;\r\n import guru.nidi.graphviz.engine.GraphvizJdkEngine;\r\n import guru.nidi.graphviz.engine.GraphvizV8Engine;\r\n import schemacrawler.schemacrawler.SchemaCrawlerException;\r\n@@ -51,7 +55,18 @@ public final class GraphvizJavaExecutorUtility\r\n       String dotSource = IOUtility.readFully(new FileReader(dotFile.toFile()));\r\n       dotSource = dotSource.replaceAll(\"\\\\R\", \" \");\r\n\r\n-      Graphviz.useEngine(new GraphvizV8Engine(), new GraphvizJdkEngine());\r\n+      List<GraphvizEngine> engines = new ArrayList<>();\r\n+      try {\r\n+        GraphvizEngine engine = new GraphvizV8Engine();\r\n+        engines.add(engine);\r\n+      } catch (java.lang.NoClassDefFoundError e) {\r\n+      }\r\n+      try {\r\n+        GraphvizEngine engine = new GraphvizJdkEngine();\r\n+        engines.add(engine);\r\n+      } catch (java.lang.NoClassDefFoundError e) {\r\n+      }\r\n+      Graphviz.useEngine(engines);\r\n       final Format format = map(graphOutputFormat);\r\n       Graphviz.fromString(dotSource).render(format).toFile(outputFile.toFile());\r\n     }\r\n```\r\n[schemacrawler.txt](https://github.com/schemacrawler/SchemaCrawler/files/2198073/schemacrawler.txt)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/comments/406273670","html_url":"https://github.com/schemacrawler/SchemaCrawler/issues/192#issuecomment-406273670","issue_url":"https://api.github.com/repos/schemacrawler/SchemaCrawler/issues/192","id":406273670,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjI3MzY3MA==","user":{"login":"selliera","id":1607899,"node_id":"MDQ6VXNlcjE2MDc4OTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1607899?v=4","gravatar_id":"","url":"https://api.github.com/users/selliera","html_url":"https://github.com/selliera","followers_url":"https://api.github.com/users/selliera/followers","following_url":"https://api.github.com/users/selliera/following{/other_user}","gists_url":"https://api.github.com/users/selliera/gists{/gist_id}","starred_url":"https://api.github.com/users/selliera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selliera/subscriptions","organizations_url":"https://api.github.com/users/selliera/orgs","repos_url":"https://api.github.com/users/selliera/repos","events_url":"https://api.github.com/users/selliera/events{/privacy}","received_events_url":"https://api.github.com/users/selliera/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T13:20:59Z","updated_at":"2018-07-19T13:20:59Z","author_association":"NONE","body":"Ok course ! Thanks !"}}
{"actor":{"display_login":"selliera"}}