Details

      Description

      Prerequisites to test the issue:

      Configure a jndi GlobalResource in tomcat.
      In server.xml, inside GlobalNamingResources tag, add

      <Resource
      name="jdbc/externalDataSource"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://localhost/yourDB?characterEncoding=UTF-8"
      username="yourdbuser"
      password="yourdbpass"
      maxActive="20"
      maxIdle="5"
      maxWait="10000"
      />

      In context.xml inside of Context Tag, add:
      <ResourceLink name="jdbc/externalDataSource" global="jdbc/externalDataSource" type="javax.sql.DataSource"/>

      Ensure your DB has the Region Table:
      **

      CREATE TABLE `Region` (
       `id` bigint(20) NOT NULL,
       `name` varchar(75) DEFAULT NULL,
       PRIMARY KEY (`id`)
       ) ENGINE=InnoDB DEFAULT CHARSET=utf8

       


      Steps to Reproduce:

      1. Use the blade sample for JNDI:
        https://github.com/liferay/liferay-blade-samples/tree/7.1/liferay-workspace/apps/service-builder/jndi/jndi-service
      2. Deploy service and api modules.

       

      Expected Results:

      There should be no exception.

       

      Actual Results:

      An exception trying to retrieve the driver is thrown, because after LPS-100600 portal properties aren't merged, but anyway there should be no need to test driver class when configuring JNDI.

       

      java.lang.Exception: Unable to start com.liferay.blade.samples.jndiservicebuilder.service
       at com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextRegistrator.start(ModuleApplicationContextRegistrator.java:107)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.apache.felix.dm.impl.InvocationUtil.invokeMethod(InvocationUtil.java:157)
       at org.apache.felix.dm.impl.InvocationUtil.invokeCallbackMethod(InvocationUtil.java:112)
       at org.apache.felix.dm.impl.ComponentImpl.invokeCallbackMethod(ComponentImpl.java:638)
       at org.apache.felix.dm.impl.ComponentImpl.invoke(ComponentImpl.java:1783)
       at org.apache.felix.dm.impl.ComponentImpl.invokeStart(ComponentImpl.java:1281)
       at org.apache.felix.dm.impl.ComponentImpl.performTransition(ComponentImpl.java:1232)
       at org.apache.felix.dm.impl.ComponentImpl.handleChange(ComponentImpl.java:1166)
       at org.apache.felix.dm.impl.ComponentImpl.lambda$start$2(ComponentImpl.java:502)
       at org.apache.felix.dm.impl.SerialExecutor.runTask(SerialExecutor.java:138)
       at org.apache.felix.dm.impl.SerialExecutor.runTasks(SerialExecutor.java:120)
       at org.apache.felix.dm.impl.SerialExecutor.execute(SerialExecutor.java:86)
       at org.apache.felix.dm.impl.SerialExecutor.execute(SerialExecutor.java:105)
       at org.apache.felix.dm.impl.ComponentImpl.start(ComponentImpl.java:500)
       at org.apache.felix.dm.impl.ComponentScheduler.add(ComponentScheduler.java:69)
       at org.apache.felix.dm.DependencyManager.add(DependencyManager.java:141)
       at com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextExtender$ModuleApplicationContextExtension.start(ModuleApplicationContextExtender.java:150)
       at com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextExtender.addingBundle(ModuleApplicationContextExtender.java:76)
       at com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextExtender.addingBundle(ModuleApplicationContextExtender.java:55)
       at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
       at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
       at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
       at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
       at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
       at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
       at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
       at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
       at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
       at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
       at org.eclipse.osgi.container.Module.doStart(Module.java:578)
       at org.eclipse.osgi.container.Module.start(Module.java:449)
       at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
       at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
       at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
       at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
       at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
       at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
       at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
       at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
       at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
       at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayDataSource' defined in URL [bundleentry://1096.fwk1258120701/META-INF/spring/ext-spring.xml]: Cannot resolve reference to bean 'liferayDataSourceFactory' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayDataSourceFactory' defined in URL [bundleentry://1096.fwk1258120701/META-INF/spring/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
       at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
       at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1534)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1281)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
       at com.liferay.portal.spring.aop.AopConfigurableApplicationContextConfigurator$AopBeanFactoryPostProcessor._getPlatformTransactionManager(AopConfigurableApplicationContextConfigurator.java:189)
       at com.liferay.portal.spring.aop.AopConfigurableApplicationContextConfigurator$AopBeanFactoryPostProcessor.postProcessBeanFactory(AopConfigurableApplicationContextConfigurator.java:123)
       at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)
       at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:128)
       at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
       at com.liferay.portal.spring.extender.internal.context.ModuleApplicationContextRegistrator.start(ModuleApplicationContextRegistrator.java:89)
       ... 47 more
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayDataSourceFactory' defined in URL [bundleentry://1096.fwk1258120701/META-INF/spring/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1631)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
       at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
       ... 63 more
      Caused by: java.lang.NullPointerException
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:264)
       at com.liferay.portal.dao.jdbc.DataSourceFactoryImpl.testDatabaseClass(DataSourceFactoryImpl.java:556)
       at com.liferay.portal.dao.jdbc.DataSourceFactoryImpl.initDataSource(DataSourceFactoryImpl.java:128)
       at com.liferay.portal.kernel.dao.jdbc.DataSourceFactoryUtil.initDataSource(DataSourceFactoryUtil.java:39)
       at com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean.createInstance(DataSourceFactoryBean.java:44)
       at com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean.createInstance(DataSourceFactoryBean.java:30)
       at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:135)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1689)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1627)
       ... 70 more

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kyle.miho Kyle Miho
              Reporter:
              mariano.alvaro Mariano Álvaro
              Participants of an Issue:
              Recent user:
              Jason Pince
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 38 weeks, 6 days ago

                  Packages

                  Version Package
                  7.2.10 DXP FP5
                  7.2.10.2 DXP SP2
                  7.2.X
                  7.3.1 CE GA2
                  7.3.2 CE GA3
                  7.3.10 DXP GA1
                  Master