Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-6428

@DataSourceDefinition doesn't work correctly

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: public (Regular issues)
    • Labels:
      None

      Description

      I'm trying to deploy the application as discussed in my blog at http://henk53.wordpress.com/2012/04/15/jsf2-primefaces3-ejb3-jpa2-integration-project to Geronimo v3.0.

      The application works without modification on JBoss AS 7.1.2, GlassFis3 3.1.2.2, TomEE 1.5 and WebLogic 12.1.1. (see http://henk53.wordpress.com/2012/06/30/the-state-of-datasourcedefinition-in-java-ee)

      Unfortunately, it does not work on Geronimo v3.0. Upon deployment, I get the following exception:

      Unable to resolve reference "JtaDataSourceWrapper"
          in gbean default/crud/1357734386945/war?J2EEApplication=null,PersistenceUnitModule=WEB-INF/classes/,WebModule=default/crud/1357734386945/war,j2eeType=PersistenceUnit,name=example
          to a gbean matching the pattern [?name=java:app/MyApp/myDS#org.apache.geronimo.naming.ResourceSource]
          due to: No matches for referencePatterns: [?name=java:app/MyApp/myDS#org.apache.geronimo.naming.ResourceSource] (no matches)
      org.apache.geronimo.common.DeploymentException: Unable to resolve reference "JtaDataSourceWrapper"
          in gbean default/crud/1357734386945/war?J2EEApplication=null,PersistenceUnitModule=WEB-INF/classes/,WebModule=default/crud/1357734386945/war,j2eeType=PersistenceUnit,name=example
          to a gbean matching the pattern [?name=java:app/MyApp/myDS#org.apache.geronimo.naming.ResourceSource]
          due to: No matches for referencePatterns: [?name=java:app/MyApp/myDS#org.apache.geronimo.naming.ResourceSource] (no matches)
      	at org.apache.geronimo.deployment.DeploymentContext.getConfigurationData(DeploymentContext.java:550)
      	at org.apache.geronimo.deployment.Deployer.install(Deployer.java:355)
      	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:272)
      	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:140)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
      	at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
      	at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
      	at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
      	at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
      	at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
      	at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
      	at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
      	at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
      	at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
      	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1447)
      	at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:89)
      	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1292)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1387)
      	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:812)
      	at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
      	at sun.rmi.transport.Transport$1.run(Transport.java:177)
      	at sun.rmi.transport.Transport$1.run(Transport.java:174)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
      	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
      	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      

      If I remove persistence.xml and the injection of the entity manager, and instead try to inject the data source directly via @Resource:

      @Resource(lookup="java:app/MyApp/myDS")
      DataSource dataSource;
      

      Then the deployment and injection works, but I get the following exception:

      2013-01-09 13:58:08,484 WARN  [DataSourceService] Some DataSource properties were not set {url=jdbc:h2:mem:test}
      2013-01-09 13:58:08,489 ERROR [MCFConnectionInterceptor] Error occurred creating ManagedConnection for handle: nullManagedConnectionInfo: org.apache.geronimo.connector.outbound.ManagedConnectionInfo@2f320536. mc: null]
      javax.resource.spi.ResourceAdapterInternalException: Unable to obtain physical connection to ds0: url= user=sa
      	at org.tranql.connector.jdbc.AbstractXADataSourceMCF.getPhysicalConnection(AbstractXADataSourceMCF.java:77)
      	at org.apache.geronimo.datasource.DataSourceService$XADataSourceMCF.getPhysicalConnection(DataSourceService.java:257)
      	at org.tranql.connector.jdbc.AbstractXADataSourceMCF.createManagedConnection(AbstractXADataSourceMCF.java:65)
      	at org.apache.geronimo.connector.outbound.MCFConnectionInterceptor.getConnection(MCFConnectionInterceptor.java:48)
      	at org.apache.geronimo.connector.outbound.XAResourceInsertionInterceptor.getConnection(XAResourceInsertionInterceptor.java:41)
      	at org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalGetConnection(SinglePoolConnectionInterceptor.java:70)
      	at org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)
      	at org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:49)
      	at org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:109)
      	at org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)
      	at org.apache.geronimo.connector.outbound.OutboundNamedXAResourceFactory.getNamedXAResource(OutboundNamedXAResourceFactory.java:56)
      	at org.apache.geronimo.transaction.manager.RecoverTask.run(RecoverTask.java:49)
      	at org.apache.geronimo.transaction.manager.TransactionManagerImpl.registerNamedXAResourceFactory(TransactionManagerImpl.java:353)
      	at org.apache.geronimo.connector.outbound.AbstractConnectionManager.doRecovery(AbstractConnectionManager.java:69)
      	at org.apache.geronimo.datasource.DataSourceService.<init>(DataSourceService.java:124)
      	at org.apache.geronimo.datasource.DataSourceGBeanObjectFactory.getObjectInstance(DataSourceGBeanObjectFactory.java:87)
      	at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstanceUsingClassName(ObjectFactoryHelper.java:208)
      	at org.apache.aries.jndi.ObjectFactoryHelper.doGetObjectInstance(ObjectFactoryHelper.java:80)
      	at org.apache.aries.jndi.ObjectFactoryHelper.access$000(ObjectFactoryHelper.java:40)
      	at org.apache.aries.jndi.ObjectFactoryHelper$1.run(ObjectFactoryHelper.java:56)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at org.apache.aries.jndi.Utils.doPrivileged(Utils.java:146)
      	at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:54)
      	at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:57)
      	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:300)
      	at org.apache.xbean.naming.context.ContextUtil.resolve(ContextUtil.java:74)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:116)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:605)
      	at org.apache.xbean.naming.context.ContextFederation.getFederatedBinding(ContextFederation.java:92)
      	at org.apache.xbean.naming.context.AbstractFederatedContext.getDeepBinding(AbstractFederatedContext.java:72)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:114)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:605)
      	at org.apache.geronimo.naming.java.RootContext.lookup(RootContext.java:63)
      	at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
      	at javax.naming.InitialContext.lookup(InitialContext.java:411)
      	at org.apache.geronimo.naming.reference.JndiReference.getContent(JndiReference.java:53)
      	at org.apache.xbean.naming.context.ContextUtil.resolve(ContextUtil.java:61)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:116)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:605)
      	at org.apache.xbean.naming.context.ContextFederation.getFederatedBinding(ContextFederation.java:92)
      	at org.apache.xbean.naming.context.AbstractFederatedContext.getDeepBinding(AbstractFederatedContext.java:72)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:114)
      	at org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:605)
      	at org.apache.geronimo.j2ee.annotation.Holder.addInjections(Holder.java:210)
      	at org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:172)
      	at org.apache.geronimo.myfaces.LifecycleProviderGBean.newInstance(LifecycleProviderGBean.java:65)
      	at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
      	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
      	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
      	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:58)
      	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:171)
      	at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
      	at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
      	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:58)
      	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:171)
      	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72)
      	at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
      	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
      	at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:94)
      	at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:243)
      	at javax.faces.component.UIOutput.getValue(UIOutput.java:71)
      	at javax.faces.component.UIInput.getValue(UIInput.java:147)
      	at org.apache.myfaces.shared.renderkit.RendererUtils.getValue(RendererUtils.java:347)
      	at org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(RendererUtils.java:295)
      	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:190)
      	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:179)
      	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:75)
      	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:641)
      	at org.apache.myfaces.shared.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:336)
      	at org.apache.myfaces.shared.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:169)
      	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:641)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:637)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:637)
      	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:637)
      	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1526)
      	at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:264)
      	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:90)
      	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
      	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      	at org.apache.geronimo.tomcat.security.SecurityValve.invoke(SecurityValve.java:89)
      	at org.apache.geronimo.tomcat.security.jacc.JACCSecurityValve.invoke(JACCSecurityValve.java:54)
      	at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:730)
      	at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
      	at org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
      	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
      	at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:243)
      	at org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:373)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      Caused by: java.sql.SQLException: No suitable driver found for 
      	at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:183)
      	at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:331)
      	at org.tranql.connector.jdbc.AbstractXADataSourceMCF.getPhysicalConnection(AbstractXADataSourceMCF.java:75)
      	... 102 more
      

      Looking at the first warning it seems the URL can't be set, by why:

      2013-01-09 13:58:08,484 WARN  [DataSourceService] Some DataSource properties were not set {url=jdbc:h2:mem:test}
      

      I tried various variants of the URL but the result is always the same.

      In summary, there seem to be two issues:

      The first is that the data source that's created in web.xml does not seem to be recognized in persistence.xml, and the second that the URL property is not being set.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              henkdeboer Henk de Boer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: