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

java.lang.NullPointerException when using C4-PlantUML #476

Closed
hubertciebiada opened this issue Feb 21, 2025 · 9 comments
Closed

java.lang.NullPointerException when using C4-PlantUML #476

hubertciebiada opened this issue Feb 21, 2025 · 9 comments

Comments

@hubertciebiada
Copy link

I want to draw a simple diagram using C4-PlantUML.

the diagram is placed in asciidoc. But when rendering a pdf from asciidoctor it shows such error:

Image

My diagram look like this:

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

' Options
LAYOUT_TOP_DOWN()

' Persons
Person(personConsultant, "Person1")
Person(personManager, "Person2")
Person(motivationTeam, "Admin")

' Systems
System(mySystem, "system")

' Relations
Rel(personConsultant, mySystem, "monitors")
Rel(personManager, mySystem, "monitors")
Rel(motivationTeam, mySystem, "configs")

' Legend
SHOW_LEGEND()

@enduml 

And it is generated normally in Rider PlantUML plugin.

The error is displayed in PDF and HTML render as well.

What am I missing?

@pepijnve
Copy link
Member

I tried this out locally, but wasn't able to reproduce the NPE. It's hard to say based on the available information what the difference between the two execution environments might be. Perhaps a Graphviz version issue?
I'll make a gem wrapper release of the latest and greatest PlantUML version. Perhaps that resolves this problem for you.

pepijnve added a commit that referenced this issue Feb 22, 2025
@pepijnve
Copy link
Member

I've added initial support for PlantUML's -debugsvek in #476, but I don't think that's going to help troubleshoot this particular problem. Based on a quick read through of the PlantUML code, it looks like the error is occurring before it would even get to the point where it emits the debug output.

@hubertciebiada
Copy link
Author

hubertciebiada commented Feb 24, 2025

Thanks for the reply.

Have in mind that I'm not really familiar with java and ruby so I'm using my intuition here. :)

What I did since your message:

  1. gem install asciidoctor-diagram
  2. I had the old version so I removed it gem uninstall asciidoctor-diagram-plantuml -v 1.2024.8
  3. Now when i run gem list I see those packages:
