The bug with org/jruby/RubyInstanceConfig

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The bug with org/jruby/RubyInstanceConfig

amraalic
Hi everyone,

I am new at AsciiDoc. I am working on a project with Vaadin (Java web framework) and trying to connect Vaadin with Asciidoctor. Need to simple write some sentences in file and get the pdf version.

Here are the logs for the bug I receive:

java.lang.NoClassDefFoundError: org/jruby/RubyInstanceConfig
        at org.asciidoctor.internal.JRubyAsciidoctor.createOptimizedConfiguration(JRubyAsciidoctor.java:151)
        at org.asciidoctor.internal.JRubyAsciidoctor.createJRubyAsciidoctorInstance(JRubyAsciidoctor.java:114)
        at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:62)
        at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:647)
        at com.example.testasciidoctor.TestAsciiDoc.<init>(TestAsciiDoc.java:14)
        at com.example.testasciidoctor.TestasciidoctorUI$1.buttonClick(TestasciidoctorUI.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
        at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1003)
        at com.vaadin.ui.Button.fireClick(Button.java:394)
        at com.vaadin.ui.Button$1.click(Button.java:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
        at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:313)
        at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:202)
        at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:95)
        at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
        at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1408)
        at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:351)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.jruby.RubyInstanceConfig
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1313)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164)


Here is the code

package com.example.testasciidoctor;

import static org.asciidoctor.Asciidoctor.Factory.create;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Options;

import java.io.File;
import java.util.Collections;
import java.util.HashMap;

public class TestAsciiDoc {
       
        public TestAsciiDoc(){
        Asciidoctor asciidoctor = Asciidoctor.Factory.create();

        String rendered = asciidoctor.render("*This* is it.", Collections.EMPTY_MAP);
        System.out.println(rendered);
               
        }
}


I will appreciate any kind of help because I can not continue without the Asciidoctor.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: The bug with org/jruby/RubyInstanceConfig

abelsromero
Welcome :)

First, I am assuming you'r using maven or gradle to package your app.

I guess the error is because jruby-complete dependency is defined as "runtime" on Asciidoctorj module.
In your case, since you're deploying to a webapp, libraries as runtime are not included in the final application and thus the error, if you run the class as a main ¿does it work?
To fix it, try adding the dependency in your descriptor, it is maven, add:

        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <version>1.7.17</version>
            <scope>compile</scope>
        </dependency>
Asciidoctorj can work with other versions, but current stable version is aligned to 1.7.17.
Reply | Threaded
Open this post in threaded view
|

Re: The bug with org/jruby/RubyInstanceConfig

mojavelinux
Administrator

On Fri, Oct 16, 2015 at 8:24 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I guess the error is because jruby-complete dependency is defined as "runtime" on Asciidoctorj module.

Uh oh. This appeared to have changed when AsciidoctorJ 1.5.2 was released. I'm not sure if that was intentional or not. Something we surely need to discuss. Robert? wdyt? If we do decide to stay on this path, we need to document it in the README. Right now the README gives the impression that all you need to declare is the asciidoctorj dependency.

You are correct, though, the fix is simply to add jruby-complete as a dependency.

-Dan


--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: The bug with org/jruby/RubyInstanceConfig

amraalic
In reply to this post by abelsromero
Oh thank you so much, this is the solution. Now it works perfect!

Also, thank you for the warm welcome. :)