1 Reply Latest reply on Jul 2, 2017 7:17 AM by Wolfgang Mayer

    How to deplay a JDBC Driver that can be used by WepApp

    Dominic Weiser Newbie

      Hello,

       

      we are currently migrating from Tomcat to Wildfly 10 server. We like to take advantages of a Java EE Server. Currently we have some issues with the DataSource. We have deployed the JDBC Driver on Wildfly and set up the DataSource.

      That works mainly good, but we like to use DatabaseQueryNotification (Oracle).

       

      Now the problem I run into:

      When I package the Driver with my war (additionally), I get an ClassCastException because of mismatch of T4Connection and OracleConnection. Therefore I removed the JDBC-Driver from my War (maven -> scope: provided). But now my Application failed on Deployment, because of NoClassDefFound (see Stacktrace bellow).

       

      How can I make sure that the JDBC Driver can be found by the application?

       

      Thanks in advance!

       

      public class DBListener implements IDBListener, Runnable, DatabaseChangeListener, IPropertyListener, Serializable {
           @Resource(lookup = "java:/PlsDS")
           private DataSource dataSource;
           ...
                Connection tmpCon = dataSource.getConnection();
                connection = (OracleConnection) tmpCon.getMetaData().getConnection();
      }
      

       

      14:32:59,869 WARN  [org.jboss.modules] (MSC service thread 1-7) Failed to define class de.istec.pls.client.db.listener.DBListener in Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link de/istec/pls/client/db/listener/DBListener (Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader): oracle/jdbc/dcn/DatabaseChangeListener

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:422)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

          at org.jboss.modules.Module.loadModuleClass(Module.java:606)

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

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

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

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

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)

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

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

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

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

          at java.lang.Thread.run(Thread.java:745)

       

      14:32:59,871 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."client.pls-sc-1.0.0-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."client.pls-sc-1.0.0-SNAPSHOT.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "client.pls-sc-1.0.0-SNAPSHOT.war"

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

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

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

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

          at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.NoClassDefFoundError: Failed to link de/istec/pls/client/db/listener/DBListener (Module "deployment.client.pls-sc-1.0.0-SNAPSHOT.war:main" from Service Module Loader): oracle/jdbc/dcn/DatabaseChangeListener

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:422)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)

          at org.jboss.modules.Module.loadModuleClass(Module.java:606)

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

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

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

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

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)

          at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)

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