java 将 WildFly 应用服务器与 NetBeans IDE 结合使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26447519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 09:56:52  来源:igfitidea点击:

Using the WildFly application server with NetBeans IDE

javanetbeanswildflywildfly-8netbeans-8

提问by Tiny

I was accustomed to using GlassFish server all the times. I'm migrating a Java EE application from GlassFish (4.0) to WildFly 8.1.0 final.

我习惯于一直使用 GlassFish 服务器。我正在将 Java EE 应用程序从 GlassFish (4.0) 迁移到 WildFly 8.1.0 final。

I tried using WildFly 8.1.0 final on NetBeans 8.0 using this pluginfor the server, since there was no built-in plugin for the server.

我尝试在 NetBeans 8.0 上使用 WildFly 8.1.0 final将此插件用于服务器,因为服务器没有内置插件。

Unlike GlassFish, the application is however, not deployed on saving project data even though the deploy on saveoption on the IDE is enabled. The application leads to very strange/unknown/unusual problems. For example, this questionis full of (merely) some of those problems.

然而,与 GlassFish 不同,即使在 IDE 上启用了保存时部署选项,应用程序也不会在保存项目数据时部署。该应用程序会导致非常奇怪/未知/不寻常的问题。例如,这个问题充满了(仅仅)其中一些问题。

I upgraded NetBeans to 8.0.1 (with JSF to 2.2.8-02) which has a built-in WildFly-Plugin but it also brought all most no difference anyway than the previous version of the IDE.

我将 NetBeans 升级到 8.0.1(JSF 升级到 2.2.8-02),它有一个内置的 WildFly-Plugin,但它也带来了与以前版本的 IDE 几乎没有区别。

In this commentof a bug report, it is mentioned that a fix was made by changing/adding some XML corresponding to a JDBC driver as follows,

这个错误报告的评论中,提到通过更改/添加一些与 JDBC 驱动程序相对应的 XML 来进行修复,如下所示,

<driver name="mysql" module="com.mysql">
  <xa-datasource-class>
    com.mysql.jdbc.jdbc2.optional.MysqlDataSource
  </xa-datasource-class>
</driver>

I also made this change to the standalone-full.xmlfile. This particular part looks like as follows.

我也对standalone-full.xml文件进行了此更改。这个特定的部分如下所示。

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
    <datasources>
        <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
            <driver>h2</driver>
            <security>
                <user-name>sa</user-name>
                <password>sa</password>
            </security>
        </datasource>

        <datasource jta="false" jndi-name="java:/jdbc/project_datasource" pool-name="project_datasource" enabled="true" use-ccm="false">
            <connection-url>jdbc:mysql://localhost:3306/projectdb</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <driver>mysql</driver>
            <pool>
                <min-pool-size>5</min-pool-size>
                <max-pool-size>15</max-pool-size>
            </pool>
            <security>
                <user-name>root</user-name>
                <password>root</password>
            </security>
            <validation>
                <validate-on-match>false</validate-on-match>
                <background-validation>false</background-validation>
            </validation>
            <statement>
                <share-prepared-statements>false</share-prepared-statements>
            </statement>
        </datasource>
        <drivers>
            <driver name="h2" module="com.h2database.h2">
                <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
            </driver>
            <driver name="mysql" module="com.mysql">
                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>
            </driver>
        </drivers>
    </datasources>
</subsystem>

But all in vain. Doing so made nothing new.

但这一切都是徒劳的。这样做并没有什么新鲜事。

Anyway, is it possible to use WildFly (8.1.0 or higher, whenever available) with NetBeans for now (maybe by making somewhere some changes)?

无论如何,现在是否可以在 NetBeans 中使用 WildFly(8.1.0 或更高版本,只要可用)(也许通过在某处进行一些更改)?

It appears that I'm almost left with staying away with WildFly for now. Is it? :)

看来我现在几乎要远离 WildFly 了。是吗?:)

I do not precisely know whether the plugin is the problem or not. It might be something different.

我不知道插件是否有问题。它可能是不同的东西。



Update :

更新 :

