2 Replies Latest reply on Nov 18, 2013 5:09 AM by kababji

    Accessing JNDI from JBoss Authorization/Authentication Plugin

    kababji

      I am using the post here: Plug Ins - WildFly 8 - Project Documentation Editor as a reference to build a custom plugin for Authorization and Authentication, in my case I have to access a database to retrieve Users and Roles, my idea is was to reuse an existing DataSource defined in standalone.xml, so I only pass the JNDI name to the plugin and then lookup the datasource from code using InitialContext and grab a connection to the database from it.

       

      However when I start JBoss and access it, the plugin throws a java.lang.NoClassDefFoundError: javax/naming/InitialContext, the InitialContext is part of the JDK so why I am getting such exception? it seems like the plugin doesn't have access to javax.* packages! If this is not the correct way then what is the correct way to do it? I wanted to avoid creating and maintaining a JDBC Connection in the plugin itself.