10 Replies Latest reply on Jul 16, 2015 4:27 AM by mayerw01

    Wildfly Database Connectivity... jboss.naming.context.java.module. missing

    ejpamin21

      Thank you in advance for your help. I’ve recently installed Wildfly to replace the Glassfish server I’m using for development. I’m having problems with mysql database connectivity. I’m able to create a datasource on Wildfly and connect to mysql, however, on netbeans it is a different story. Under “servers” I’m able to see the wildfly server and datasource connections but when I “run” the web app, I’m getting this error:

       

       

      Deploying C:\Users\Erniel\wildfly-8.2.0.Final\standalone\deployments\HST3.war

       

      {

       

      "JBAS014671: Failed services" => {"jboss.persistenceunit.\"HST3.war#HST3PU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"HST3.war#HST3PU\": javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table facility (fID integer not null auto_increment, facilityDesc varchar(100), facilityName varchar(50) not null, Organization_oID integer not null, primary key (fID))]

       

      Caused by: javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table facility (fID integer not null auto_increment, facilityDesc varchar(100), facilityName varchar(50) not null, Organization_oID integer not null, primary key (fID))]

       

      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'facility' already exists"},

       

      "JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.HST3.HST3.env.jdbc.hst3 is missing [jboss.naming.context.java.jboss.resources.jdbc.hst3]"]

       

      }

       

      C:\Users\Erniel\Documents\NetBeansProjects\HST3\nbproject\build-impl.xml:1045: The module has not been deployed.

       

      See the server log for details.

       

      BUILD FAILED (total time: 2 seconds)

       

       

       

      Also, when I attempt to create a persistence unit on the netbeans 8.0.2 IDE, my datasource does not show up on the dropdown box.

       

       

      It’s only the ExampleDS that shows up…

         

       

       

      Would you point me to a resource to help me solve this problem. The webapp worked on the Glassfish server before. Thank you again!

       

       

        • 1. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
          mayerw01

          You configured your PU with 'Table Generation Strategy: Create'. But the table 'facility' exists already. That's why the exception: "com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'facility' already exists" is thrown.

          Which datasource do you miss? I can see the ExampleDS in your Netbeans printout?

          • 2. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
            ejpamin21

            Hello Wolfgang, thanks for the response. I think the exception is thrown from a missing dependency. This web app runs well in Glassfish, however, when deployed to Wildfly I get this result...

             

            wildflyfaileddeploymentHST3.PNG

            I'm not sure how I can get this dependency resolved. Also, when I create a new web app and try to create a PU in it, I only get the ExampleDS listed on the dropbox, but not the java:jboss/datasources/HST3. I guess my main question would be, how do you get Netbeans IDE 8.0.2 to recognize the datasources configured on Wildfly? Thanks again!

            • 3. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
              mayerw01

              Erniel,

               

              this usually indicates that the configuration in WildFly is not correct.

              Did you configure the jdbc-driver? You may check this via jboss-cli. If you enter in standalone mode:

              /subsystem=datasources/jdbc-driver=mysql:read-resource

              you should get a feedback like

              "outcome" => "success",

                  "result" => {

                      "deployment-name" => undefined,

                      "driver-class-name" => "com.mysql.jdbc.Driver",

                      "driver-datasource-class-name" => undefined,

                      "driver-major-version" => undefined,

                      "driver-minor-version" => undefined,

                      "driver-module-name" => "com.mysql",

                      "driver-name" => "mysql",

                      "driver-xa-datasource-class-name" => undefined,

                      "jdbc-compliant" => undefined,

                      "module-slot" => undefined,

                      "xa-datasource-class" => "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"

               

              A command like:

              /subsystem=datasources/data-source=mysql:test-connection-in-pool

              should also provide more details to the root cause of your issue.

               

              The WildFly documentation (Documentation - WildFly 8 - Project Documentation Editor) provides more details

              1 of 1 people found this helpful
              • 4. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                ejpamin21

                Hello Wolfgang,

                 

                Thank you again for the response. Here's what I'm getting the with the commands you suggested...

                 

                wildflyds.PNG

                And the second command...

                wildflyds1.PNG

                I guess there's something wrong with the mysql configuration? Here's what my Wildfly admin console is showing...

                wildflyds2.PNG

                I'm going to look into the documentation more, but what do think is missing? Thanks again!

                • 5. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                  mayerw01

                  Sorry, I meant to replace 'mysql' with the actual datasource. So in your case the command should be:

                  /subsystem=datasources/data-source=HST3Pool:test-connection-in-pool

                  • 6. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                    ejpamin21

                    Hehehehe... it's ok, I entered the command as you suggested and this is what I get...

                     

                    wildflyds3.PNG

                    So it means my Wildlfly to MySQL connection is working? When the app gets deployed on Wildfly it is missing a dependency, I just can't figure out how to satisfy this dependency. Thank you again!

                    • 7. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                      mayerw01

                      So you Datasource connection is working.

                      And you get this message during deployment of your application, correct?

                      WildFly is complaining some configuration in your PU.

                      I'd suggest to check the persistence.xml  in the Source view.

                      Is your Datasource still pointing to the ExampleDS as shown above? But now I understand you'd like to connect to HST3Pool.

                      Did you check your server.log after the failure? This might also provide more details to the root cause.

                      • 8. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                        smarlow

                        You should look at the inner exception to (better) understand the cause of this confusing problem.  The error that you should solve is the:

                         

                        Caused by: javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table facility (fID integer not null auto_increment, facilityDesc varchar(100), facilityName varchar(50) not null, Organization_oID integer not null, primary key (fID))]

                         

                        Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'facility' already exists"},

                         

                        I agree with Wolfgang, that you should look at the persistence.xml to see if you caused this.  You can also show us the contents of your persistence.xml.  If you are running the MySQL database on Windows, I think the 'facility table name is stored as 'FACILITY' which could cause some confusion.

                         

                        You can also enable TRACE logging for the org.jboss.as.jpa and org.hibernate categories which gives more information in the application server console.  Instructions are here.

                         

                        Scott

                        • 9. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                          ejpamin21

                          Thank you Lord I finally got it to work. The problem was with my web.xml file... Here's the resource name of my Wildfly to MySQL connection...

                           

                          My web.xml file was using the old resource name which was "jdbc/hst3" when deployed under the Glassfish server. The web.xml file should use the Wildfly resource name "HST3POOL" under the Wildfly server as follows...

                          When the web app apparently looks up the "jdbc/hst3" resource name on the Wildfly it doesn't find it, thus giving me the error. But when I changed the web.xml to use the "HST3POOL" resource name on the Wildfly, the application is able to look it up and make the connection. Thank you guys for all your help, I guess we'll be happy sailing for now!

                          • 10. Re: Wildfly Database Connectivity... jboss.naming.context.java.module. missing
                            mayerw01

                            I'd not recommend to use web.xml for your jpa datasources. Those definitions should rather be placed in the persistence.xml