5 Replies Latest reply on Sep 13, 2011 12:21 AM by jaikiran pai

    NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException

    loargann Newbie

      Hi,

       

      I have a problem while I try to deploy an EJB.jar on JBoss7.

      JBoss is running in standalone mode,

      I have installed a JDBC driver as a module and  and deploy mysql-connector-java-5.1.17-bin.jar:  it seams to be ok :Deployed "mysql-connector-java-5.1.17-bin.jar"

      but deployment of my "EJB-ARMv4.jar" doesn't work  :  NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException.

      which is in mysql-connector-java-5.1.17-bin.jar

       

      If someone has an idea..

       

       

       

      root@debian:/home/test/jboss-as-7.0.1.Final/bin# ./standalone.sh

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

       

        JBoss Bootstrap Environment

       

        JBOSS_HOME: /home/test/jboss-as-7.0.1.Final

       

        JAVA: java

       

        JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInt

      3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman

       

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

       

      15:39:54,931 INFO  [org.jboss.modules] JBoss Modules version 1.0.1.GA

      15:39:55,339 INFO  [org.jboss.msc] JBoss MSC version 1.0.0.GA

      15:39:55,395 INFO  [org.jboss.as] JBoss AS 7.0.1.Final "Zap" starting

      15:39:56,722 WARN  [org.jboss.as] No security realm defined for native management service, all access will be unrestricted.

      15:39:56,832 INFO  [org.jboss.as] creating http management service using network interface (management) port (9990)

      15:39:56,834 WARN  [org.jboss.as] No security realm defined for http management service, all access will be unrestricted.

      15:39:56,854 INFO  [org.jboss.as.logging] Removing bootstrap log handlers

      15:39:56,880 INFO  [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying non-JDBC-compliant driver class com.mysql.jdbc.Dr

      version 5.1)

      15:39:56,885 INFO  [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying JDBC-compliant driver class org.h2.Driver (versio

      15:39:56,900 INFO  [org.jboss.as.clustering.infinispan.subsystem] (Controller Boot Thread) Activating Infinispan subsystem.

      15:39:57,155 INFO  [org.jboss.as.naming] (Controller Boot Thread) Activating Naming Subsystem

      15:39:57,165 INFO  [org.jboss.as.naming] (MSC service thread 1-2) Starting Naming Service

      15:39:57,169 INFO  [org.jboss.as.osgi] (Controller Boot Thread) Activating OSGi Subsystem

      15:39:57,201 INFO  [org.jboss.as.security] (Controller Boot Thread) Activating Security Subsystem

      15:39:57,207 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 3.2.0.Beta2

      15:39:57,236 INFO  [org.xnio] (MSC service thread 1-2) XNIO Version 3.0.0.Beta3

      15:39:57,288 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.0.0.Beta3

      15:39:57,600 INFO  [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-2) The Apache Tomcat Native library which allows optimal perfo

      in production environments was not found on the java.library.path: /root/jre1.6.0_25/lib/i386/server:/root/jre1.6.0_25/lib/i386:/root/jre1.6.0_25/../l

      6:/usr/java/packages/lib/i386:/lib:/usr/lib

      15:39:57,661 INFO  [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem

      15:39:57,689 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) Listening on /192.168.140.190:9999

      15:39:57,790 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Démarrage de Coyote HTTP/1.1 sur http--192.168.140.190-8080

      15:39:57,892 INFO  [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-2) Starting remote JMX connector

      15:39:58,151 INFO  [org.jboss.as.connector] (MSC service thread 1-2) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)

      15:39:58,250 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:jboss/datasources/MySqlDS]

      15:39:58,250 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:jboss/datasources/ExampleDS]

      15:39:58,960 INFO  [org.jboss.as.deployment] (MSC service thread 1-1) Started FileSystemDeploymentService for directory /home/test/jboss-as-7.0.1.Final

      alone/deployments

      15:39:58,987 INFO  [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.1.Final "Zap" started in 4386ms - Started 98 of 153 services (55 services are p

      or on-demand)

      15:40:14,012 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "mysql-connector-java-5.1.17-bin.jar"

      15:40:14,292 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api dependency to mysql-connector-java-5.1.17-bin.jar

      15:40:14,349 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (ve

      5.1)

      15:40:14,433 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "mysql-connector-java-5.1.17-bin.jar"

      15:40:24,465 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "EJB-ARMv4.jar"

      15:40:24,545 INFO  [org.jboss.jpa] (MSC service thread 1-2) read persistence.xml for allrole

      15:40:24,690 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api, javaee.api, org.jboss.as.jpa, org.javassist dependencies to

      RMv4.jar

      15:40:24,691 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) added (default provider) org.hibernate dependency to application deployment (since 1 PU(

      n't specify jboss.as.jpa.providerModule)

      15:40:24,691 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) added org.hibernate dependency to application deployment

      15:40:24,715 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session

      amed RoleBean in deployment unit deployment "EJB-ARMv4.jar" are as follows:

       

              java:global/EJB-ARMv4/RoleBean!com.devoteam.armv4.ejb.RoleBeanRemote

              java:app/EJB-ARMv4/RoleBean!com.devoteam.armv4.ejb.RoleBeanRemote

              java:module/RoleBean!com.devoteam.armv4.ejb.RoleBeanRemote

              java:global/EJB-ARMv4/RoleBean

              java:app/EJB-ARMv4/RoleBean

              java:module/RoleBean

       

      15:40:24,726 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."EJB-ARMv4.jar".INSTAL

      .jboss.msc.service.StartException in service jboss.deployment.unit."EJB-ARMv4.jar".INSTALL: Failed to process phase INSTALL of deployment "EJB-ARMv4.ja

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

              at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_25]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_25]

              at java.lang.Thread.run(Unknown Source) [:1.6.0_25]

      Caused by: java.lang.RuntimeException: Error getting reflective information for class com.devoteam.armv4.ejb.RoleBean

              at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)

              at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:163)

              at org.jboss.as.ee.component.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:134)

              at org.jboss.as.ee.component.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:114)

              at org.jboss.as.ee.component.LazyValue.get(LazyValue.java:40)

              at org.jboss.as.ee.component.EEApplicationDescription.getClassConfiguration(EEApplicationDescription.java:183)

              at org.jboss.as.ejb3.component.stateless.StatelessComponentDescription.createConfiguration(StatelessComponentDescription.java:76)

              at org.jboss.as.ee.component.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:63)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

              ... 5 more

      Caused by: java.lang.NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException

              at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_25]

              at java.lang.Class.privateGetDeclaredMethods(Unknown Source) [:1.6.0_25]

              at java.lang.Class.getDeclaredMethods(Unknown Source) [:1.6.0_25]

              at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65)

              at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66)

              ... 13 more

      Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException from [Module "deployment.EJB-ARMv4.jar:main" from Serv

      dule Loader]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

              ... 18 more

       

      15:40:24,934 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "EJB-ARMv4.jar" was rolled back with failure message

      ed services" => {"jboss.deployment.unit.\"EJB-ARMv4.jar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"EJB-ARMv

      ".INSTALL: Failed to process phase INSTALL of deployment \"EJB-ARMv4.jar\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context

      comp.EJB-ARMv4.EJB-ARMv4.RoleBean.Validator missing [ jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean ]","jboss.naming.context.java.comp.EJ

      4.EJB-ARMv4.RoleBean.ValidatorFactory missing [ jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean ]"]}

      15:40:24,935 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) Service status report

         New missing/unsatisfied dependencies:

            service jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean (missing)

        Services which failed to start:

            service jboss.deployment.unit."EJB-ARMv4.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."EJB-ARMv4.jar".INST

      ailed to process phase INSTALL of deployment "EJB-ARMv4.jar"

       

      15:40:24,937 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {

      tion step-2" => {"Failed services" => {"jboss.deployment.unit.\"EJB-ARMv4.jar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.depl

      .unit.\"EJB-ARMv4.jar\".INSTALL: Failed to process phase INSTALL of deployment \"EJB-ARMv4.jar\""},"Services with missing/unavailable dependencies" =>

      s.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean.Validator missing [ jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean ]","jboss.namin

      ext.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean.ValidatorFactory missing [ jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean ]"]}}}

      15:40:24,944 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Stopped deployment EJB-ARMv4.jar in 8ms

      15:40:24,945 INFO  [org.jboss.as.controller] (MSC service thread 1-1) Service status report

         Newly corrected services:

            service jboss.naming.context.java.comp.EJB-ARMv4.EJB-ARMv4.RoleBean (no longer required)

        • 1. Re: NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException
          Gonne Martens Novice

          How did you configure your datasource in standalone.xml ?

           

          Regards,

          Gonne

          • 2. Re: NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException
            loargann Newbie

            Hi,

             

            datasource configuration  in standalone.xm :

             

                <subsystem xmlns="urn:jboss:domain:datasources:1.0">
                    <datasources>
                        <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                            <connection-url>
                                jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
                            </connection-url>
                            <driver>
                                h2
                            </driver>
                            <pool>
                                <prefill>
                                    false
                                </prefill>
                                <use-strict-min>
                                    false
                                </use-strict-min>
                                <flush-strategy>
                                    FailingConnectionOnly
                                </flush-strategy>
                            </pool>
                            <security>
                                <user-name>
                                    sa
                                </user-name>
                                <password>
                                    sa
                                </password>
                            </security>
                        </datasource>
                        <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                            <connection-url>
                                jdbc:mysql://localhost:3306/DB_BSM
                            </connection-url>
                            <driver>
                                com.mysql
                            </driver>
                            <pool>
                                <prefill>
                                    false
                                </prefill>
                                <use-strict-min>
                                    false
                                </use-strict-min>
                                <flush-strategy>
                                    FailingConnectionOnly
                                </flush-strategy>
                            </pool>
                            <security>
                                <user-name>
                                    mysql_bsm
                                </user-name>
                                <password>
                                    mysql_bsm
                                </password>
                            </security>
                            <validation>
                                <validate-on-match>
                                    false
                                </validate-on-match>
                                <background-validation>
                                    false
                                </background-validation>
                                <use-fast-fail>
                                    false
                                </use-fast-fail>
                            </validation>
                        </datasource>
                        <drivers>
                            <driver name="com.mysql" module="com.mysql">
                                <xa-datasource-class>
                                    com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
                                </xa-datasource-class>
                            </driver>
                            <driver name="h2" module="com.h2database.h2">
                                <xa-datasource-class>
                                    org.h2.jdbcx.JdbcDataSource
                                </xa-datasource-class>
                            </driver>
                        </drivers>
                    </datasources>
                </subsystem>
            • 3. Re: NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException
              Carlo de Wolf Master

              You need to explicitcly add the mysql-connector-java-5.1.17-bin.jar deployment as a dependency in the EJB deployment.

               

              Manifest-Version: 1.0
              Dependencies: deployment.mysql-connector-java-5.1.17-bin.jar
              

               

              You may not like this and technically you can argue that you are not required to do this (EE.8.3.2 bullet 5 / AS7-1282 (ignoring the rar bits)).

              But that would mean that multiple versions of a deployed mysql connector would get in each others way.

               

              I'm curious though if people have other ideas.

              • 5. Re: NoClassDefFoundError: com/mysql/jdbc/exceptions/MySQLSyntaxErrorException
                jaikiran pai Master

                I don't see why com.devoteam.armv4.ejb.RoleBean has a hard dependency on MySQL classes. What does the imports and code look like in that bean class?