Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2896

Cannot obtain DataSource using JNDI Name lookup

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: 8.0.0.Final
    • Fix Version/s: 8.0.0.Final
    • Component/s: Naming
    • Labels:
      None

      Description

      Hi,
      I'm having a problem to obtain DataSource using JNDI Name lookup.
      Please see my code and error below:

      Connection connection = null;
      DataSource dataSource = null;
      try

      { final Context initContext = new InitialContext(); dataSource = (DataSource) initContext.lookup("java:/MyDataSource"); connection = dataSource.getConnection(); }

      catch (Exception e)

      { LOGGER.error(e); }

      Caused by: javax.naming.NamingException: JBAS011832: Could not dereference object [Root exception is java.lang.NullPointerException]
      at org.jboss.as.naming.NamingContext.getObjectInstance(NamingContext.java:526)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:236)
      at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:233)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
      at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_45]
      at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_45]
      ... 10 more
      Caused by: java.lang.NullPointerException
      at org.jboss.as.naming.NamingContext.getObjectInstance(NamingContext.java:522)
      ... 17 more

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dmlloyd David Lloyd
                Reporter:
                eagleigor Igor Shulika
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: