4 Replies Latest reply on Jan 14, 2016 10:30 AM by mr mcwolf

    Error installing application with netbeans 8.1 and Ant

    mr mcwolf Newbie

      Hello,
      I try to deploy the application from netbeans 8.1 (with ant) of wildfly 9.0.2.Final but I get error:


      /home/office/NetBeansProjects/TestApp/nbproject/build-impl.xml:1045:

      java.lang.NoClassDefFoundError: javax/resource/ResourceException

          at java.lang.Class.forName0(Native Method)

          at java.lang.Class.forName(Class.java:348)

          at org.netbeans.modules.db.explorer.DbDriverManager.getDriver(DbDriverManager.java:228)

          at org.netbeans.api.db.explorer.JDBCDriver.getDriver(JDBCDriver.java:138)

          at org.netbeans.modules.javaee.wildfly.config.WildflyDatasource.guessDriverClassname(WildflyDatasource.java:94)

          at org.netbeans.modules.javaee.wildfly.config.WildflyDatasource.<init>(WildflyDatasource.java:84)

          at org.netbeans.modules.javaee.wildfly.config.xml.ds.WildflyDatasourcesHandler.endElement(WildflyDatasourcesHandler.java:110)

          at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

          at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1783)

          at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2970)

          at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)

          at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)

          at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)

          at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)

          at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

          at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

          at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)

          at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)

          at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)

          at org.netbeans.modules.javaee.wildfly.config.xml.ConfigurationParser.listDatasources(ConfigurationParser.java:81)

          at org.netbeans.modules.javaee.wildfly.config.WildflyDatasourceManager.getDatasources(WildflyDatasourceManager.java:115)

          at org.netbeans.modules.javaee.wildfly.config.WildflyDatasourceManager.deployDatasources(WildflyDatasourceManager.java:121)

          at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.deployDatasources(ServerInstance.java:752)

          at org.netbeans.modules.j2ee.deployment.impl.DeploymentHelper.deployDatasources(DeploymentHelper.java:115)

          at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:239)

          at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)

          at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:111)

          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)

          at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:497)

          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

          at org.apache.tools.ant.Task.perform(Task.java:348)

          at org.apache.tools.ant.Target.execute(Target.java:435)

          at org.apache.tools.ant.Target.performTasks(Target.java:456)

          at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)

          at org.apache.tools.ant.Project.executeTarget(Project.java:1364)

          at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

          at org.apache.tools.ant.Project.executeTargets(Project.java:1248)

          at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)

          at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)

          at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)

      Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException

          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

          ... 42 more

       

      Can anybody help to eliminate the problem?

        • 1. Re: Error installing application with netbeans 8.1 and Ant
          Jay SenSharma Master

          It does not look like the error which you posted is occurring at the WildFly 9 logs? (please correct me if i am wrong)

           

          Also If you are getting this error on the NetBeans side then i would suggest you to please try adding the "$WILDFLY_HOME/modules/system/layers/base/javax/resource/api/main/jboss-connector-api_1.7_spec-1.0.0.Final.jar"    Jar in your Netbeans project classpath.

           

          By default the classes present inside this JAR are already available to all the applications that are deployed on WildFly.

           

           

          Additional Check

          =================

          It looks like the class "org.netbeans.modules.db.explorer.DbDriverManager"  wants to load "javax.resource.ResourceException" class.   So i would suggest you to check in which JAR the class "DbDriverManager" is present , If you have the class "DbDriverManager" in a custom module then you should add a dependency to that module as "javax.resource.api"

           

           

           

          regards

          Jay SenSharma

          • 2. Re: Error installing application with netbeans 8.1 and Ant
            mr mcwolf Newbie

            Yes, this is not the fault of the wildfly and of netbeans (why I have not given log on wildfly).
            jboss-connector-api_1.7_spec-1.0.0.Final.jar e plugged correctly to the libraries of the project.


            nb.png

            • 3. Re: Error installing application with netbeans 8.1 and Ant
              Jay SenSharma Master

              Hello,

               

              It looks like your Netbeans IDE is not able to find the JAR in it's classpath.

              As every NetBeans project has a directory with the name as "private" inside the "nbproject-directory".  That "private" directory contains a file with name "private.properties".

               

              Just for testing (and to isolate the issue) can you take those properties from this file and copy it into the Properties field of the Ant Invoke.   You might be having some properties like (Just verify if the WildFLy service is configured properly in Netbeans or not)

               

              libs.CopyLibs.classpath=C:/PATH/TO/NetBeans 8.1/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
              libs.MySQLDriver.classpath=C:/PATH/TO/MySQL/MySQL Connector J/mysql-connector-java-5.1.32-bin.jar
              j2ee.platform.is.jsr109=true
              j2ee.server.domain=C:/PATH/TO/Wildfly/standalone
              j2ee.server.home=C:/PATH/TO/Wildfly
              j2ee.server.instance=wildfly-deployer:localhost:8080#standalone&C:\\PATH\\TO\\Wildfly
              

               

              Regards

              Jay SenSharma

              • 4. Re: Error installing application with netbeans 8.1 and Ant
                mr mcwolf Newbie

                This is my private.property file

                My wildfly instaled in /home/office/bin/javaee/wildfly-9.0.2.Final