4 Replies Latest reply on May 22, 2012 10:53 AM by Emmanuel Comba

    How to get a reference to JDBC Driver deployed in standalone/deployments within an EAR lib jar.

    Emmanuel Comba Newbie

      Hi everybody!

       

      I am a newbie in JBoss. I have installed the last 7.1 version and have successfully deployed some JDBC 4 Drivers under the standalone/deployments ordner.

      I have deployed an EAR application all works fine. (Web Services etc...)

      In the EAR lib there is a jar that has to get a reference to the JDBC Drivers. I have to work directly with Hibernate to get a SchemaUpdate Object there and to generate an Update DDL Schema.

      For example jtds-1.2.5.jar is deployed an I have to access the following Class: net.sourceforge.jtds.jdbc.Driver.

       

      I get a ClassNotFoundException as soon as I try to reference the driver with: Class<?> driver =Thread.currentThread().getContextClassLoader().loadClass("net.sourceforge.jtds.jdbc.Driver");

       

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

      org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

      org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

      org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

      org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

      ch.soreco.architecture.xdbu.SchemaGenerator.getUpdateDDL(SchemaGenerator.java:446)

      ch.soreco.architecture.xdbu.DDLManager.getUpdateDDL(DDLManager.java:50)

      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      java.lang.reflect.Method.invoke(Method.java:597)

      org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)

      org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

      org.jboss.as.webservices.invocation.AbstractInvocationHandlerEJB.invoke(AbstractInvocationHandlerEJB.java:112)

      org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:181)

      org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)

      org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

      java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

      java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

      java.util.concurrent.FutureTask.run(FutureTask.java:138)

      org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

      org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)

      org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)

      org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

      org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)

      org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)

      org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)

      org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)

      org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)

      org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

      org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)

      org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      java.lang.Thread.run(Thread.java:662)

       

      Calling the Hibernate SchemaUpdate.execute() method throws the following exception:

      ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (http--127.0.0.1-28080-1) HHH000299: Could not complete schema update: org.hibernate.HibernateException: Specified JDBC Driver net.sourceforge.jtds.jdbc.Driver class not found

                at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:55) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_23]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_23]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_23]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_23]

                at ch.soreco.architecture.xdbu.SchemaGenerator.getUpdateDDL(SchemaGenerator.java:478) [xdbupdate.jar:]

                at ch.soreco.architecture.xdbu.DDLManager.getUpdateDDL(DDLManager.java:50) [filemanager.jar:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_23]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_23]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_23]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_23]

                at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.webservices.invocation.AbstractInvocationHandlerEJB.invoke(AbstractInvocationHandlerEJB.java:112)

                at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:181)

                at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)

                at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_23]

                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_23]

                at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_23]

                at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

                at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)

                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)

                at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

                at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)

                at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)

                at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)

                at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)

                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)

                at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)

                at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.3.GA.jar:2.0.3.GA]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]

      Caused by: java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver from [Module "org.hibernate:main" from local module loader @46b8c8e6 (roots: D:\jboss-as-7.1.1.Final\modules)]

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

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

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

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

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

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

                at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_23]

                at java.lang.Class.forName(Class.java:169) [rt.jar:1.6.0_23]

                at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:101) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

       

      I have tried with and without Dependencies&Class-Path in the jar lib Manifest, the same Exception is thrown.

      Manifest-Version: 1.0

      Dependencies: net.sourceforge.jtds.jdbc.Driver

      Class-Path: jtds-1.2.5.jar

       

      Can someone tells how to reference the Drivers there?

       

      Thanks a lot in advance!

       

      Emmanuel

        • 1. Re: How to get a reference to JDBC Driver deployed in standalone/deployments within an EAR lib jar.
          Wolf-Dieter Fink Master

          It should work if you add the driver as module, see this document.

          I'm not sure at the moment how to do it if the driver is deployed.

          1 of 1 people found this helpful
          • 2. Re: How to get a reference to JDBC Driver deployed in standalone/deployments within an EAR lib jar.
            Emmanuel Comba Newbie

            Hi,

            Thanks a lot for your answer.

            Unfortunately it did not work...

             

            I have removed the jtds-1.2.5.jar from the "Managed Deployments"

            I have deployed the jtds-1.2.5.jar as module under jboss-as-7.1.1.Final/modules/net/sourceforge/jtds/main , a new jtds-1.2.5.jar.index file was automatically created, reflecting the internal jar structure:

            net/sourceforge

            net

            META-INF

            net/sourceforge/jtds/jdbc/cache

            net/sourceforge/jtds/test

            net/sourceforge/jtds/jdbcx

            META-INF/services

            net/sourceforge/jtds/ssl

            net/sourceforge/jtds/jdbc

            net/sourceforge/jtds/jdbcx/proxy

            net/sourceforge/jtds

            net/sourceforge/jtds/util

             

            (This discussion was also helpfull: https://community.jboss.org/message/617978)

             

            My Datasource can connect to the DB without problem (Connection test).

            So it seems to be well deployed as Module.

            I still have exactly the same problem...

            The Classes located into the EAR/lib/ xxx.jar cannot load the driver.

             

            I will continue to search... I will post the solution, if I find it

             

            Emmanuel

            • 3. Re: How to get a reference to JDBC Driver deployed in standalone/deployments within an EAR lib jar.
              Justin Bertram Master

              If you actually need to access these classes in your application then you'll have to set a dependency on this module.  Normally applications don't need direct access to JDBC driver classes because they are hidden behind the JDBC datasource accessed via JNDI.

              • 4. Re: How to get a reference to JDBC Driver deployed in standalone/deployments within an EAR lib jar.
                Emmanuel Comba Newbie

                Hi thanks a lot!

                 

                So the deployment as Module + dependency in the standalone.xml has solved a first part of the Problem!

                I can access the driver Class with

                Class<?> driver =Thread.currentThread().getContextClassLoader().loadClass("net.sourceforge.jtds.jdbc.Driver");

                 

                I have still some problems with the hbm2ddl.SchemaUpdate Class that still cannot find it...

                16:43:08,176 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (http--127.0.0.1-28080-1) HHH000319: Could not get database metadata: java.sql.SQLException: No suitable driver found for jdbc:jtds:sqlserver://boldbsrv01:1433/filemanager

                          at java.sql.DriverManager.getConnection(DriverManager.java:602) [rt.jar:1.6.0_23]

                          at java.sql.DriverManager.getConnection(DriverManager.java:154) [rt.jar:1.6.0_23]

                          at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:173) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:55) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                 

                ...

                16:43:08,207 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (http--127.0.0.1-28080-1) HHH000299: Could not complete schema update: java.sql.SQLException: No suitable driver found for jdbc:jtds:sqlserver://boldbsrv01:1433/filemanager

                          at java.sql.DriverManager.getConnection(DriverManager.java:602) [rt.jar:1.6.0_23]

                          at java.sql.DriverManager.getConnection(DriverManager.java:154) [rt.jar:1.6.0_23]

                          at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:173) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:55) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                ...

                 

                But this is more "hibernate tool" specific...

                I will search deeper.

                 

                Regards

                 

                Emmanuel