javax.naming.NameNotFoundException: datasources/ABC when share-prepared-statements uses expression

Solution Unverified - Updated -

Issue

  • Getting the following exceptions with the below configuration
<statement>
                        <share-prepared-statements>${ora.sharePreparedStatements:false}</share-prepared-statements>
                    </statement>
                </xa-datasource>
09:46:40,659 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) JBAS014612: Operation ("enable") failed - address: ([
("subsystem" => "datasources"),
("xa-data-source" => "java:jboss/datasources/ABC")
]): java.lang.IllegalArgumentException
at org.jboss.dmr.ModelValue.asBoolean(ModelValue.java:66) [jboss-dmr-1.1.6.Final-redhat-1.jar:1.1.6.Final-redhat-1]
at org.jboss.dmr.ModelNode.asBoolean(ModelNode.java:248) [jboss-dmr-1.1.6.Final-redhat-1.jar:1.1.6.Final-redhat-1]
at org.jboss.as.connector.subsystems.datasources.DataSourceModelNodeUtil.xaFrom(DataSourceModelNodeUtil.java:243)
at org.jboss.as.connector.subsystems.datasources.DataSourceEnable.addServices(DataSourceEnable.java:122)
at org.jboss.as.connector.subsystems.datasources.DataSourceEnable$1.execute(DataSourceEnable.java:95)
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:440) [jboss-as-controller-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:322) [jboss-as-controller-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/config/JndiHibernateConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.sql.DataSource com.config.JndiHibernateConfig.dataSource()] threw exception; nested exception is org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:jboss/datasources/ABC'; nested exception is javax.naming.NameNotFoundException: datasources/ABC -- service jboss.naming.context.java.jboss.datasources.ABC

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.1.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content