8 Replies Latest reply: May 11, 2012 8:38 PM by Ramesh Reddy RSS

Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException

skethire Newbie

Hi.

I am using Teiid AdminAPI in my application.  When I try to initialize the Admin class in my code, I get the following exception.

 

11:34:50,406 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/dsdataserver].[OData]] (http--127.0.0.1-8080-2) Servlet.service() for servlet OData threw exception: java.lang.ClassNotFoundException: org.jboss.as.controller.client.ModelControllerClient$Factory from [Module "org.jboss.teiid.admin:main" from local module loader @4b0ab323 (roots: C:\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 org.teiid.adminapi.AdminFactory.createAdmin(AdminFactory.java:95) [teiid-admin-8.0.0.Final.jar:8.0.0.Final]

at com.lgc.dsl.services.producer.teiid.TeiidAdminManager.getAdmin(TeiidAdminManager.java:44) [com_lgc_dsdataserver.jar:]

 

In order to get rid of this error, I had to add the following dependency to teiid admin module.

        <module name="org.jboss.as.controller-client"/> 

 

I had to add a different dependency until Alpha1.  Now that is already part of the module.xml that you ship.  Is this a new dependency that should have been added to the module, or am I missing something?

 

Thanks

Srini

  • 1. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    Ramesh Reddy Master

    Srini,

     

    You defining the "admin" as dependency in your WAR file? I am trying to understand why this is occurring. I thought above mentioned should have brought in through implicit dependency on the "cli" module in the "admin" module.

     

    Ramesh..

  • 2. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    Ramesh Reddy Master

    Srini,

     

    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

     

    Thanks

     

    Ramesh..

  • 3. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    skethire Newbie

    Ramesh,

     

    Thanks a bunch for looking into this.

    I am having similar dependency issues with a custom jdbc driver/ejb/ and JCA container.  It will be a while before I completely understand the JBoss modules and dependency resolution.

     

    Srini

  • 4. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    Ramesh Reddy Master

    Srini,

     

    My suggestion is to deploy the JDBC jar as the module. When you deploy as JAR and try to use the module there is trick to name of the deployed module.

     

    Ramesh..

  • 5. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    skethire Newbie

    Ramesh,

     

    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).

     

    Thanks

    Srini

  • 6. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    Ramesh Reddy Master

    Srini,

     

    Can you post the exception? The behavior seems wrong. Teiid looks up the connection through the JNDI, so the connection semantics are outside of Teiid. So you have a RAR file and translator? or your translator is directly using the JDBC connection inside it?

     

    Ramesh..

  • 7. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    skethire Newbie

    Ramesh,

    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)]]

    at com.lgc.dam.phs.client.jdbc.PhsJDBCConnection.connectToDictionary(PhsJDBCConnection.java:402)

    at com.lgc.dam.phs.client.jdbc.PhsJDBCConnection.<init>(PhsJDBCConnection.java:157)

    at com.lgc.dam.phs.client.jdbc.PhsJDBCDriver.connect(PhsJDBCDriver.java:140)

    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)

    ... 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.

     

    Thanks

    srini

  • 8. Re: Teiid 8.0 Final with JBoss 7.1.1 Final -  AdminAPI - ClassNotFoundException
    Ramesh Reddy Master

    Srini,

     

    Is com.lgc.dam.phs.common.interfaces.PhServerFactory class in the JDBC Driver's module?. Is EJB being looked up using JNDI?

     

    Ramesh..