addressable (2.8.7)
afm (0.2.2)
Ascii85 (2.0.1)
asciidoctor (2.0.23)
asciidoctor-diagram (2.3.1)
asciidoctor-diagram-batik (1.17)
asciidoctor-diagram-ditaamini (1.0.3)
asciidoctor-diagram-plantuml (1.2025.1)
asciidoctor-kroki (0.10.0)
asciidoctor-pdf (2.3.19)
base64 (0.2.0)
benchmark (default: 0.4.0)
bigdecimal (3.1.8)
bundler (default: 2.6.2)
cgi (default: 0.4.1)
concurrent-ruby (1.3.5)
css_parser (1.21.0)
csv (3.3.2)
date (default: 3.4.1)
debug (1.10.0)
delegate (default: 0.4.0)
did_you_mean (default: 2.0.0)
digest (default: 3.2.0)
drb (2.2.1)
english (default: 0.8.0)
erb (default: 4.0.4)
error_highlight (default: 0.7.0)
etc (default: 1.4.5)
fcntl (default: 1.2.0)
fiddle (default: 1.1.6)
fileutils (default: 1.7.3)
find (default: 0.2.0)
forwardable (default: 1.3.3)
getoptlong (0.2.1)
hashery (2.1.2)
io-console (default: 0.8.0)
io-nonblock (default: 0.3.1)
io-wait (default: 0.3.1)
ipaddr (default: 1.2.7)
irb (default: 1.14.3)
json (default: 2.9.1)
logger (default: 1.6.4)
matrix (0.4.2)
minitest (5.25.4)
mutex_m (0.3.0)
net-ftp (0.3.8)
net-http (default: 0.6.0)
net-imap (0.5.4)
net-pop (0.1.2)
net-protocol (default: 0.2.2)
net-smtp (0.5.0)
nkf (0.2.0)
observer (0.1.2)
open-uri (default: 0.5.0)
open3 (default: 0.2.1)
openssl (default: 3.3.0)
optparse (default: 0.6.0)
ostruct (default: 0.6.1)
pathname (default: 0.4.0)
pdf-core (0.9.0)
pdf-reader (2.14.1)
polyglot (0.3.5)
power_assert (2.0.5)
pp (default: 0.6.2)
prawn (2.4.0)
prawn-icon (3.0.0)
prawn-svg (0.34.2)
prawn-table (0.2.2)
prawn-templates (0.1.2)
prettyprint (default: 0.2.0)
prime (0.1.3)
prism (default: 1.2.0)
pstore (default: 0.1.4)
psych (default: 5.2.2)
public_suffix (6.0.1)
racc (1.8.1)
rake (13.2.1)
rbs (3.8.0)
rdoc (default: 6.10.0)
readline (default: 0.0.4)
reline (default: 0.6.0)
repl_type_completor (0.1.9)
resolv (default: 0.6.0)
resolv-replace (0.1.1)
rexml (3.4.1, 3.4.0)
rinda (0.2.0)
rss (0.3.1)
ruby-rc4 (0.1.5)
ruby2_keywords (default: 0.0.5)
securerandom (default: 0.4.1)
set (default: 1.1.1)
shellwords (default: 0.2.2)
singleton (default: 0.3.0)
stringio (default: 3.1.2)
strscan (default: 3.1.2)
syntax_suggest (default: 2.0.2)
tempfile (default: 0.3.1)
test-unit (3.6.7)
time (default: 0.4.1)
timeout (default: 0.4.3)
tmpdir (default: 0.3.1)
treetop (1.6.14)
tsort (default: 0.2.0)
ttfunk (1.7.0)
typeprof (0.30.1)
un (default: 0.3.0)
uri (default: 1.0.2)
weakref (default: 0.1.3)
win32-registry (default: 0.1.0)
win32ole (default: 1.9.1)
yaml (default: 0.4.0)
zlib (default: 3.2.1)
PS C:\Git\itsg-kea> gem list
abbrev (0.1.2)
addressable (2.8.7)
afm (0.2.2)
Ascii85 (2.0.1)
asciidoctor (2.0.23)
asciidoctor-diagram (2.3.1)
asciidoctor-diagram-batik (1.17)
asciidoctor-diagram-ditaamini (1.0.3)
asciidoctor-diagram-plantuml (1.2025.1)
asciidoctor-kroki (0.10.0)
asciidoctor-pdf (2.3.19)
base64 (0.2.0)
benchmark (default: 0.4.0)
bigdecimal (3.1.8)
bundler (default: 2.6.2)
cgi (default: 0.4.1)
concurrent-ruby (1.3.5)
css_parser (1.21.0)
csv (3.3.2)
date (default: 3.4.1)
debug (1.10.0)
delegate (default: 0.4.0)
did_you_mean (default: 2.0.0)
digest (default: 3.2.0)
drb (2.2.1)
english (default: 0.8.0)
erb (default: 4.0.4)
error_highlight (default: 0.7.0)
etc (default: 1.4.5)
fcntl (default: 1.2.0)
fiddle (default: 1.1.6)
fileutils (default: 1.7.3)
find (default: 0.2.0)
forwardable (default: 1.3.3)
getoptlong (0.2.1)
hashery (2.1.2)
io-console (default: 0.8.0)
io-nonblock (default: 0.3.1)
io-wait (default: 0.3.1)
ipaddr (default: 1.2.7)
irb (default: 1.14.3)
json (default: 2.9.1)
logger (default: 1.6.4)
matrix (0.4.2)
minitest (5.25.4)
mutex_m (0.3.0)
net-ftp (0.3.8)
net-http (default: 0.6.0)
net-imap (0.5.4)
net-pop (0.1.2)
net-protocol (default: 0.2.2)
net-smtp (0.5.0)
nkf (0.2.0)
observer (0.1.2)
open-uri (default: 0.5.0)
open3 (default: 0.2.1)
openssl (default: 3.3.0)
optparse (default: 0.6.0)
ostruct (default: 0.6.1)
pathname (default: 0.4.0)
pdf-core (0.9.0)
pdf-reader (2.14.1)
polyglot (0.3.5)
power_assert (2.0.5)
pp (default: 0.6.2)
prawn (2.4.0)
prawn-icon (3.0.0)
prawn-svg (0.34.2)
prawn-table (0.2.2)
prawn-templates (0.1.2)
prettyprint (default: 0.2.0)
prime (0.1.3)
prism (default: 1.2.0)
pstore (default: 0.1.4)
psych (default: 5.2.2)
public_suffix (6.0.1)
racc (1.8.1)
rake (13.2.1)
rbs (3.8.0)
rdoc (default: 6.10.0)
readline (default: 0.0.4)
reline (default: 0.6.0)
repl_type_completor (0.1.9)
resolv (default: 0.6.0)
resolv-replace (0.1.1)
rexml (3.4.1, 3.4.0)
rinda (0.2.0)
rss (0.3.1)
ruby-rc4 (0.1.5)
ruby2_keywords (default: 0.0.5)
securerandom (default: 0.4.1)
set (default: 1.1.1)
shellwords (default: 0.2.2)
singleton (default: 0.3.0)
stringio (default: 3.1.2)
strscan (default: 3.1.2)
syntax_suggest (default: 2.0.2)
tempfile (default: 0.3.1)
test-unit (3.6.7)
time (default: 0.4.1)
timeout (default: 0.4.3)
tmpdir (default: 0.3.1)
treetop (1.6.14)
tsort (default: 0.2.0)
ttfunk (1.7.0)
typeprof (0.30.1)
un (default: 0.3.0)
uri (default: 1.0.2)
weakref (default: 0.1.3)
win32-registry (default: 0.1.0)
win32ole (default: 1.9.1)
yaml (default: 0.4.0)
zlib (default: 3.2.1)

