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

Add JLatexMath support in Docker image #116

Closed
ttobsen opened this issue Sep 9, 2019 · 13 comments · Fixed by #305
Closed

Add JLatexMath support in Docker image #116

ttobsen opened this issue Sep 9, 2019 · 13 comments · Fixed by #305

Comments

@ttobsen
Copy link

ttobsen commented Sep 9, 2019

The Jetty Docker image does not support JLatexMath and therefore the tags are not working.

Would it be possible to add JLatexMath support? I'm no Java expert, but I can help with the Dockerfile. I just have to know where the JAR files from the Zip archive needs to be placed.

@shizhaojingszj
Copy link

the documentation says the jar files are large, so they need to be downloaded seperated and put into the same folder as plantuml.jar file. So I'm thinking maybe you can download the jar files and mount them to the right folder.

@ttobsen
Copy link
Author

ttobsen commented Nov 12, 2019

The image has a size of over 400MB, I think the 3.7MB of the JLatexMath extension shouldn't be any problem.

I can't find any plantuml.jar in the Docker image, therefore I don't know where I should mount the JLatexMath files. Any ideas?

@shizhaojingszj
Copy link

Sorry, I just read the instructions, don't know what to do with it.
And in docker image, there is a plantuml.war file in tomcat folder, I guess this is the 'plantuml.jar' file.... But, no definitive information I can give you.

@ttobsen
Copy link
Author

ttobsen commented Nov 21, 2019

If I remeber correctly, I already tried this without success. :-(

@tphani
Copy link

tphani commented Dec 12, 2019

I believe the instructions you are referring to are for a standalone setup. For docker setup it is packaged as war and deployed into jetty/tomcat. We can either add JLatex libs as dependencies to pom.xml or keeps them in WEB-INT/lib and build the docker image. Not sure if any other easy options available.

@ttobsen
Copy link
Author

ttobsen commented Dec 12, 2019

Hi @tphani, does this mean that extracting the JLatexMath files into /var/lib/jetty/lib should be enough to get this working? If copying the JLatexMath to this place and restart the container, I get the same error message as before:

plantuml         | java.lang.ClassNotFoundException: org.scilab.forge.jlatexmath.TeXFormula
plantuml         |      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
plantuml         |      at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
plantuml         |      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
plantuml         |      at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
plantuml         |      at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:555)
plantuml         |      at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
plantuml         |      at java.lang.Class.forName0(Native Method)
plantuml         |      at java.lang.Class.forName(Class.java:264)
plantuml         |      at net.sourceforge.plantuml.math.TeXIconBuilder.<init>(TeXIconBuilder.java:53)
plantuml         |      at net.sourceforge.plantuml.math.LatexBuilder.buildIcon(LatexBuilder.java:66)
plantuml         |      at net.sourceforge.plantuml.math.LatexBuilder.getImage(LatexBuilder.java:82)
plantuml         |      at net.sourceforge.plantuml.math.AsciiMath.getImage(AsciiMath.java:106)
plantuml         |      at net.sourceforge.plantuml.math.ScientificEquationSafe.getImage(ScientificEquationSafe.java:113)
plantuml         |      at net.sourceforge.plantuml.creole.AtomMath.drawU(AtomMath.java:102)
plantuml         |      at net.sourceforge.plantuml.creole.SheetBlock1.drawU(SheetBlock1.java:174)
plantuml         |      at net.sourceforge.plantuml.creole.SheetBlock2.drawU(SheetBlock2.java:82)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox.drawU(FtileBox.java:251)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple.drawU(FtileAssemblySimple.java:113)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithConnection.drawU(FtileWithConnection.java:72)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedVertically.drawU(FtileMargedVertically.java:58)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple.drawU(FtileAssemblySimple.java:112)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithConnection.drawU(FtileWithConnection.java:72)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedVertically.drawU(FtileMargedVertically.java:58)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple.drawU(FtileAssemblySimple.java:112)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithConnection.drawU(FtileWithConnection.java:72)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileMargedVertically.drawU(FtileMargedVertically.java:58)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.UGraphicInterceptorUDrawable2.draw(UGraphicInterceptorUDrawable2.java:67)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple.drawU(FtileAssemblySimple.java:112)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.FtileWithConnection.drawU(FtileWithConnection.java:72)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.TextBlockInterceptorUDrawable.drawU(TextBlockInterceptorUDrawable.java:56)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ftile.SwimlanesA.drawU(SwimlanesA.java:198)
plantuml         |      at net.sourceforge.plantuml.ugraphic.comp.TextBlockCompressedOnXorY.drawU(TextBlockCompressedOnXorY.java:61)
plantuml         |      at net.sourceforge.plantuml.ugraphic.comp.TextBlockCompressedOnXorY.drawU(TextBlockCompressedOnXorY.java:61)
plantuml         |      at net.sourceforge.plantuml.graphic.TextBlockRecentred.drawU(TextBlockRecentred.java:56)
plantuml         |      at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageInternal(ImageBuilder.java:259)
plantuml         |      at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageTOBEMOVED(ImageBuilder.java:180)
plantuml         |      at net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3.exportDiagramInternal(ActivityDiagram3.java:224)
plantuml         |      at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:201)
plantuml         |      at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:135)
plantuml         |      at net.sourceforge.plantuml.servlet.DiagramResponse.sendDiagram(DiagramResponse.java:112)
plantuml         |      at net.sourceforge.plantuml.servlet.UmlDiagramService.doDiagramResponse(UmlDiagramService.java:101)
plantuml         |      at net.sourceforge.plantuml.servlet.UmlDiagramService.doGet(UmlDiagramService.java:68)
plantuml         |      at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
plantuml         |      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
plantuml         |      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
plantuml         |      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
plantuml         |      at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:214)
plantuml         |      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
plantuml         |      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
plantuml         |      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
plantuml         |      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
plantuml         |      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
plantuml         |      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
plantuml         |      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
plantuml         |      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
plantuml         |      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
plantuml         |      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
plantuml         |      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
plantuml         |      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)
plantuml         |      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
plantuml         |      at org.eclipse.jetty.server.Server.handle(Server.java:505)
plantuml         |      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
plantuml         |      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
plantuml         |      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
plantuml         |      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
plantuml         |      at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
plantuml         |      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
plantuml         |      at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
plantuml         |      at java.lang.Thread.run(Thread.java:748)
plantuml         | formula=I(x, y) = I(x, y) // 2^n
plantuml         | Latex={I}{\left({x},{y}\right)}={I}{\left({x},{y}\right)}/{2}^{{n}}