It took me at least three weeks to encounter this situation. So, please do not think that the entire thing I wrote here is wrong/meaningless, if you could not reproduce the same thing just within a moment (as mentioned in the linked question- including the strike-through text) - I just cannot say anything more about it.

我至少花了三个星期才遇到这种情况。所以,请不要认为我在这里写的整件事是错误的/毫无意义的,如果你不能在一瞬间复制同样的东西(如链接问题中提到的- 包括删除线文本) - 我只是不能说关于它的更多信息。

One of the reproducible things : if some changes to an existing application are made, the application is not (automatically) deployed to the server, if those changes are saved (not to mention that the deploy on saveoption is enabled in the IDE) - but that's just one simplest thing and cannot be relied upon, even though happens correctly.

可重现的事情之一:如果对现有应用程序进行了一些更改,则该应用程序不会(自动)部署到服务器,如果这些更改被保存(更不用说在 IDE 中启用了保存时部署选项)-但这只是一件最简单的事情,即使正确发生,也不能依赖。

Apparently the plugin does not interact/communicate with the IDE in a way that it should (as happens correctly, when using GlassFish Server, for example).

显然,该插件没有以应有的方式与 IDE 交互/通信(例如,在使用 GlassFish Server 时正确发生)。

回答by Draken

Just a warning, as I missed this and was tearing my hair out on this. Wildfly uses port 9990 for debug management as default, this however causes a problem if you have an Nvidia device as the Nvidia network service also uses 9990.

只是一个警告,因为我错过了这个并且正在为此撕毁我的头发。Wildfly 默认使用端口 9990 进行调试管理,但是如果您有 Nvidia 设备,这会导致问题,因为 Nvidia 网络服务也使用 9990。

To fix it, I've stopped the Nvidia network service (In task manager) and my Netbeans (8.1) can now connect to the wildfly server and no longer falls over.

为了修复它,我已经停止了 Nvidia 网络服务(在任务管理器中)并且我的 Netbeans (8.1) 现在可以连接到 wildfly 服务器并且不再失败。

You can also change the ports that wildfly uses, to stop the conflict. If you are using the standalone.xml file, change the following line:

您还可以更改wildfly 使用的端口,以阻止冲突。如果您使用的是 standalone.xml 文件,请更改以下行:

<socket-binding name="management-http"
    interface="management"
    port="${jboss.management.http.port:9990}"/>

And change the port number to your choosing. Now in NetBeans, when you choose to add the server and get to the Instance Properties, make sure you set the management port to the same as what you have set in the config file. I chose 9991 and had no issues so far.

并将端口号更改为您选择的。现在在 NetBeans 中,当您选择添加服务器并访问实例属性时,请确保将管理端口设置为与您在配置文件中设置的相同。我选择了 9991,到目前为止没有任何问题。

(I posted here as this was the first result I kept coming to when searching for fixing the issue)

(我在这里发布,因为这是我在寻找解决问题时不断出现的第一个结果)

回答by Arun Gupta

I'd encourage you to file a bug at:

我鼓励您在以下位置提交错误:

https://netbeans.org/bugzilla/enter_bug.cgi?product=serverplugins

https://netbeans.org/bugzilla/enter_bug.cgi?product=serverplugins

and use WildFly as the category.

并使用 WildFly 作为类别。

Have you tried running WildFly using a CLI and see if your IDE related problems go away ?

您是否尝试过使用 CLI 运行 WildFly 并查看您的 IDE 相关问题是否消失?

回答by ehsavoie

First the wildFly plugin is distributed withe the Netbeans IDE 8.0.1 so the plugin you're using might be deprecated. Like Arun said, fill a bug with netbeans log / wildfly log and your config. There was an NPE in the parsing when the driver was defined in the datasource by its driver-class.

首先,wildFly 插件随 Netbeans IDE 8.0.1 一起分发,因此您正在使用的插件可能已被弃用。就像 Arun 说的那样,用 netbeans 日志/wildfly 日志和你的配置填充一个错误。当驱动程序由其驱动程序类在数据源中定义时,解析中有一个 NPE。