Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

java - Using the WildFly application server with NetBeans IDE

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.

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

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

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.

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

<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.xml file. This particular part looks like as follows.

<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)?

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

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 save option is enabled in the IDE) - but that's just one simplest thing and cannot be relied upon, even though happens correctly.

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).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.

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:

<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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...