Giter Site home page Giter Site logo

Include js verticles in Java code about es4x HOT 5 OPEN

tpfau avatar tpfau commented on September 28, 2024
Include js verticles in Java code

from es4x.

Comments (5)

pmlopes avatar pmlopes commented on September 28, 2024

@tpfau You need:

 <dependency>
            <groupId>io.reactiverse</groupId>
            <artifactId>es4x</artifactId>
            <version>0.17.0</version>
        </dependency>

Perhaps I should fix that pom to require the main jar too. That dependency is just the generated code, all the vertx stack modules, so you don't need to pull them from NPM.

from es4x.

pmlopes avatar pmlopes commented on September 28, 2024

TASK: Investigate if we can add a dependency to the main jar, of if this would create a huge circular dependency problem.

from es4x.

tpfau avatar tpfau commented on September 28, 2024

Thanks for the quick response.
This still causes the same error message.

Exception in thread "main" java.util.ServiceConfigurationError: io.vertx.core.spi.VerticleFactory: io.reactiverse.es4x.impl.JSVerticleFactory Unable to get public no-arg constructor

Interestingly, when I remove the es4x dependency completely, the deployment succeeds (well vertx starts to run), however, when then trying to access the verticle via the eventbus it fails, indicating that there was no consumer registered at the given address.

from es4x.

tpfau avatar tpfau commented on September 28, 2024

@pmlopes are there any examples using vert.x 4 with es4x combining Java and Javascript verticles using maven as a build tool?
The only example I have found that actually combined js and java was for vert.x 3 by Devon Philipps in his Introduction to Vert.x. youtube series. Following that example and replacing the old lang-js dependency by es4x I end up with the above issue.

from es4x.

tpfau avatar tpfau commented on September 28, 2024

Hi,
Coming back to this:
I managed to get the js verticle to work.

What I needed to add were dependencies for graalvm:

<dependency>
    <groupId>org.graalvm.sdk</groupId>
    <artifactId>graal-sdk</artifactId>
    <version>22.0.0.2</version>
</dependency>
<dependency>
    <groupId>org.graalvm.js</groupId>
    <artifactId>js</artifactId>
    <version>22.0.0.2</version>
</dependency>

Which es4x does not seem to depend on (should it)?
However, this gives me the following warning when launching the server:

The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.

I assume this is due to it running on java and not graalvm, but I'm currently not sure how best to change this (and actually if I should change this).

from es4x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.