Search code examples
wildflywildfly-10

wildfly with java 1.8 in vscode


I'm trying to use a wildfly 10.0.0 final server with java 1.8 in vscode. What happens is that I can't use the server because the red hat extension that is used to add the server only runs with java 11 onwards. But if I use a more current java, my application will stop working. Has anyone used wildfly in vscode with java 1.8?

I already tried to change the java version in the "settings.jason" file, but when I try to upload the wildfly, I get the following error - "Unable to start the server: Extension backend error - server can not be started: server wildfly 10. x is not compatible with discovered java version 11.0.16. this server requires a java version between 1.8 and 1.8 inclusive. you may change a server's launch vm by setting the 'vm.install.path' property in a server's rsp configuration file."


Solution

  • you can try follow this steps:

    1. Download Plug-in from extensions store in visual code: RED HAT SERVER CONNECTOR, its will require download java jdk 11;
    2. In a VSCode type

    ctrl + shift + p

    Search by settings.json (configuration file of user vscode):

    Add this line bellow, indicating the path to the jdk11 used by Redhat Server Connector Plugin :

    "rsp-ui.rsp.java.home": "C:\PATH_TO_JDK11\java-11-openjdk-11",

    1. In the SERVERS tab (below the explorer, in a bottom right corner) click -->(...) --> Create New Server:
    • select from disk, search for wildfly folder*
    • then enter data, server name, configuration file(standalone-THAT-YOU-USE.xml), directory java jdk8 (some times the same as JAVA_HOME), that selected version will be used by you version of wildflyXX.

    Your server's configuration file on the right click on the Wildfly Server (named by you), and bellow Red Hat Server Connector, (when the server is stopped)

    click --> Edit server

    , its have to be similar to the json below:

    {
      "args.override.boolean": "false",
      "args.program.override.string": "-mp \"c:\\Desenvolvimento\\wildfly-14.0.1.Final\\modules\" org.jboss.as.standalone -b localhost --server-config=standalone-full-ha.xml",
      "args.vm.override.string": "\"-Dprogram.name=rsp:WildFly 14.x -teste\" -server -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true \"-Dorg.jboss.boot.log.file=c:\\Desenvolvimento\\wildfly-14.0.1.Final\\standalone\\log\\boot.log\" \"-Dlogging.configuration=file:c:\\Desenvolvimento\\wildfly-14.0.1.Final\\standalone\\configuration\\logging.properties\" \"-Djboss.home.dir=c:\\Desenvolvimento\\wildfly-14.0.1.Final\" -Dorg.jboss.logmanager.nocolor=true -Djboss.bind.address.management=localhost -Djboss.http.port=\"8080\"",
      "id": "WildFly 14.x -teste",
      "id-set": "true",
      "jboss.server.host": "localhost",
      "jboss.server.port": "8080",
      "org.jboss.tools.rsp.server.typeId": "org.jboss.ide.eclipse.as.wildfly.140",
      "server.autopublish.enabled": "false",
      "server.autopublish.inactivity.limit": "1000",
      "server.home.dir": "c:\\Desenvolvimento\\wildfly-14.0.1.Final",
      "server.timeout.shutdown": "120000",
      "server.timeout.startup": "120000",
      "vm.install.path": "c:\\Program Files\\Java\\jdk1.8.0_202",
      "wildfly.publish.restart.pattern": "\\.class$|\\.jar$",
      "wildfly.server.config.file": "standalone-full-ha.xml",
      "wildfly.server.deploy.directory": ""
    }
    

    I hope this can help you.