The error stays the same, but what drew my attention is that the version of PlantUML in the error stays the same (1.2024.8) as well. Shouldn't this be higher?

Can I provide any more info that will be useful? Have I done the upgrade properly?

@hubertciebiada
Copy link
Author

Ok, I've looked on the old file. The error is now:

Image

@hubertciebiada
Copy link
Author

Maybe some of this comments sparks an idea for you:

Hi,

It seems that is an issue on the plugin, not on the core plantuml ; Because with last version, we don't see any java Exception:

Then:

  • Could you perhaps ask the question on the plugin maintener?
  • How is invoque plantuml on this plugin?

Perhaps could you configure the security profile?
See doc here:

[FYI @kirchsth]
If that can help,
Regards,
Th.

Originally posted by @The-Lum in #2096

@The-Lum
Copy link

The-Lum commented Mar 3, 2025

Hi,

Another line of research... :
The configuration of GraphViz/dot...

Regards,
Th.

@The-Lum
Copy link

The-Lum commented Mar 3, 2025

Hi,

As mentioned here:

You must install Graphviz/dot first...

Enjoy,
Regards,
Th.

@pepijnve
Copy link
Member

pepijnve commented Mar 4, 2025

Just FYI, there is actually logic in place to try and locate dot in the asciidoctor-diagram code. At the moment this does not error out yet if it cannot be found because PlantUML does not actually require GraphViz for everything. I was worried about producing too many errors for people.

It's a shame that PlantUML doesn't produce a better error message out of the box in this situation.

Perhaps I could set the 'use smetana' flag when dot cannot be found.

@The-Lum
Copy link

The-Lum commented Mar 4, 2025

Hi,

It's a shame that PlantUML doesn't produce a better error message out of the box in this situation.

We will take the action.
And propose a better error handling.

Regards,
Th.

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

No branches or pull requests

3 participants