Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-40250

javax.naming.NameNotFoundException when requesting a javax.sql.DataSource via JNDI after redeploy

    Details

    • Fix Priority:
      4

      Description

      Steps to reproduce

      • Create a global JNDI data source in server.xml
      <GlobalNamingResources>
        ...
        <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource"
          maxActive="5" maxIdle="5" maxWait="-1"
          username="vtv_1" password="password" driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@localhost:1521:LPISSUES"/>
      </GlobalNamingResources>
      
      • Deploy the following portlet: LPS-40250-portlet
      • Redeploy it
      • You get the following exception
      Caused by: javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/myDB] is not bound in this Context. Unable to find [java:comp].
              at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
              at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
              at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
              at com.liferay.portal.security.pacl.jndi.SchemeAwareContextWrapper.lookup(SchemeAwareContextWrapper.java:200)
              at javax.naming.InitialContext.lookup(InitialContext.java:411)
              at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
              at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
              at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
              at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
              at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
              at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
              ... 52 more
      

      Workaround

      As you can see in the stack trace the lookup goes through PACL (com.liferay.portal.security.pacl.jndi.SchemeAwareContextWrapper). After disabling it (ie. setting portal.security.manager.strategy=none) the issue is no longer reproducible.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                laszlo.csontos Laszlo Csontos (Inactive)
                Reporter:
                arpad Philippe Rouvray (Inactive)
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  6 years, 1 week, 2 days ago

                  Packages

                  Version Package
                  6.1.X EE
                  6.2.0 CE RC5