So there must be another place for copying the files?

@tphani
Copy link

tphani commented Dec 13, 2019

Sorry, if I was not clear. As plant uml is running inside Jetty as a webapp (war file), there is no way of copying the jars into it. We need to build the war with the dependent jars and for that the docker file needs to be modified accordingly. I will try to do this and share in couple of days.

@ttobsen
Copy link
Author

ttobsen commented Dec 13, 2019

Alright, thanks. I'm a total noob with this whole Jetty stuff. If you need any help for testing let me know. 😃

@tphani
Copy link

tphani commented Dec 13, 2019

As we cannot add the libs directly to Jetty, I have added them as dependencies to pom.xml as below in the dependencies section:

    <dependency>
    	<groupId>org.scilab.forge</groupId>
    	<artifactId>jlatexmath</artifactId>
    	<version>1.0.7</version>
    </dependency>
    <dependency>
    	<groupId>org.scilab.forge</groupId>
    	<artifactId>jlatexmath-font-greek</artifactId>
    	<version>1.0.7</version>
    </dependency>
    <dependency>
    	<groupId>org.scilab.forge</groupId>
    	<artifactId>jlatexmath-font-cyrillic</artifactId>
    	<version>1.0.7</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
	<artifactId>batik-all</artifactId>
	<version>1.12</version>
    </dependency>

Now build the docker image: docker build -t plantumlwithmath .

And run it: docker run --rm -d -p 8080:8080 --name pu plantumlwithmath

This works well for me, not sure if there is any simple way of doing it.

Thanks!

@ttobsen
Copy link
Author

ttobsen commented Dec 14, 2019

Hi @tphani, I just tested it, and it works perfectly. I will create a PR and hope that the changes are finding its way into the repo very soon.

@TimSoethout
Copy link

I would love to have this feature. Any progress on merging this?

NateScarlet added a commit to NateScarlet/plantuml-server that referenced this issue Mar 16, 2020
@tphani
Copy link

tphani commented May 4, 2020

Sorry it took so long, but I managed to get the alternate way of copying the jar files into the container working fine. Till the changes make it to the official repo, we can do this:

  1. Start and stop the container
    docker run -p 8080:8080 --name puml plantuml/plantuml-server:tomcat
  2. Download the jar files from site and unzip (say ~/downloads/jlatex)
  3. Copy the jar files to the container
    docker cp ~/downloads/jlatex/. puml:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib
    Where
    ~/downloads/jlatex - is the folder containing the jar files. Also note the "." at the end
    puml - is the container name
  4. Start the container back
    docker container start puml

We will loose the changes if we remove the container, but we can run latest version of puml without building it.

@ttobsen
Copy link
Author

ttobsen commented Jul 26, 2020

And for the jetty image, use /var/lib/jetty/lib/ext instead of /usr/local/tomcat/webapps/ROOT/WEB-INF/lib :-)

arnaudroques pushed a commit that referenced this issue Jul 27, 2020
HeinrichAD pushed a commit to HeinrichAD/plantuml-server that referenced this issue Jul 19, 2023
HeinrichAD pushed a commit to HeinrichAD/plantuml-server that referenced this issue Jul 19, 2023
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

Successfully merging a pull request may close this issue.

4 participants