Ok, I see the issue. In maven when I added the dependency the other project it brings in all the implicit dependencies for build purposes. So I based module.xml on it. However, in AS7 module.xml class-loading, unless the "cli" module exposed the "org.jboss.as.controller-client" module as export = true in in its definition it will not be automatically exposed, thus the issue. Teiid should have direct dependeny on this module. When I tested, I always tested using the "adminshell" which brings in all the dependent jars (implicit and explicit) so it is not exposed there. Thank you for finding it. I will fix this for next release. I logged https://issues.jboss.org/browse/TEIID-2038
It is deployed as a module. JCA is able to load it and create connections to my database. However, I get ClassNotFoundExceptions at runtime while loading some class that is already part of the jdbc module. The only way I could work around this issue is to add a dependency on my jdbc driver module to teiid.main module. Here is what I did:
1. created a module com.lgc.ph.client (which includes all the jars it needs)
2. create a module com.lgc.ph.translator ( which has a dependency on com.lgc.ph.client exported="true")
3. added a <translator name="ph" module="com.lgc.ph.translator"/> to teiid subsystem
When I try to access my vdb, I get a ClassNotFoundException from module teiid.main for one of the classes in the custom jdbc driver. I thought ironjacamer (JCA) loads the driver and creates a connection, and Teiid is just using the connection.
Even when I tried to make my module a global module the exception did not go away. I finally added the dependency to teiid as a workaround (which I do not like).
Here is the exception..
javax.naming.NamingException: Could not load ejb proxy class com.lgc.dam.phs.common.interfaces.PhServerFactory [Root exception is java.lang.ClassNotFoundException: com.lgc.dam.phs.common.interfaces.PhServerFactory from [Module "org.jboss.teiid:main" from local module loader @2b76e552 (roots: C:\jboss-as-7.1.1.Final\modules)]]
... 18 more
So the flow is:
VDB->request connection from JCA->JCA creates connection using custom JDBC driver->JDBC Driver looks up an EJB->ejb proxy class loading fails.
As you can see from above, creating a connection to our datasource involves connecting to an EJB. But all of this happens inside the custom jdbc driver.