-1

I am using drools.

I came cross the casting exception class org.jboss.as.naming.NamingContext cannot be cast to class javax.sql.DataSource. How to rectify this any suggestion on this.

1 Answers1

-1

..."DataSource interface will typically be registered with a naming service based on the Java™ Naming and Directory (JNDI) API"... Java 8 docs.

org.jboss.as.naming.NamingContext is about DNS Domain "Name" Server naming lookup A records links e.t.c.

Drivers for data-sources are usually dynamically loaded with class.forName that uses a scheme of exactly the same as package folder representation. In a nutshell, the dots in any package name suchas e.g. javax.sql.DataSource are actually folder separators as per the Java Naming and Directory Interface rules.

If you are trying to load a data source for a jar file you have no use for org.jboss.as.naming.NamingContext.

Samuel Marchant
  • 331
  • 2
  • 6